From 6ba3b38331dcd0e393b887fa1e77d7c4966d36ba Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 23 Sep 2023 19:07:06 +0300 Subject: [PATCH 28/28] Qualify "Pollution" event name See osdn #48710 Signed-off-by: Marko Lindqvist --- common/events.c | 20 +++++++++----------- utility/fcintl.h | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/common/events.c b/common/events.c index c0864b0ab7..7f9e87a47c 100644 --- a/common/events.c +++ b/common/events.c @@ -154,8 +154,8 @@ static struct { GEN_EV(E_FIRST_CONTACT, E_S_NATION, N_("First Contact")), GEN_EV(E_NEW_GOVERNMENT, E_S_NATION, N_("Learned New Government")), GEN_EV(E_LOW_ON_FUNDS, E_S_NATION, N_("Low Funds")), - GEN_EV(E_POLLUTION, E_S_NATION, N_("Pollution")), - GEN_EV(E_REVOLT_DONE, E_S_NATION, N_("Revolution Ended")), + GEN_EV(E_POLLUTION, E_S_NATION, N_("?event:Pollution")), + GEN_EV(E_REVOLT_DONE, E_S_NATION, N_("Revolution Ended")), GEN_EV(E_REVOLT_START, E_S_NATION, N_("Revolution Started")), GEN_EV(E_SPACESHIP, E_S_NATION, N_("Spaceship Events")), GEN_EV(E_TREATY_ALLIANCE, E_S_TREATY, N_("Alliance")), @@ -281,6 +281,7 @@ const char *get_event_tag(enum event_type event) return events[event_to_index[event]].tag_name; } log_error("unknown event %d", event); + return NULL; } @@ -340,14 +341,14 @@ void events_init(void) if (E_S_XYZZY > events[i].esn) { const char *event_format = Q_(event_sections[events[i].esn]); - int l = 1 + strlen(event_format) + strlen(_(events[i].descr_orig)); + int l = 1 + strlen(event_format) + strlen(Q_(events[i].descr_orig)); events[i].full_descr = fc_malloc(l); fc_snprintf(events[i].full_descr, l, event_format, - _(events[i].descr_orig)); + Q_(events[i].descr_orig)); } else { /* No section part */ - events[i].full_descr = _(events[i].descr_orig); + events[i].full_descr = fc_strdup(Q_(events[i].descr_orig)); } event_to_index[events[i].event] = i; @@ -359,7 +360,7 @@ void events_init(void) "\tdescr_orig='%s'\n" "\tdescr='%s'", i, events[i].event, events[i].enum_name, events[i].tag_name, - events[i].descr_orig, events[i].full_descr); + Qn_(events[i].descr_orig), events[i].full_descr); } for (i = 0; i <= event_type_max(); i++) { @@ -378,10 +379,7 @@ void events_free(void) int i; for (i = 0; i <= event_type_max(); i++) { - if (E_S_XYZZY > events[i].esn) { - /* We have allocated memory for this event */ - free(events[i].full_descr); - events[i].full_descr = NULL; - } + free(events[i].full_descr); + events[i].full_descr = NULL; } } diff --git a/utility/fcintl.h b/utility/fcintl.h index ff876eae5b..5fa28a5199 100644 --- a/utility/fcintl.h +++ b/utility/fcintl.h @@ -84,7 +84,7 @@ extern "C" { #endif /* FREECIV_ENABLE_NLS */ /* This provides an untranslated version of Q_ that allows the caller to - * get access to the original string. This may be needed for comparisons, + * get access to the original string. This may be needed for comparisons, * for instance. */ #define Qn_(String) skip_intl_qualifier_prefix(String) @@ -102,4 +102,4 @@ const char *get_locale_dir(void); } #endif /* __cplusplus */ -#endif /* FC__FCINTL_H */ +#endif /* FC__FCINTL_H */ -- 2.40.1