From fc311c62711eb9a2ff80ab806857e6a917f328c4 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 4 Feb 2023 04:59:55 +0200 Subject: [PATCH 25/25] Rename "Transport Alight" as "Transport Deboard" internally See osdn #45119 Signed-off-by: Marko Lindqvist --- ai/default/aihunt.c | 4 +- ai/default/daicity.c | 2 +- ai/default/daidiplomacy.c | 2 +- client/control.c | 4 +- client/gui-qt/dialogs.cpp | 10 ++--- common/actions.c | 66 ++++++++++++++++++------------ common/actions.h | 8 ++-- common/actres.c | 2 +- common/fc_types.h | 4 +- common/movement.c | 2 +- common/unit.c | 9 ++-- common/unit.h | 4 +- common/unittype.c | 2 +- data/alien/actions.ruleset | 6 +-- data/alien/effects.ruleset | 2 +- data/civ1/actions.ruleset | 8 ++-- data/civ1/effects.ruleset | 2 +- data/civ2/actions.ruleset | 6 +-- data/civ2/effects.ruleset | 2 +- data/civ2civ3/actions.ruleset | 6 +-- data/classic/actions.ruleset | 6 +-- data/classic/effects.ruleset | 2 +- data/goldkeep/actions.ruleset | 6 +-- data/goldkeep/effects.ruleset | 2 +- data/granularity/actions.ruleset | 6 +-- data/multiplayer/actions.ruleset | 6 +-- data/multiplayer/effects.ruleset | 2 +- data/sandbox/actions.ruleset | 6 +-- data/webperimental/actions.ruleset | 6 +-- data/webperimental/effects.ruleset | 2 +- doc/README.actions | 4 +- server/advisors/advdata.c | 2 +- server/rscompat.c | 15 +++++++ server/rscompat.h | 2 + server/ruleset.c | 15 +++++-- server/savegame/savecompat.c | 65 +++++++++++++++++++++++++++++ server/unithand.c | 16 ++++---- 37 files changed, 209 insertions(+), 105 deletions(-) diff --git a/ai/default/aihunt.c b/ai/default/aihunt.c index f12a53932c..c45425ddff 100644 --- a/ai/default/aihunt.c +++ b/ai/default/aihunt.c @@ -367,10 +367,10 @@ static void dai_hunter_try_launch(struct ai_type *ait, if (unit_transported(missile)) { struct unit *ptrans = unit_transport_get(missile); - if (is_action_enabled_unit_on_unit(ACTION_TRANSPORT_ALIGHT, + if (is_action_enabled_unit_on_unit(ACTION_TRANSPORT_DEBOARD, missile, ptrans)) { unit_do_action(unit_owner(punit), punit->id, ptrans->id, - 0, "", ACTION_TRANSPORT_ALIGHT); + 0, "", ACTION_TRANSPORT_DEBOARD); } } diff --git a/ai/default/daicity.c b/ai/default/daicity.c index d48752c89f..f16f817257 100644 --- a/ai/default/daicity.c +++ b/ai/default/daicity.c @@ -1299,7 +1299,7 @@ static int action_target_neg_util(action_id act_id, case ACTRES_BASE: case ACTRES_MINE: case ACTRES_IRRIGATE: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_BOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_LOAD: diff --git a/ai/default/daidiplomacy.c b/ai/default/daidiplomacy.c index 6ea015887e..c99c3ef11d 100644 --- a/ai/default/daidiplomacy.c +++ b/ai/default/daidiplomacy.c @@ -2048,7 +2048,7 @@ void dai_incident(struct ai_type *ait, enum incident_type type, case ACTRES_BASE: case ACTRES_MINE: case ACTRES_IRRIGATE: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_DISEMBARK: case ACTRES_TRANSPORT_BOARD: diff --git a/client/control.c b/client/control.c index a94da7ea55..06aa3fc7f5 100644 --- a/client/control.c +++ b/client/control.c @@ -2157,11 +2157,11 @@ void request_unit_unload(struct unit *pcargo) struct unit *ptrans = unit_transport_get(pcargo); if (can_client_issue_orders() - && ptrans + && ptrans != NULL && can_unit_unload(pcargo, ptrans) && can_unit_survive_at_tile(&(wld.map), pcargo, unit_tile(pcargo))) { if (unit_owner(pcargo) == client.conn.playing) { - request_do_action(ACTION_TRANSPORT_ALIGHT, + request_do_action(ACTION_TRANSPORT_DEBOARD, pcargo->id, ptrans->id, 0, ""); } else { request_do_action(ACTION_TRANSPORT_UNLOAD, diff --git a/client/gui-qt/dialogs.cpp b/client/gui-qt/dialogs.cpp index d774814311..37cd0bcfdc 100644 --- a/client/gui-qt/dialogs.cpp +++ b/client/gui-qt/dialogs.cpp @@ -170,7 +170,7 @@ static void transport_embark(QVariant data1, QVariant data2); static void transport_embark2(QVariant data1, QVariant data2); static void transport_embark3(QVariant data1, QVariant data2); static void transport_embark4(QVariant data1, QVariant data2); -static void transport_alight(QVariant data1, QVariant data2); +static void transport_deboard(QVariant data1, QVariant data2); static void transport_unload(QVariant data1, QVariant data2); static void transport_load(QVariant data1, QVariant data2); static void transport_load2(QVariant data1, QVariant data2); @@ -255,7 +255,7 @@ static const QHash af_map_init(void) action_function[ACTION_EXPEL_UNIT] = expel_unit; action_function[ACTION_HEAL_UNIT] = heal_unit; action_function[ACTION_HEAL_UNIT2] = heal_unit2; - action_function[ACTION_TRANSPORT_ALIGHT] = transport_alight; + action_function[ACTION_TRANSPORT_DEBOARD] = transport_deboard; action_function[ACTION_TRANSPORT_UNLOAD] = transport_unload; action_function[ACTION_TRANSPORT_LOAD] = transport_load; action_function[ACTION_TRANSPORT_LOAD2] = transport_load2; @@ -2613,14 +2613,14 @@ static void transport_load3(QVariant data1, QVariant data2) } /***********************************************************************//** - Action "Transport Alight" for choice dialog + Action "Transport Deboard" for choice dialog ***************************************************************************/ -static void transport_alight(QVariant data1, QVariant data2) +static void transport_deboard(QVariant data1, QVariant data2) { int actor_id = data1.toInt(); int target_id = data2.toInt(); - request_do_action(ACTION_TRANSPORT_ALIGHT, actor_id, target_id, 0, ""); + request_do_action(ACTION_TRANSPORT_DEBOARD, actor_id, target_id, 0, ""); } /***********************************************************************//** diff --git a/common/actions.c b/common/actions.c index 986def6408..f2c50c0999 100644 --- a/common/actions.c +++ b/common/actions.c @@ -765,14 +765,14 @@ static void hard_code_oblig_hard_reqs(void) TRUE, N_("All action enablers for %s must require" " that the target is transporting a unit."), - ACTRES_TRANSPORT_ALIGHT, ACTRES_NONE); + ACTRES_TRANSPORT_DEBOARD, ACTRES_NONE); oblig_hard_req_register(req_from_values(VUT_UNITSTATE, REQ_RANGE_LOCAL, FALSE, FALSE, TRUE, USP_TRANSPORTED), FALSE, N_("All action enablers for %s must require" " that the actor is transported."), - ACTRES_TRANSPORT_ALIGHT, + ACTRES_TRANSPORT_DEBOARD, ACTRES_TRANSPORT_DISEMBARK, ACTRES_NONE); oblig_hard_req_register(req_from_values(VUT_UNITSTATE, REQ_RANGE_LOCAL, @@ -781,7 +781,7 @@ static void hard_code_oblig_hard_reqs(void) FALSE, N_("All action enablers for %s must require" " that the actor is on a livable tile."), - ACTRES_TRANSPORT_ALIGHT, ACTRES_NONE); + ACTRES_TRANSPORT_DEBOARD, ACTRES_NONE); /* Why this is a hard requirement: sanity. */ oblig_hard_req_register(req_from_values(VUT_UNITSTATE, REQ_RANGE_LOCAL, @@ -1345,8 +1345,8 @@ static void hard_code_actions(void) unit_action_new(ACTION_IRRIGATE, ACTRES_IRRIGATE, TRUE, FALSE, MAK_STAYS, 0, 0, FALSE); - actions[ACTION_TRANSPORT_ALIGHT] = - unit_action_new(ACTION_TRANSPORT_ALIGHT, ACTRES_TRANSPORT_ALIGHT, + actions[ACTION_TRANSPORT_DEBOARD] = + unit_action_new(ACTION_TRANSPORT_DEBOARD, ACTRES_TRANSPORT_DEBOARD, TRUE, FALSE, MAK_STAYS, 0, 0, FALSE); actions[ACTION_TRANSPORT_BOARD] = @@ -2266,7 +2266,7 @@ bool action_creates_extra(const struct action *paction, case ACTRES_CLEAN_FALLOUT: case ACTRES_FORTIFY: case ACTRES_CONVERT: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_LOAD: case ACTRES_TRANSPORT_DISEMBARK: @@ -2358,7 +2358,7 @@ bool action_removes_extra(const struct action *paction, case ACTRES_BASE: case ACTRES_MINE: case ACTRES_IRRIGATE: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_LOAD: case ACTRES_TRANSPORT_DISEMBARK: @@ -3367,7 +3367,7 @@ action_actor_utype_hard_reqs_ok_full(const struct action *paction, case ACTRES_TRANSPORT_BOARD: case ACTRES_TRANSPORT_EMBARK: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_DISEMBARK: if (!ignore_third_party) { bool has_transporter = FALSE; @@ -3659,7 +3659,7 @@ action_hard_reqs_actor(const struct action *paction, case ACTRES_BASE: case ACTRES_MINE: case ACTRES_IRRIGATE: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_LOAD: case ACTRES_SPY_ATTACK: @@ -4429,7 +4429,7 @@ is_action_possible(const action_id wanted_action, } break; - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: if (!can_unit_unload(actor->unit, target->unit)) { /* Keep the old rules about Unreachable and disembarks. */ return TRI_NO; @@ -5788,7 +5788,7 @@ action_prob(const action_id wanted_action, case ACTRES_IRRIGATE: chance = ACTPROB_CERTAIN; break; - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: chance = ACTPROB_CERTAIN; break; case ACTRES_TRANSPORT_BOARD: @@ -7098,7 +7098,7 @@ int action_dice_roll_initial_odds(const struct action *paction) case ACTRES_BASE: case ACTRES_MINE: case ACTRES_IRRIGATE: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_LOAD: case ACTRES_TRANSPORT_DISEMBARK: @@ -7675,8 +7675,8 @@ const char *action_ui_name_ruleset_var_name(int act) return "ui_name_build_mine"; case ACTION_IRRIGATE: return "ui_name_irrigate"; - case ACTION_TRANSPORT_ALIGHT: - return "ui_name_transport_alight"; + case ACTION_TRANSPORT_DEBOARD: + return "ui_name_transport_deboard"; case ACTION_TRANSPORT_BOARD: return "ui_name_transport_board"; case ACTION_TRANSPORT_BOARD2: @@ -7995,7 +7995,7 @@ const char *action_ui_name_default(int act) case ACTION_IRRIGATE: /* TRANS: Build _Irrigation (100% chance of success). */ return N_("Build %sIrrigation%s"); - case ACTION_TRANSPORT_ALIGHT: + case ACTION_TRANSPORT_DEBOARD: /* TRANS: _Deboard (100% chance of success). */ return N_("%sDeboard%s"); case ACTION_TRANSPORT_BOARD: @@ -8146,7 +8146,7 @@ const char *action_min_range_ruleset_var_name(int act) case ACTION_BASE: case ACTION_MINE: case ACTION_IRRIGATE: - case ACTION_TRANSPORT_ALIGHT: + case ACTION_TRANSPORT_DEBOARD: case ACTION_TRANSPORT_BOARD: case ACTION_TRANSPORT_BOARD2: case ACTION_TRANSPORT_BOARD3: @@ -8263,7 +8263,7 @@ int action_min_range_default(enum action_result result) case ACTRES_BASE: case ACTRES_MINE: case ACTRES_IRRIGATE: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_LOAD: case ACTRES_TRANSPORT_DISEMBARK: @@ -8368,7 +8368,7 @@ const char *action_max_range_ruleset_var_name(int act) case ACTION_BASE: case ACTION_MINE: case ACTION_IRRIGATE: - case ACTION_TRANSPORT_ALIGHT: + case ACTION_TRANSPORT_DEBOARD: case ACTION_TRANSPORT_BOARD: case ACTION_TRANSPORT_BOARD2: case ACTION_TRANSPORT_BOARD3: @@ -8491,7 +8491,7 @@ int action_max_range_default(enum action_result result) case ACTRES_BASE: case ACTRES_MINE: case ACTRES_IRRIGATE: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_LOAD: case ACTRES_TRANSPORT_DISEMBARK: @@ -8607,7 +8607,7 @@ const char *action_target_kind_ruleset_var_name(int act) case ACTION_BASE: case ACTION_MINE: case ACTION_IRRIGATE: - case ACTION_TRANSPORT_ALIGHT: + case ACTION_TRANSPORT_DEBOARD: case ACTION_TRANSPORT_BOARD: case ACTION_TRANSPORT_BOARD2: case ACTION_TRANSPORT_BOARD3: @@ -8709,7 +8709,7 @@ action_target_kind_default(enum action_result result) case ACTRES_SPY_SABOTAGE_UNIT: case ACTRES_EXPEL_UNIT: case ACTRES_HEAL_UNIT: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_LOAD: case ACTRES_TRANSPORT_BOARD: @@ -8801,7 +8801,7 @@ bool action_result_legal_target_kind(enum action_result result, case ACTRES_SPY_SABOTAGE_UNIT: case ACTRES_EXPEL_UNIT: case ACTRES_HEAL_UNIT: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_LOAD: case ACTRES_TRANSPORT_BOARD: @@ -8907,7 +8907,7 @@ action_sub_target_kind_default(enum action_result result) case ACTRES_SPY_SABOTAGE_UNIT: case ACTRES_EXPEL_UNIT: case ACTRES_HEAL_UNIT: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_LOAD: case ACTRES_TRANSPORT_BOARD: @@ -9037,7 +9037,7 @@ const char *action_actor_consuming_always_ruleset_var_name(action_id act) case ACTION_BASE: case ACTION_MINE: case ACTION_IRRIGATE: - case ACTION_TRANSPORT_ALIGHT: + case ACTION_TRANSPORT_DEBOARD: case ACTION_TRANSPORT_BOARD: case ACTION_TRANSPORT_BOARD2: case ACTION_TRANSPORT_BOARD3: @@ -9214,7 +9214,7 @@ const char *action_blocked_by_ruleset_var_name(const struct action *act) case ACTION_BASE: case ACTION_MINE: case ACTION_IRRIGATE: - case ACTION_TRANSPORT_ALIGHT: + case ACTION_TRANSPORT_DEBOARD: case ACTION_TRANSPORT_BOARD: case ACTION_TRANSPORT_BOARD2: case ACTION_TRANSPORT_BOARD3: @@ -9356,7 +9356,7 @@ action_post_success_forced_ruleset_var_name(const struct action *act) case ACTION_BASE: case ACTION_MINE: case ACTION_IRRIGATE: - case ACTION_TRANSPORT_ALIGHT: + case ACTION_TRANSPORT_DEBOARD: case ACTION_TRANSPORT_BOARD: case ACTION_TRANSPORT_BOARD2: case ACTION_TRANSPORT_BOARD3: @@ -9413,6 +9413,20 @@ bool action_ever_possible(action_id action) return action_enabler_list_size(action_enablers_for_action(action)) > 0; } +/**********************************************************************//** + Specenum callback to update old enum names to current ones. +**************************************************************************/ +const char *gen_action_name_update_cb(const char *old_name) +{ + if (is_ruleset_compat_mode()) { + if (!fc_strcasecmp("Transport Alight", old_name)) { + return "Transport Deboard"; + } + } + + return old_name; +} + const char *atk_helpnames[ATK_COUNT] = { N_("individual cities"), /* ATK_CITY */ diff --git a/common/actions.h b/common/actions.h index 3b1bf0165f..e98039f4aa 100644 --- a/common/actions.h +++ b/common/actions.h @@ -29,6 +29,8 @@ extern "C" { #define SPECENUM_COUNT AAK_COUNT #include "specenum_gen.h" +const char *gen_action_name_update_cb(const char *old_name); + /* Values used in the network protocol. */ /* Names used in file formats but not normally shown to users. */ #define SPECENUM_NAME gen_action @@ -174,9 +176,8 @@ extern "C" { #define SPECENUM_VALUE69NAME "Transport Board 2" #define SPECENUM_VALUE70 ACTION_TRANSPORT_BOARD3 #define SPECENUM_VALUE70NAME "Transport Board_3" -/* Deboard */ -#define SPECENUM_VALUE71 ACTION_TRANSPORT_ALIGHT -#define SPECENUM_VALUE71NAME "Transport Alight" +#define SPECENUM_VALUE71 ACTION_TRANSPORT_DEBOARD +#define SPECENUM_VALUE71NAME "Transport Deboard" #define SPECENUM_VALUE72 ACTION_TRANSPORT_EMBARK #define SPECENUM_VALUE72NAME "Transport Embark" #define SPECENUM_VALUE73 ACTION_TRANSPORT_EMBARK2 @@ -267,6 +268,7 @@ extern "C" { #define SPECENUM_VALUE115NAME "User Action 4" #define SPECENUM_BITVECTOR bv_actions #define SPECENUM_COUNT ACTION_COUNT +#define SPECENUM_NAME_UPDATER #include "specenum_gen.h" /* Fake action id used in searches to signal "any action at all". */ diff --git a/common/actres.c b/common/actres.c index dec7f59709..65fded929d 100644 --- a/common/actres.c +++ b/common/actres.c @@ -66,7 +66,7 @@ static struct actres act_results[ACTRES_LAST] = { { ACT_TGT_COMPL_MANDATORY, ABK_NONE }, /* ACTRES_IRRIGATE */ { ACT_TGT_COMPL_FLEXIBLE, ABK_NONE }, /* ACTRES_CLEAN_POLLUTION */ { ACT_TGT_COMPL_FLEXIBLE, ABK_NONE }, /* ACTRES_CLEAN_FALLOUT */ - { ACT_TGT_COMPL_SIMPLE, ABK_NONE }, /* ACTRES_TRANSPORT_ALIGHT */ + { ACT_TGT_COMPL_SIMPLE, ABK_NONE }, /* ACTRES_TRANSPORT_DEBOARD */ { ACT_TGT_COMPL_SIMPLE, ABK_NONE }, /* ACTRES_TRANSPORT_UNLOAD */ { ACT_TGT_COMPL_SIMPLE, ABK_NONE }, /* ACTRES_TRANSPORT_DISEMBARK */ { ACT_TGT_COMPL_SIMPLE, ABK_NONE }, /* ACTRES_TRANSPORT_BOARD */ diff --git a/common/fc_types.h b/common/fc_types.h index 1331a80d6e..063b21be38 100644 --- a/common/fc_types.h +++ b/common/fc_types.h @@ -281,8 +281,8 @@ enum counter_target { CTGT_CITY }; #define SPECENUM_VALUE46NAME "Unit Clean Pollution" #define SPECENUM_VALUE47 ACTRES_CLEAN_FALLOUT #define SPECENUM_VALUE47NAME "Unit Clean Fallout" -#define SPECENUM_VALUE48 ACTRES_TRANSPORT_ALIGHT -#define SPECENUM_VALUE48NAME "Unit Transport Alight" +#define SPECENUM_VALUE48 ACTRES_TRANSPORT_DEBOARD +#define SPECENUM_VALUE48NAME "Unit Transport Deboard" #define SPECENUM_VALUE49 ACTRES_TRANSPORT_UNLOAD #define SPECENUM_VALUE49NAME "Unit Transport Unload" #define SPECENUM_VALUE50 ACTRES_TRANSPORT_DISEMBARK diff --git a/common/movement.c b/common/movement.c index 0ee6c2a860..2e6caa7c69 100644 --- a/common/movement.c +++ b/common/movement.c @@ -187,7 +187,7 @@ bool unit_can_defend_here(const struct civ_map *nmap, const struct unit *punit) return FALSE; case TDT_ALIGHT: return can_unit_exist_at_tile(nmap, punit, unit_tile(punit)) - && can_unit_alight_or_be_unloaded(punit, ptrans); + && can_unit_deboard_or_be_unloaded(punit, ptrans); } fc_assert(FALSE); diff --git a/common/unit.c b/common/unit.c index f1b7f8574c..d0e3cdf5a1 100644 --- a/common/unit.c +++ b/common/unit.c @@ -799,8 +799,8 @@ bool can_unit_unload(const struct unit *pcargo, const struct unit *ptrans) Return TRUE iff the given unit can leave its current transporter without doing any other action or move. **************************************************************************/ -bool can_unit_alight_or_be_unloaded(const struct unit *pcargo, - const struct unit *ptrans) +bool can_unit_deboard_or_be_unloaded(const struct unit *pcargo, + const struct unit *ptrans) { if (!pcargo || !ptrans) { return FALSE; @@ -809,20 +809,19 @@ bool can_unit_alight_or_be_unloaded(const struct unit *pcargo, fc_assert_ret_val(unit_transport_get(pcargo) == ptrans, FALSE); if (is_server()) { - return (is_action_enabled_unit_on_unit(ACTION_TRANSPORT_ALIGHT, + return (is_action_enabled_unit_on_unit(ACTION_TRANSPORT_DEBOARD, pcargo, ptrans) || is_action_enabled_unit_on_unit(ACTION_TRANSPORT_UNLOAD, ptrans, pcargo)); } else { return (action_prob_possible( - action_prob_vs_unit(pcargo, ACTION_TRANSPORT_ALIGHT, ptrans)) + action_prob_vs_unit(pcargo, ACTION_TRANSPORT_DEBOARD, ptrans)) || action_prob_possible( action_prob_vs_unit(ptrans, ACTION_TRANSPORT_UNLOAD, pcargo))); } } - /**********************************************************************//** Return whether the unit can be paradropped - that is, if the unit is in a friendly city or on an airbase special, has enough movepoints left, and diff --git a/common/unit.h b/common/unit.h index 6b92984793..6803359636 100644 --- a/common/unit.h +++ b/common/unit.h @@ -322,8 +322,8 @@ bool could_unit_be_in_transport(const struct unit *pcargo, bool could_unit_load(const struct unit *pcargo, const struct unit *ptrans); bool can_unit_load(const struct unit *punit, const struct unit *ptrans); bool can_unit_unload(const struct unit *punit, const struct unit *ptrans); -bool can_unit_alight_or_be_unloaded(const struct unit *pcargo, - const struct unit *ptrans); +bool can_unit_deboard_or_be_unloaded(const struct unit *pcargo, + const struct unit *ptrans); bool can_unit_paradrop(const struct unit *punit); bool can_unit_change_homecity_to(const struct unit *punit, const struct city *pcity); diff --git a/common/unittype.c b/common/unittype.c index 213a675344..d91b6aba70 100644 --- a/common/unittype.c +++ b/common/unittype.c @@ -368,7 +368,7 @@ static bool action_is_hostile(action_id act_id) case ACTRES_BASE: case ACTRES_MINE: case ACTRES_IRRIGATE: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_DISEMBARK: case ACTRES_TRANSPORT_BOARD: diff --git a/data/alien/actions.ruleset b/data/alien/actions.ruleset index 61b4454c60..bf619b7cd7 100644 --- a/data/alien/actions.ruleset +++ b/data/alien/actions.ruleset @@ -308,7 +308,7 @@ ui_name_build_mine = _("Build %sMine%s") ui_name_irrigate = _("Build %sIrrigation%s") ; /* TRANS: _Deboard (100% chance of success). */ -ui_name_transport_alight = _("%sDeboard%s") +ui_name_transport_deboard = _("%sDeboard%s") ; /* TRANS: _Board (100% chance of success). */ ui_name_transport_board = _("%sBoard%s") @@ -918,8 +918,8 @@ target_reqs = "TerrainAlter", "CanIrrigate", "Tile" } -[actionenabler_alight] -action = "Transport Alight" +[actionenabler_deboard] +action = "Transport Deboard" actor_reqs = { "type", "name", "range" "UnitState", "OnLivableTile", "Local" diff --git a/data/alien/effects.ruleset b/data/alien/effects.ruleset index d3b7ff46e3..f6af856bba 100644 --- a/data/alien/effects.ruleset +++ b/data/alien/effects.ruleset @@ -971,7 +971,7 @@ reqs = { "type", "name", "range", "present" "Action", "Found City", "Local", FALSE "Action", "Transport Board", "Local", FALSE - "Action", "Transport Alight", "Local", FALSE + "Action", "Transport Deboard", "Local", FALSE "Action", "Transport Disembark", "Local", FALSE "Action", "Transport Disembark 2", "Local", FALSE } diff --git a/data/civ1/actions.ruleset b/data/civ1/actions.ruleset index 43b0ae9143..0d02ca400e 100644 --- a/data/civ1/actions.ruleset +++ b/data/civ1/actions.ruleset @@ -289,7 +289,7 @@ ui_name_build_mine = _("Build %sMine%s") ui_name_irrigate = _("Build %sIrrigation%s") ; /* TRANS: _Deboard (100% chance of success). */ -ui_name_transport_alight = _("%sDeboard%s") +ui_name_transport_deboard = _("%sDeboard%s") ; /* TRANS: _Board (100% chance of success). */ ui_name_transport_board = _("%sBoard%s") @@ -722,8 +722,8 @@ target_reqs = "TerrainAlter", "CanIrrigate", "Tile" } -[actionenabler_alight] -action = "Transport Alight" +[actionenabler_deboard] +action = "Transport Deboard" actor_reqs = { "type", "name", "range" "UnitState", "OnLivableTile", "Local" @@ -763,7 +763,7 @@ actor_reqs = { "type", "name", "range", "present" "UnitState", "Transported", "Local", TRUE "MinMoveFrags", "1", "Local", TRUE - ; use "Transport Alight" from inside the city + ; Use "Transport Deboard" from inside the city "CityTile", "Center", "Tile", FALSE } diff --git a/data/civ1/effects.ruleset b/data/civ1/effects.ruleset index 44c8a4f792..463c56c3f3 100644 --- a/data/civ1/effects.ruleset +++ b/data/civ1/effects.ruleset @@ -1419,7 +1419,7 @@ reqs = "Action", "Found City", "Local", FALSE "Action", "Join City", "Local", FALSE "Action", "Transport Board", "Local", FALSE - "Action", "Transport Alight", "Local", FALSE + "Action", "Transport Deboard", "Local", FALSE "Action", "Transport Disembark", "Local", FALSE } diff --git a/data/civ2/actions.ruleset b/data/civ2/actions.ruleset index 0f217c1923..38a5dd99e6 100644 --- a/data/civ2/actions.ruleset +++ b/data/civ2/actions.ruleset @@ -341,7 +341,7 @@ ui_name_build_mine = _("Build %sMine%s") ui_name_irrigate = _("Build %sIrrigation%s") ; /* TRANS: _Deboard (100% chance of success). */ -ui_name_transport_alight = _("%sDeboard%s") +ui_name_transport_deboard = _("%sDeboard%s") ; /* TRANS: _Board (100% chance of success). */ ui_name_transport_board = _("%sBoard%s") @@ -1038,8 +1038,8 @@ target_reqs = "TerrainAlter", "CanIrrigate", "Tile" } -[actionenabler_alight] -action = "Transport Alight" +[actionenabler_deboard] +action = "Transport Deboard" actor_reqs = { "type", "name", "range" "UnitState", "OnLivableTile", "Local" diff --git a/data/civ2/effects.ruleset b/data/civ2/effects.ruleset index 519e9f803e..6fed4172a0 100644 --- a/data/civ2/effects.ruleset +++ b/data/civ2/effects.ruleset @@ -2335,7 +2335,7 @@ reqs = "Action", "Found City", "Local", FALSE "Action", "Join City", "Local", FALSE "Action", "Transport Board", "Local", FALSE - "Action", "Transport Alight", "Local", FALSE + "Action", "Transport Deboard", "Local", FALSE "Action", "Transport Disembark", "Local", FALSE } diff --git a/data/civ2civ3/actions.ruleset b/data/civ2civ3/actions.ruleset index 105f4940e3..ac152c65c1 100644 --- a/data/civ2civ3/actions.ruleset +++ b/data/civ2civ3/actions.ruleset @@ -373,7 +373,7 @@ ui_name_build_mine = _("Build %sMine%s") ui_name_irrigate = _("Build %sIrrigation%s") ; /* TRANS: _Deboard (100% chance of success). */ -ui_name_transport_alight = _("%sDeboard%s") +ui_name_transport_deboard = _("%sDeboard%s") ; /* TRANS: _Board (100% chance of success). */ ui_name_transport_board = _("%sBoard%s") @@ -1329,8 +1329,8 @@ target_reqs = "ExtraFlag", "AllowsFarmlandOnDesert", "Tile", TRUE } -[actionenabler_alight] -action = "Transport Alight" +[actionenabler_deboard] +action = "Transport Deboard" actor_reqs = { "type", "name", "range" "UnitState", "OnLivableTile", "Local" diff --git a/data/classic/actions.ruleset b/data/classic/actions.ruleset index 8f38315bef..9e5d421e37 100644 --- a/data/classic/actions.ruleset +++ b/data/classic/actions.ruleset @@ -363,7 +363,7 @@ ui_name_build_mine = _("Build %sMine%s") ui_name_irrigate = _("Build %sIrrigation%s") ; /* TRANS: _Deboard (100% chance of success). */ -ui_name_transport_alight = _("%sDeboard%s") +ui_name_transport_deboard = _("%sDeboard%s") ; /* TRANS: _Board (100% chance of success). */ ui_name_transport_board = _("%sBoard%s") @@ -1191,8 +1191,8 @@ target_reqs = "TerrainAlter", "CanIrrigate", "Tile" } -[actionenabler_alight] -action = "Transport Alight" +[actionenabler_deboard] +action = "Transport Deboard" actor_reqs = { "type", "name", "range" "UnitState", "OnLivableTile", "Local" diff --git a/data/classic/effects.ruleset b/data/classic/effects.ruleset index d0062f3ca8..015236a1c8 100644 --- a/data/classic/effects.ruleset +++ b/data/classic/effects.ruleset @@ -2389,7 +2389,7 @@ reqs = "Action", "Found City", "Local", FALSE "Action", "Join City", "Local", FALSE "Action", "Transport Board", "Local", FALSE - "Action", "Transport Alight", "Local", FALSE + "Action", "Transport Deboard", "Local", FALSE "Action", "Transport Disembark", "Local", FALSE "Action", "Transport Disembark 2", "Local", FALSE } diff --git a/data/goldkeep/actions.ruleset b/data/goldkeep/actions.ruleset index 708440a121..b3cf83a6ef 100644 --- a/data/goldkeep/actions.ruleset +++ b/data/goldkeep/actions.ruleset @@ -363,7 +363,7 @@ ui_name_build_mine = _("Build %sMine%s") ui_name_irrigate = _("Build %sIrrigation%s") ; /* TRANS: _Deboard (100% chance of success). */ -ui_name_transport_alight = _("%sDeboard%s") +ui_name_transport_deboard = _("%sDeboard%s") ; /* TRANS: _Board (100% chance of success). */ ui_name_transport_board = _("%sBoard%s") @@ -1205,8 +1205,8 @@ target_reqs = "TerrainAlter", "CanIrrigate", "Tile" } -[actionenabler_alight] -action = "Transport Alight" +[actionenabler_deboard] +action = "Transport Deboard" actor_reqs = { "type", "name", "range" "UnitState", "OnLivableTile", "Local" diff --git a/data/goldkeep/effects.ruleset b/data/goldkeep/effects.ruleset index 7ca13951e8..6a23a8675c 100644 --- a/data/goldkeep/effects.ruleset +++ b/data/goldkeep/effects.ruleset @@ -2732,7 +2732,7 @@ reqs = "Action", "Found City", "Local", FALSE "Action", "Join City", "Local", FALSE "Action", "Transport Board", "Local", FALSE - "Action", "Transport Alight", "Local", FALSE + "Action", "Transport Deboard", "Local", FALSE "Action", "Transport Disembark", "Local", FALSE "Action", "Transport Disembark 2", "Local", FALSE } diff --git a/data/granularity/actions.ruleset b/data/granularity/actions.ruleset index abfefe3456..85647699cf 100644 --- a/data/granularity/actions.ruleset +++ b/data/granularity/actions.ruleset @@ -177,7 +177,7 @@ ui_name_found_city = _("%sBuild City%s") ; action = "Establish Embassy" ; /* TRANS: _Deboard (100% chance of success). */ -ui_name_transport_alight = _("%sDeboard%s") +ui_name_transport_deboard = _("%sDeboard%s") ; /* TRANS: _Board (100% chance of success). */ ui_name_transport_board = _("%sBoard%s") @@ -252,8 +252,8 @@ actor_reqs = "UnitFlag", "Settlers", "Local", TRUE } -[actionenabler_alight] -action = "Transport Alight" +[actionenabler_deboard] +action = "Transport Deboard" actor_reqs = { "type", "name", "range" "UnitState", "OnLivableTile", "Local" diff --git a/data/multiplayer/actions.ruleset b/data/multiplayer/actions.ruleset index 798875dca2..0779a5369f 100644 --- a/data/multiplayer/actions.ruleset +++ b/data/multiplayer/actions.ruleset @@ -354,7 +354,7 @@ ui_name_build_mine = _("Build %sMine%s") ui_name_irrigate = _("Build %sIrrigation%s") ; /* TRANS: _Deboard (100% chance of success). */ -ui_name_transport_alight = _("%sDeboard%s") +ui_name_transport_deboard = _("%sDeboard%s") ; /* TRANS: _Board (100% chance of success). */ ui_name_transport_board = _("%sBoard%s") @@ -1179,8 +1179,8 @@ target_reqs = "TerrainAlter", "CanIrrigate", "Tile" } -[actionenabler_alight] -action = "Transport Alight" +[actionenabler_deboard] +action = "Transport Deboard" actor_reqs = { "type", "name", "range" "UnitState", "OnLivableTile", "Local" diff --git a/data/multiplayer/effects.ruleset b/data/multiplayer/effects.ruleset index 3402096283..9504a5c7bc 100644 --- a/data/multiplayer/effects.ruleset +++ b/data/multiplayer/effects.ruleset @@ -2416,7 +2416,7 @@ reqs = "Action", "Found City", "Local", FALSE "Action", "Join City", "Local", FALSE "Action", "Transport Board", "Local", FALSE - "Action", "Transport Alight", "Local", FALSE + "Action", "Transport Deboard", "Local", FALSE "Action", "Transport Disembark", "Local", FALSE "Action", "Transport Disembark 2", "Local", FALSE } diff --git a/data/sandbox/actions.ruleset b/data/sandbox/actions.ruleset index c04ec8ff65..530a17d225 100644 --- a/data/sandbox/actions.ruleset +++ b/data/sandbox/actions.ruleset @@ -405,7 +405,7 @@ ui_name_build_mine = _("Build %sMine%s") ui_name_irrigate = _("Build %sIrrigation%s") ; /* TRANS: _Deboard (100% chance of success). */ -ui_name_transport_alight = _("%sDeboard%s") +ui_name_transport_deboard = _("%sDeboard%s") ; /* TRANS: _Board (100% chance of success). */ ui_name_transport_board = _("%sBoard%s") @@ -2590,8 +2590,8 @@ target_reqs = "ExtraFlag", "AllowsFarmlandOnDesert", "Tile", TRUE } -[actionenabler_alight] -action = "Transport Alight" +[actionenabler_deboard] +action = "Transport Deboard" actor_reqs = { "type", "name", "range" "UnitState", "OnLivableTile", "Local" diff --git a/data/webperimental/actions.ruleset b/data/webperimental/actions.ruleset index 5eb60fa957..e884ec2a12 100644 --- a/data/webperimental/actions.ruleset +++ b/data/webperimental/actions.ruleset @@ -341,7 +341,7 @@ ui_name_build_mine = _("Build %sMine%s") ui_name_irrigate = _("Build %sIrrigation%s") ; /* TRANS: _Deboard (100% chance of success). */ -ui_name_transport_alight = _("%sDeboard%s") +ui_name_transport_deboard = _("%sDeboard%s") ; /* TRANS: _Board (100% chance of success). */ ui_name_transport_board = _("%sBoard%s") @@ -1491,8 +1491,8 @@ target_reqs = "TerrainAlter", "CanIrrigate", "Tile" } -[actionenabler_alight] -action = "Transport Alight" +[actionenabler_deboard] +action = "Transport Deboard" actor_reqs = { "type", "name", "range" "UnitState", "OnLivableTile", "Local" diff --git a/data/webperimental/effects.ruleset b/data/webperimental/effects.ruleset index 826d205214..db31c65d5e 100644 --- a/data/webperimental/effects.ruleset +++ b/data/webperimental/effects.ruleset @@ -2532,7 +2532,7 @@ reqs = "Action", "Found City", "Local", FALSE "Action", "Join City", "Local", FALSE "Action", "Transport Board", "Local", FALSE - "Action", "Transport Alight", "Local", FALSE + "Action", "Transport Deboard", "Local", FALSE "Action", "Transport Disembark", "Local", FALSE } diff --git a/doc/README.actions b/doc/README.actions index 5ce597ebc9..f3fab893e9 100644 --- a/doc/README.actions +++ b/doc/README.actions @@ -622,8 +622,8 @@ Actions done by a unit against another unit * target must be visible for the actor. * A copy of "Heal Unit" -"Transport Alight" - Exit target transport to same tile. - * UI name can be set using ui_name_transport_alight +"Transport Deboard" - Exit target transport to same tile. + * UI name can be set using ui_name_transport_deboard * actor must be on the same tile as the target * actor must be transported (!) * actor must be on a livable tile (!) diff --git a/server/advisors/advdata.c b/server/advisors/advdata.c index 4e59cbc4a8..be3f11786e 100644 --- a/server/advisors/advdata.c +++ b/server/advisors/advdata.c @@ -921,7 +921,7 @@ adv_want adv_gov_action_immunity_want(struct government *gov) case ACTRES_CLEAN: case ACTRES_CLEAN_POLLUTION: case ACTRES_CLEAN_FALLOUT: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_DISEMBARK: case ACTRES_TRANSPORT_BOARD: diff --git a/server/rscompat.c b/server/rscompat.c index 576e3109fa..06896b6cd7 100644 --- a/server/rscompat.c +++ b/server/rscompat.c @@ -720,3 +720,18 @@ bool rscompat_terrain_extra_rmtime_3_2(struct section_file *file, return ok; } + +/**********************************************************************//** + Adjust freeciv-3.1 ruleset action ui_name to freeciv-3.2 +**************************************************************************/ +const char *rscompat_action_ui_name_S3_2(struct rscompat_info *compat, + int act_id) +{ + if (compat->compat_mode && compat->version < RSFORMAT_3_2) { + if (act_id == ACTION_TRANSPORT_DEBOARD) { + return "ui_name_transport_alight"; + } + } + + return NULL; +} diff --git a/server/rscompat.h b/server/rscompat.h index ac23da00cb..9161146f75 100644 --- a/server/rscompat.h +++ b/server/rscompat.h @@ -74,6 +74,8 @@ void rscompat_settings_do_special_handling(struct section_file *file, bool rscompat_terrain_extra_rmtime_3_2(struct section_file *file, const char *tsection, struct terrain *pterrain); +const char *rscompat_action_ui_name_S3_2(struct rscompat_info *compat, + int act_id); /* In ruleset.c, but should not be in public interface - make static again once * rscompat.c no longer needs. */ diff --git a/server/ruleset.c b/server/ruleset.c index 0ee1f3f8e8..74dff2763a 100644 --- a/server/ruleset.c +++ b/server/ruleset.c @@ -6388,12 +6388,18 @@ static int secfile_lookup_int_default_min_max(struct section_file *file, Load ui_name of one action **************************************************************************/ static bool load_action_ui_name(struct section_file *file, int act, - const char *entry_name) + const char *entry_name, + const char *compat_name) { const char *text; + const char *def = action_ui_name_default(act); - text = secfile_lookup_str_default(file, - action_ui_name_default(act), + if (compat_name != NULL) { + def = secfile_lookup_str_default(file, def, + "actions.%s", compat_name); + } + + text = secfile_lookup_str_default(file, def, "actions.%s", entry_name); sz_strlcpy(action_by_number(act)->ui_name, text); @@ -7784,7 +7790,8 @@ static bool load_ruleset_actions(struct section_file *file, ok = FALSE; } else { load_action_ui_name(file, act_id, - action_ui_name_ruleset_var_name(act_id)); + action_ui_name_ruleset_var_name(act_id), + rscompat_action_ui_name_S3_2(compat, act_id)); } if (!ok) { diff --git a/server/savegame/savecompat.c b/server/savegame/savecompat.c index f5b4ca5910..7db130537c 100644 --- a/server/savegame/savecompat.c +++ b/server/savegame/savecompat.c @@ -1920,6 +1920,38 @@ static void compat_load_030200(struct loaddata *loading, log_debug("Upgrading data from savegame to version 3.2.0"); + { + int action_count; + + action_count = secfile_lookup_int_default(loading->file, 0, + "savefile.action_size"); + + if (action_count > 0) { + const char **modname; + const char **savemod; + int j; + const char *dur_name = "Transport Deboard"; + + modname = secfile_lookup_str_vec(loading->file, &loading->action.size, + "savefile.action_vector"); + + savemod = fc_calloc(action_count, sizeof(*savemod)); + + for (j = 0; j < action_count; j++) { + if (!fc_strcasecmp("Transport Alight", modname[j])) { + savemod[j] = dur_name; + } else { + savemod[j] = modname[j]; + } + } + + secfile_replace_str_vec(loading->file, savemod, action_count, + "savefile.action_vector"); + + free(savemod); + } + } + /* Server setting migration. */ { if (secfile_lookup_int(loading->file, &set_count, "settings.set_count")) { @@ -2747,6 +2779,39 @@ static void compat_load_dev(struct loaddata *loading) } } } + + { + int action_count; + + action_count = secfile_lookup_int_default(loading->file, 0, + "savefile.action_size"); + + if (action_count > 0) { + const char **modname; + const char **savemod; + int j; + const char *dur_name = "Transport Deboard"; + + modname = secfile_lookup_str_vec(loading->file, &loading->action.size, + "savefile.action_vector"); + + savemod = fc_calloc(action_count, sizeof(*savemod)); + + for (j = 0; j < action_count; j++) { + if (!fc_strcasecmp("Transport Alight", modname[j])) { + savemod[j] = dur_name; + } else { + savemod[j] = modname[j]; + } + } + + secfile_replace_str_vec(loading->file, savemod, action_count, + "savefile.action_vector"); + + free(savemod); + } + } + } /* Version < 3.1.93 */ #endif /* FREECIV_DEV_SAVE_COMPAT_3_2 */ diff --git a/server/unithand.c b/server/unithand.c index 51af9c3443..d4265188d3 100644 --- a/server/unithand.c +++ b/server/unithand.c @@ -806,10 +806,10 @@ static bool do_heal_unit(struct player *act_player, Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action. **************************************************************************/ -static bool do_unit_alight(struct player *act_player, - struct unit *act_unit, - struct unit *tgt_unit, - const struct action *paction) +static bool do_unit_deboard(struct player *act_player, + struct unit *act_unit, + struct unit *tgt_unit, + const struct action *paction) { /* Unload the unit and send out info to clients. */ unit_transport_unload_send(act_unit); @@ -1166,7 +1166,7 @@ static struct player *need_war_player_hlp(const struct unit *actor, case ACTRES_BASE: case ACTRES_MINE: case ACTRES_IRRIGATE: - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: case ACTRES_TRANSPORT_UNLOAD: case ACTRES_TRANSPORT_DISEMBARK: case ACTRES_TRANSPORT_BOARD: @@ -3631,10 +3631,10 @@ bool unit_perform_action(struct player *pplayer, do_heal_unit(pplayer, actor_unit, punit, paction)); break; - case ACTRES_TRANSPORT_ALIGHT: + case ACTRES_TRANSPORT_DEBOARD: ACTION_PERFORM_UNIT_UNIT(action_type, actor_unit, punit, - do_unit_alight(pplayer, actor_unit, punit, - paction)); + do_unit_deboard(pplayer, actor_unit, punit, + paction)); break; case ACTRES_TRANSPORT_UNLOAD: ACTION_PERFORM_UNIT_UNIT(action_type, actor_unit, punit, -- 2.39.1