From 0c094132fa2e1bc0a7ecf8023dbc4edb851268c6 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 19 Jul 2023 14:19:10 +0300 Subject: [PATCH 14/14] Split E_CITY_CONQUERED event type from E_UNIT_WIN_ATT See osdn #47806 Signed-off-by: Marko Lindqvist --- common/events.c | 8 ++-- common/events.h | 7 ++-- data/misc/events.spec | 2 +- data/stdsounds.soundspec | 1 + server/citytools.c | 82 ++++++++++++++++++++-------------------- server/plrhand.c | 2 +- server/unithand.c | 2 +- 7 files changed, 53 insertions(+), 51 deletions(-) diff --git a/common/events.c b/common/events.c index d9a5793b6b..c0864b0ab7 100644 --- a/common/events.c +++ b/common/events.c @@ -80,7 +80,7 @@ static struct { char *full_descr; enum event_type event; } events[] = { - /* TRANS: this and following strings are names for events which cause the + /* TRANS: This and following strings are names for events which cause the * server to generate messages. They are used in configuring how the client * handles the different types of messages. Some of them will be displayed * with prefixes, such as "Technology: Learned From Great Library". */ @@ -226,6 +226,7 @@ static struct { GEN_EV(E_INFRAPOINTS, E_S_NATION, N_("Infrapoints")), GEN_EV(E_HUT_MAP, E_S_HUT, N_("Map found from a hut")), GEN_EV(E_TREATY_SHARED_TILES, E_S_TREATY, N_("Tiles shared")), + GEN_EV(E_CITY_CONQUERED, E_S_CITY, N_("Conquered")), /* The sound system also generates "e_client_quit", although there's no * corresponding identifier E_CLIENT_QUIT. */ }; @@ -233,7 +234,7 @@ static struct { /* * Maps from enum event_type to indexes of events[]. Set by - * events_init. + * events_init(). */ static int event_to_index[E_COUNT]; @@ -284,8 +285,7 @@ const char *get_event_tag(enum event_type event) } /**********************************************************************//** - If is_city_event is FALSE this event doesn't effect a city even if - there is a city at the event location. + Does the event affect a city if there's one at the event location. **************************************************************************/ bool is_city_event(enum event_type event) { diff --git a/common/events.h b/common/events.h index d010e7df48..ddb0ea7984 100644 --- a/common/events.h +++ b/common/events.h @@ -174,11 +174,12 @@ extern "C" { #define SPECENUM_VALUE135 E_INFRAPOINTS #define SPECENUM_VALUE136 E_HUT_MAP #define SPECENUM_VALUE137 E_TREATY_SHARED_TILES +#define SPECENUM_VALUE138 E_CITY_CONQUERED /* * Note: If you add a new event, make sure you make a similar change - * to the events array in "common/events.c" using GEN_EV, to - * "data/stdsounds.soundspec", which serves as the documentation to - * soundset authors, and to "data/misc/events.spec". + * to the events array in "common/events.c" using GEN_EV, + * to "data/stdsounds.soundspec", which serves as the documentation + * to soundset authors, and to "data/misc/events.spec". */ #define SPECENUM_COUNT E_COUNT /* The sound system also generates "e_client_quit", although there's no diff --git a/data/misc/events.spec b/data/misc/events.spec index 7bd90ce950..49b6b82bc0 100644 --- a/data/misc/events.spec +++ b/data/misc/events.spec @@ -83,7 +83,7 @@ tiles = { "row", "column", "tag" 2, 11, "e_tech_goal" 3, 0, "e_unit_lost_att" - 3, 1, "e_unit_win_att" + 3, 1, "e_unit_win_att", "e_city_conquered" 3, 1, "e_unit_action_actor_success" 3, 2, "e_unit_buy" 3, 3, "e_unit_built" diff --git a/data/stdsounds.soundspec b/data/stdsounds.soundspec index 37174bb84b..f083ffc82f 100644 --- a/data/stdsounds.soundspec +++ b/data/stdsounds.soundspec @@ -218,6 +218,7 @@ e_bad_command = "stdsounds/illegal.ogg" ; [fcol] ;e_city_gran_throttle = "" ;e_city_growth = "" ;e_city_lost = "" +;e_city_conquered = "" ;e_city_love = "" ;e_city_may_soon_grow = "" ;e_city_normal = "" diff --git a/server/citytools.c b/server/citytools.c index f80270411c..f6ff01648f 100644 --- a/server/citytools.c +++ b/server/citytools.c @@ -2018,7 +2018,7 @@ bool unit_conquer_city(struct unit *punit, struct city *pcity) if (city_size_get(pcity) <= 1) { int saved_id = pcity->id; - notify_player(pplayer, city_tile(pcity), E_UNIT_WIN_ATT, ftc_server, + notify_player(pplayer, city_tile(pcity), E_CITY_CONQUERED, ftc_server, _("You destroy %s completely."), city_tile_link(pcity)); notify_player(cplayer, city_tile(pcity), E_CITY_LOST, ftc_server, @@ -2047,55 +2047,55 @@ bool unit_conquer_city(struct unit *punit, struct city *pcity) send_player_info_c(cplayer, cplayer->connections); if (pcity->original != pplayer) { if (coins > 0) { - notify_player(pplayer, city_tile(pcity), E_UNIT_WIN_ATT, ftc_server, - PL_("You conquer %s; your lootings accumulate" - " to %d gold!", - "You conquer %s; your lootings accumulate" - " to %d gold!", coins), - city_link(pcity), - coins); + notify_player(pplayer, city_tile(pcity), E_CITY_CONQUERED, ftc_server, + PL_("You conquer %s; your lootings accumulate" + " to %d gold!", + "You conquer %s; your lootings accumulate" + " to %d gold!", coins), + city_link(pcity), + coins); notify_player(cplayer, city_tile(pcity), E_CITY_LOST, ftc_server, - PL_("%s conquered %s and looted %d gold" - " from the city.", - "%s conquered %s and looted %d gold" - " from the city.", coins), - player_name(pplayer), - city_link(pcity), - coins); + PL_("%s conquered %s and looted %d gold" + " from the city.", + "%s conquered %s and looted %d gold" + " from the city.", coins), + player_name(pplayer), + city_link(pcity), + coins); } else { - notify_player(pplayer, city_tile(pcity), E_UNIT_WIN_ATT, ftc_server, - _("You conquer %s."), - city_link(pcity)); + notify_player(pplayer, city_tile(pcity), E_CITY_CONQUERED, ftc_server, + _("You conquer %s."), + city_link(pcity)); notify_player(cplayer, city_tile(pcity), E_CITY_LOST, ftc_server, - _("%s conquered %s."), - player_name(pplayer), - city_link(pcity)); + _("%s conquered %s."), + player_name(pplayer), + city_link(pcity)); } } else { if (coins > 0) { - notify_player(pplayer, city_tile(pcity), E_UNIT_WIN_ATT, ftc_server, - PL_("You have liberated %s!" - " Lootings accumulate to %d gold.", - "You have liberated %s!" - " Lootings accumulate to %d gold.", coins), - city_link(pcity), - coins); + notify_player(pplayer, city_tile(pcity), E_CITY_CONQUERED, ftc_server, + PL_("You have liberated %s!" + " Lootings accumulate to %d gold.", + "You have liberated %s!" + " Lootings accumulate to %d gold.", coins), + city_link(pcity), + coins); notify_player(cplayer, city_tile(pcity), E_CITY_LOST, ftc_server, - PL_("%s liberated %s and looted %d gold" - " from the city.", - "%s liberated %s and looted %d gold" - " from the city.", coins), - player_name(pplayer), - city_link(pcity), - coins); + PL_("%s liberated %s and looted %d gold" + " from the city.", + "%s liberated %s and looted %d gold" + " from the city.", coins), + player_name(pplayer), + city_link(pcity), + coins); } else { - notify_player(pplayer, city_tile(pcity), E_UNIT_WIN_ATT, ftc_server, - _("You have liberated %s!"), - city_link(pcity)); + notify_player(pplayer, city_tile(pcity), E_CITY_CONQUERED, ftc_server, + _("You have liberated %s!"), + city_link(pcity)); notify_player(cplayer, city_tile(pcity), E_CITY_LOST, ftc_server, - _("%s liberated %s."), - player_name(pplayer), - city_link(pcity)); + _("%s liberated %s."), + player_name(pplayer), + city_link(pcity)); } } diff --git a/server/plrhand.c b/server/plrhand.c index 094a3d5f81..bd7f844d38 100644 --- a/server/plrhand.c +++ b/server/plrhand.c @@ -485,7 +485,7 @@ void player_loot_player(struct player *pvictor, struct player *pvictim) * give verbose messages of every unit transferred, * and raze buildings according to raze chance * (also removes palace) */ - notify_player(pvictor, city_tile(pcity), E_UNIT_WIN_ATT, + notify_player(pvictor, city_tile(pcity), E_CITY_CONQUERED, ftc_server, /* TRANS: Getting a city as loot */ _("You conquer %s as loot!"), diff --git a/server/unithand.c b/server/unithand.c index 74d548a2d7..3cd55e2bc7 100644 --- a/server/unithand.c +++ b/server/unithand.c @@ -4738,7 +4738,7 @@ static bool unit_do_destroy_city(struct player *act_player, /* Let the actor know. */ notify_player(act_player, city_tile(tgt_city), - E_UNIT_WIN_ATT, ftc_server, + E_CITY_CONQUERED, ftc_server, _("You destroy %s completely."), city_tile_link(tgt_city)); -- 2.40.1