Project

General

Profile

Feature #1807 » 1807.patch

John Robertson, 12/11/2025 09:46 PM

View differences:

client/cityrepdata.c
/* We used to truncate the name to 14 bytes. This should not be needed
* in any modern GUI library and may give an invalid string if a
* multibyte character is clipped. */
return city_name_get(pcity);
return city_name_getx(pcity);
}
/********************************************************************//**
client/gui-gtk-3.22/citydlg.c
canvas_width, canvas_height);
pdialog->shell = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(pdialog->shell), city_name_get(pcity));
gtk_window_set_title(GTK_WINDOW(pdialog->shell),
city_name_getx(pcity));
setup_dialog(pdialog->shell, toplevel);
gtk_window_set_role(GTK_WINDOW(pdialog->shell), "city");
......
if (city_unhappy(pdialog->pcity)) {
/* TRANS: city dialog title */
buf = g_strdup_printf(_("<b>%s</b> - %s citizens - DISORDER"),
city_name_get(pdialog->pcity),
city_name_getx(pdialog->pcity),
population_to_text(city_population(pdialog->pcity)));
} else if (city_celebrating(pdialog->pcity)) {
/* TRANS: city dialog title */
buf = g_strdup_printf(_("<b>%s</b> - %s citizens - celebrating"),
city_name_get(pdialog->pcity),
city_name_getx(pdialog->pcity),
population_to_text(city_population(pdialog->pcity)));
} else if (city_happy(pdialog->pcity)) {
/* TRANS: city dialog title */
buf = g_strdup_printf(_("<b>%s</b> - %s citizens - happy"),
city_name_get(pdialog->pcity),
city_name_getx(pdialog->pcity),
population_to_text(city_population(pdialog->pcity)));
} else {
/* TRANS: city dialog title */
buf = g_strdup_printf(_("<b>%s</b> - %s citizens"),
city_name_get(pdialog->pcity),
city_name_getx(pdialog->pcity),
population_to_text(city_population(pdialog->pcity)));
}
now = gtk_label_get_text(GTK_LABEL(pdialog->name_label));
if (strcmp(now, buf) != 0) {
gtk_window_set_title(GTK_WINDOW(pdialog->shell), city_name_get(pdialog->pcity));
gtk_window_set_title(GTK_WINDOW(pdialog->shell), city_name_getx(pdialog->pcity));
gtk_label_set_markup(GTK_LABEL(pdialog->name_label), buf);
}
client/gui-gtk-4.0/citydlg.c
canvas_width, canvas_height);
pdialog->shell = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(pdialog->shell), city_name_get(pcity));
gtk_window_set_title(GTK_WINDOW(pdialog->shell),
city_name_getx(pcity));
setup_dialog(pdialog->shell, toplevel);
g_signal_connect(pdialog->shell, "destroy",
......
if (city_unhappy(pdialog->pcity)) {
/* TRANS: city dialog title */
buf = g_strdup_printf(_("<b>%s</b> - %s citizens - DISORDER"),
city_name_get(pdialog->pcity),
city_name_getx(pdialog->pcity),
population_to_text(city_population(pdialog->pcity)));
} else if (city_celebrating(pdialog->pcity)) {
/* TRANS: city dialog title */
buf = g_strdup_printf(_("<b>%s</b> - %s citizens - celebrating"),
city_name_get(pdialog->pcity),
city_name_getx(pdialog->pcity),
population_to_text(city_population(pdialog->pcity)));
} else if (city_happy(pdialog->pcity)) {
/* TRANS: city dialog title */
buf = g_strdup_printf(_("<b>%s</b> - %s citizens - happy"),
city_name_get(pdialog->pcity),
city_name_getx(pdialog->pcity),
population_to_text(city_population(pdialog->pcity)));
} else {
/* TRANS: city dialog title */
buf = g_strdup_printf(_("<b>%s</b> - %s citizens"),
city_name_get(pdialog->pcity),
city_name_getx(pdialog->pcity),
population_to_text(city_population(pdialog->pcity)));
}
now = gtk_label_get_text(GTK_LABEL(pdialog->name_label));
if (strcmp(now, buf) != 0) {
gtk_window_set_title(GTK_WINDOW(pdialog->shell), city_name_get(pdialog->pcity));
gtk_window_set_title(GTK_WINDOW(pdialog->shell), city_name_getx(pdialog->pcity));
gtk_label_set_markup(GTK_LABEL(pdialog->name_label), buf);
}
client/gui-gtk-5.0/citydlg.c
canvas_width, canvas_height);
pdialog->shell = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(pdialog->shell), city_name_get(pcity));
gtk_window_set_title(GTK_WINDOW(pdialog->shell), city_name_getx(pcity));
setup_dialog(pdialog->shell, toplevel);
g_signal_connect(pdialog->shell, "destroy",
......
if (city_unhappy(pdialog->pcity)) {
/* TRANS: city dialog title */
buf = g_strdup_printf(_("<b>%s</b> - %s citizens - DISORDER"),
city_name_get(pdialog->pcity),
city_name_getx(pdialog->pcity),
population_to_text(city_population(pdialog->pcity)));
} else if (city_celebrating(pdialog->pcity)) {
/* TRANS: city dialog title */
buf = g_strdup_printf(_("<b>%s</b> - %s citizens - celebrating"),
city_name_get(pdialog->pcity),
city_name_getx(pdialog->pcity),
population_to_text(city_population(pdialog->pcity)));
} else if (city_happy(pdialog->pcity)) {
/* TRANS: city dialog title */
buf = g_strdup_printf(_("<b>%s</b> - %s citizens - happy"),
city_name_get(pdialog->pcity),
city_name_getx(pdialog->pcity),
population_to_text(city_population(pdialog->pcity)));
} else {
/* TRANS: city dialog title */
buf = g_strdup_printf(_("<b>%s</b> - %s citizens"),
city_name_get(pdialog->pcity),
city_name_getx(pdialog->pcity),
population_to_text(city_population(pdialog->pcity)));
}
now = gtk_label_get_text(GTK_LABEL(pdialog->name_label));
if (strcmp(now, buf) != 0) {
gtk_window_set_title(GTK_WINDOW(pdialog->shell), city_name_get(pdialog->pcity));
gtk_window_set_title(GTK_WINDOW(pdialog->shell), city_name_getx(pdialog->pcity));
gtk_label_set_markup(GTK_LABEL(pdialog->name_label), buf);
}
client/gui-qt/citydlg.cpp
QString buf;
// Defeat keyboard shortcut mnemonics
lcity_name->setText(QString(city_name_get(dlgcity))
lcity_name->setText(QString(city_name_getx(dlgcity))
.replace("&", "&&"));
if (city_unhappy(dlgcity)) {
// TRANS: city dialog title
buf = QString(_("%1 - %2 citizens - DISORDER")).arg(city_name_get(dlgcity),
buf = QString(_("%1 - %2 citizens - DISORDER")).arg(city_name_getx(dlgcity),
population_to_text(city_population(dlgcity)));
} else if (city_celebrating(dlgcity)) {
// TRANS: city dialog title
buf = QString(_("%1 - %2 citizens - celebrating")).arg(city_name_get(dlgcity),
buf = QString(_("%1 - %2 citizens - celebrating")).arg(city_name_getx(dlgcity),
population_to_text(city_population(dlgcity)));
} else if (city_happy(dlgcity)) {
// TRANS: city dialog title
buf = QString(_("%1 - %2 citizens - happy")).arg(city_name_get(dlgcity),
buf = QString(_("%1 - %2 citizens - happy")).arg(city_name_getx(dlgcity),
population_to_text(city_population(dlgcity)));
} else {
// TRANS: city dialog title
buf = QString(_("%1 - %2 citizens")).arg(city_name_get(dlgcity),
buf = QString(_("%1 - %2 citizens")).arg(city_name_getx(dlgcity),
population_to_text(city_population(dlgcity)));
}
client/gui-sdl2/citydlg.c
fc_snprintf(cbuf, sizeof(cbuf),
_("City of %s (Population %s citizens)"),
city_name_get(pcity),
city_name_getx(pcity),
population_to_text(city_population(pcity)));
if (city_unhappy(pcity)) {
client/gui-sdl2/cityrep.c
last = pbuf;
count = 0;
city_list_iterate(client.conn.playing->cities, pcity) {
pstr = create_utf8_from_char_fonto(city_name_get(pcity), FONTO_ATTENTION);
pstr = create_utf8_from_char_fonto(city_name_getx(pcity), FONTO_ATTENTION);
pstr->style |= TTF_STYLE_BOLD;
pbuf = create_iconlabel(NULL, pwindow->dst, pstr,
(WF_RESTORE_BACKGROUND | WF_SELECT_WITHOUT_BAR));
client/gui-sdl3/citydlg.c
fc_snprintf(cbuf, sizeof(cbuf),
_("City of %s (Population %s citizens)"),
city_name_get(pcity),
city_name_getx(pcity),
population_to_text(city_population(pcity)));
if (city_unhappy(pcity)) {
client/mapview_common.c
enum color_std *growth_color,
enum color_std *production_color)
{
fc_strlcpy(name_buffer, city_name_get(pcity), name_buffer_len);
fc_strlcpy(name_buffer, city_name_getx(pcity), name_buffer_len);
*production_color = COLOR_MAPVIEW_CITYTEXT;
if (NULL == client.conn.playing
common/city.c
return (pcity->name != NULL) ? pcity->name : "City missing a name";
}
/**********************************************************************//**
Return the name of the city, embellished for removeable, recyclable flags.
**************************************************************************/
const char *city_name_getx(const struct city *pcity)
{
bool spacer = FALSE;
static char em_city_name[MAX_LEN_CITYNAME + 7];
em_city_name[0] = '\0';
if(is_city_option_set(pcity, CITYO_DISBAND)) {
sz_strlcat(em_city_name, "ₓ"); /* ₓ🞪⁻⁰… (alternatives)*/
}
sz_strlcat(em_city_name, city_name_get(pcity));
if (city_has_building(pcity, improvement_by_rule_name(_("Airport")))) {
if (!spacer) {
sz_strlcat(em_city_name, " ");
spacer = TRUE;
}
sz_strlcat(em_city_name, "🛧"); /* 🛧🛪 (alternatives)*/
}
if (city_has_building(pcity, improvement_by_rule_name(_("Recycling Center")))) {
if (!spacer) {
sz_strlcat(em_city_name, " ");
spacer = TRUE;
}
sz_strlcat(em_city_name, "♺"); /* ♺♻♳ (alternatives)*/
}
return em_city_name;
}
/**********************************************************************//**
Set a new name for the city.
**************************************************************************/
common/city.h
/* Properties */
const char *city_name_get(const struct city *pcity);
const char *city_name_getx(const struct city *pcity);
void city_name_set(struct city *pcity, const char *new_name);
#define city_owner(_pcity_) (_pcity_)->owner
#define city_tile(_pcity_) (_pcity_)->tile
(3-3/3)