From a86f3f923f768ff838b829d0f4da02c02aa99127 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 23 Mar 2021 05:49:01 +0200 Subject: [PATCH 30/30] Clean out 3.0 to 3.1 rscompat stuff from master See osdn #41835 Signed-off-by: Marko Lindqvist --- common/unittype.h | 11 - server/rscompat.c | 1159 --------------------------------------------- server/ruleset.c | 35 +- 3 files changed, 1 insertion(+), 1204 deletions(-) diff --git a/common/unittype.h b/common/unittype.h index 55006755c3..24fb38cbc1 100644 --- a/common/unittype.h +++ b/common/unittype.h @@ -155,11 +155,6 @@ struct unit_class { struct extra_type_list *bonus_roads; struct unit_class_list *subset_movers; } cache; - - /* Used to upgrade the ruleset format version. */ - struct { - enum hut_behavior hut_behavior; - } rscompat_cache_from_3_0; }; /* Unit "special effects" flags: @@ -566,12 +561,6 @@ struct unit_type { * bonus multiplier), for other 0 */ } cache; - /* Used to upgrade the ruleset format version. */ - struct { - int paratroopers_mr_req; - int paratroopers_mr_sub; - } rscompat_cache; - void *ais[FREECIV_AI_MOD_LAST]; }; diff --git a/server/rscompat.c b/server/rscompat.c index db47480c4d..020d6f95f3 100644 --- a/server/rscompat.c +++ b/server/rscompat.c @@ -254,63 +254,6 @@ void rscompat_enablers_add_obligatory_hard_reqs(void) } action_iterate_end; } -/**********************************************************************//** - Find and return the first unused unit type user flag. If all unit type - user flags are taken MAX_NUM_USER_UNIT_FLAGS is returned. -**************************************************************************/ -static int first_free_unit_type_user_flag(void) -{ - int flag; - - /* Find the first unused user defined unit type flag. */ - for (flag = 0; flag < MAX_NUM_USER_UNIT_FLAGS; flag++) { - if (unit_type_flag_id_name_cb(flag + UTYF_USER_FLAG_1) == NULL) { - return flag; - } - } - - /* All unit type user flags are taken. */ - return MAX_NUM_USER_UNIT_FLAGS; -} - -/**********************************************************************//** - Find and return the first unused unit class user flag. If all unit class - user flags are taken MAX_NUM_USER_UCLASS_FLAGS is returned. -**************************************************************************/ -static int first_free_unit_class_user_flag(void) -{ - int flag; - - /* Find the first unused user defined unit class flag. */ - for (flag = 0; flag < MAX_NUM_USER_UCLASS_FLAGS; flag++) { - if (unit_class_flag_id_name_cb(flag + UCF_USER_FLAG_1) == NULL) { - return flag; - } - } - - /* All unit class user flags are taken. */ - return MAX_NUM_USER_UCLASS_FLAGS; -} - -/**********************************************************************//** - Find and return the first unused terrain user flag. If all terrain - user flags are taken MAX_NUM_USER_TER_FLAGS is returned. -**************************************************************************/ -static int first_free_terrain_user_flag(void) -{ - int flag; - - /* Find the first unused user defined terrain flag. */ - for (flag = 0; flag < MAX_NUM_USER_TER_FLAGS; flag++) { - if (terrain_flag_id_name_cb(flag + TER_USER_1) == NULL) { - return flag; - } - } - - /* All terrain user flags are taken. */ - return MAX_NUM_USER_TER_FLAGS; -} - /**********************************************************************//** Do compatibility things with names before they are referred to. Runs after names are loaded from the ruleset but before the ruleset objects @@ -323,284 +266,19 @@ static int first_free_terrain_user_flag(void) **************************************************************************/ bool rscompat_names(struct rscompat_info *info) { - if (info->ver_units < 20) { - /* Some unit type flags moved to the ruleset between 3.0 and 3.1. - * Add them back as user flags. - * XXX: ruleset might not need all of these, and may have enough - * flags of its own that these additional ones prevent conversion. */ - const struct { - const char *name; - const char *helptxt; - } new_flags_31[] = { - { N_("BeachLander"), N_("Won't lose all movement when moving from" - " non-native terrain to native terrain.") }, - { N_("Cant_Fortify"), NULL }, - { N_("OneAttack"), NULL }, - }; - enough_new_user_flags(new_flags_31, unit_type, - UTYF_LAST_USER_FLAG, UTYF_LAST_USER_FLAG_3_0); - - /* Some unit class flags moved to the ruleset between 3.0 and 3.1. - * Add them back as user flags. - * XXX: ruleset might not need all of these, and may have enough - * flags of its own that these additional ones prevent conversion. */ - const struct { - const char *name; - const char *helptxt; - } new_class_flags_31[] = { - { N_("Missile"), N_("Unit is destroyed when it attacks") }, - { N_("CanPillage"), N_("Can pillage tile improvements.") }, - { N_("CanFortify"), N_("Gets a 50% defensive bonus while" - " in cities.") }, - { N_("HutNothing"), N_("Does nothing to huts.") }, - }; - enough_new_user_flags(new_class_flags_31, unit_class, - UCF_LAST_USER_FLAG, UCF_LAST_USER_FLAG_3_0); - - int first_free; - int i; - - /* Unit type flags. */ - first_free = first_free_unit_type_user_flag() + UTYF_USER_FLAG_1; - - for (i = 0; i < ARRAY_SIZE(new_flags_31); i++) { - if (UTYF_USER_FLAG_1 + MAX_NUM_USER_UNIT_FLAGS <= first_free + i) { - /* Can't add the user unit type flags. */ - ruleset_error(LOG_ERROR, - "Can't upgrade the ruleset. Not enough free unit type " - "user flags to add user flags for the unit type flags " - "that used to be hardcoded."); - return FALSE; - } - /* Shouldn't be possible for valid old ruleset to have flag names that - * clash with these ones */ - if (unit_type_flag_id_by_name(new_flags_31[i].name, fc_strcasecmp) - != unit_type_flag_id_invalid()) { - ruleset_error(LOG_ERROR, - "Ruleset had illegal user unit type flag '%s'", - new_flags_31[i].name); - return FALSE; - } - set_user_unit_type_flag_name(first_free + i, - new_flags_31[i].name, - new_flags_31[i].helptxt); - } - - /* Unit type class flags. */ - first_free = first_free_unit_class_user_flag() + UCF_USER_FLAG_1; - - for (i = 0; i < ARRAY_SIZE(new_class_flags_31); i++) { - if (UCF_USER_FLAG_1 + MAX_NUM_USER_UCLASS_FLAGS <= first_free + i) { - /* Can't add the user unit type class flags. */ - ruleset_error(LOG_ERROR, - "Can't upgrade the ruleset. Not enough free unit " - "type class user flags to add user flags for the " - "unit type class flags that used to be hardcoded."); - return FALSE; - } - /* Shouldn't be possible for valid old ruleset to have flag names that - * clash with these ones */ - if (unit_class_flag_id_by_name(new_class_flags_31[i].name, - fc_strcasecmp) - != unit_class_flag_id_invalid()) { - ruleset_error(LOG_ERROR, - "Ruleset had illegal user unit class flag '%s'", - new_class_flags_31[i].name); - return FALSE; - } - set_user_unit_class_flag_name(first_free + i, - new_class_flags_31[i].name, - new_class_flags_31[i].helptxt); - } - } - - if (info->ver_terrain < 20) { - /* Some terrain flags moved to the ruleset between 3.0 and 3.1. - * Add them back as user flags. - * XXX: ruleset might not need all of these, and may have enough - * flags of its own that these additional ones prevent conversion. */ - const struct { - const char *name; - const char *helptxt; - } new_flags_31[] = { - { N_("NoFortify"), N_("No units can fortify on this terrain.") }, - }; - enough_new_user_flags(new_flags_31, terrain, - TER_USER_LAST, TER_LAST_USER_FLAG_3_0); - - int first_free; - int i; - - /* Terrain flags. */ - first_free = first_free_terrain_user_flag() + TER_USER_1; - - for (i = 0; i < ARRAY_SIZE(new_flags_31); i++) { - if (TER_USER_1 + MAX_NUM_USER_TER_FLAGS <= first_free + i) { - /* Can't add the user terrain flags. */ - ruleset_error(LOG_ERROR, - "Can't upgrade the ruleset. Not enough free terrain " - "user flags to add user flags for the terrain flags " - "that used to be hardcoded."); - return FALSE; - } - /* Shouldn't be possible for valid old ruleset to have flag names that - * clash with these ones */ - if (terrain_flag_id_by_name(new_flags_31[i].name, fc_strcasecmp) - != terrain_flag_id_invalid()) { - ruleset_error(LOG_ERROR, - "Ruleset had illegal user terrain flag '%s'", - new_flags_31[i].name); - return FALSE; - } - set_user_terrain_flag_name(first_free + i, - new_flags_31[i].name, - new_flags_31[i].helptxt); - } - } - /* No errors encountered. */ return TRUE; } -/**********************************************************************//** - Copy the ui_name of an existing action to the ui_name of its copy by - inserting it at the first %s in name_modification string. -**************************************************************************/ -static void split_action_name_update(struct action *original, - struct action *copy, - const char *name_modification) -{ - fc_snprintf(copy->ui_name, MAX_LEN_NAME, - name_modification, original->ui_name); -} - -/**********************************************************************//** - Handle a universal being separated from an original universal. - - A universal may be split into two new universals. An effect may mention - the universal that now has been split in its requirement list. In that - case two effect - one for the original and one for the universal being - separated from it - are needed. - - Check if the original universal is mentioned in the requirement list of - peffect. Handle creating one effect for the original and one for the - universal that has been separated out if it is. -**************************************************************************/ -static bool effect_handle_split_universal(struct effect *peffect, - struct universal original, - struct universal separated) -{ - if (universal_is_mentioned_by_requirements(&peffect->reqs, &original)) { - /* Copy the old effect. */ - struct effect *peffect_copy = effect_copy(peffect); - - /* Replace the original requirement with the separated requirement. */ - return universal_replace_in_req_vec(&peffect_copy->reqs, - &original, &separated); - } - - return FALSE; -} - /**********************************************************************//** Adjust effects **************************************************************************/ static bool effect_list_compat_cb(struct effect *peffect, void *data) { - struct rscompat_info *info = (struct rscompat_info *)data; - - if (info->ver_effects < 20) { - /* Attack has been split in regular "Attack" and "Suicide Attack". */ - effect_handle_split_universal(peffect, - universal_by_number(VUT_ACTION, ACTION_ATTACK), - universal_by_number(VUT_ACTION, ACTION_SUICIDE_ATTACK)); - - /* "Nuke City" and "Nuke Units" has been split from "Explode Nuclear". - * "Explode Nuclear" is now only about exploding at the current tile. */ - effect_handle_split_universal(peffect, - universal_by_number(VUT_ACTION, ACTION_NUKE), - universal_by_number(VUT_ACTION, ACTION_NUKE_CITY)); - effect_handle_split_universal(peffect, - universal_by_number(VUT_ACTION, ACTION_NUKE), - universal_by_number(VUT_ACTION, ACTION_NUKE_UNITS)); - - /* Production or building targeted actions have been split in one action - * for each target. */ - effect_handle_split_universal(peffect, - universal_by_number(VUT_ACTION, ACTION_SPY_TARGETED_SABOTAGE_CITY), - universal_by_number(VUT_ACTION, ACTION_SPY_SABOTAGE_CITY_PRODUCTION)); - effect_handle_split_universal(peffect, - universal_by_number(VUT_ACTION, ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC), - universal_by_number(VUT_ACTION, ACTION_SPY_SABOTAGE_CITY_PRODUCTION_ESC)); - - if (peffect->type == EFT_ILLEGAL_ACTION_MOVE_COST) { - /* Boarding a transporter became action enabler controlled in - * Freeciv 3.1. Old hard coded rules had no punishment for trying to - * do this when it is illegal according to the rules. */ - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, - FALSE, FALSE, - "Transport Board")); - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, - FALSE, FALSE, - "Transport Embark")); - - /* Disembarking became action enabler controlled in Freeciv 3.1. Old - * hard coded rules had no punishment for trying to do those when it - * is illegal according to the rules. */ - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, - FALSE, FALSE, - "Transport Disembark")); - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, - FALSE, FALSE, - "Transport Disembark 2")); - } - - /* "Paradrop Unit" has been split by side effects. */ - effect_handle_split_universal(peffect, - universal_by_number(VUT_ACTION, ACTION_PARADROP), - universal_by_number(VUT_ACTION, ACTION_PARADROP_CONQUER)); - effect_handle_split_universal(peffect, - universal_by_number(VUT_ACTION, ACTION_PARADROP), - universal_by_number(VUT_ACTION, ACTION_PARADROP_ENTER)); - effect_handle_split_universal(peffect, - universal_by_number(VUT_ACTION, ACTION_PARADROP), - universal_by_number(VUT_ACTION, ACTION_PARADROP_ENTER_CONQUER)); - effect_handle_split_universal(peffect, - universal_by_number(VUT_ACTION, ACTION_PARADROP), - universal_by_number(VUT_ACTION, ACTION_PARADROP_FRIGHTEN)); - effect_handle_split_universal(peffect, - universal_by_number(VUT_ACTION, ACTION_PARADROP), - universal_by_number(VUT_ACTION, ACTION_PARADROP_FRIGHTEN_CONQUER)); - } - /* Go to the next effect. */ return TRUE; } -/**********************************************************************//** - Turn paratroopers_mr_sub into the Action_Success_Actor_Move_Cost effect -**************************************************************************/ -static void paratroopers_mr_sub_to_effect(struct unit_type *putype, - struct action *paction) -{ - struct effect *peffect; - - /* Subtract the value via the Action_Success_Actor_Move_Cost effect */ - peffect = effect_new(EFT_ACTION_SUCCESS_MOVE_COST, - putype->rscompat_cache.paratroopers_mr_sub, - NULL); - - /* The reduction only applies to this action. */ - effect_req_append(peffect, - req_from_str("Action", "Local", FALSE, TRUE, FALSE, - action_rule_name(paction))); - - /* The reduction only applies to this unit type. */ - effect_req_append(peffect, - req_from_str("UnitType", "Local", FALSE, TRUE, FALSE, - utype_rule_name(putype))); -} - /**********************************************************************//** Do compatibility things after regular ruleset loading. **************************************************************************/ @@ -637,843 +315,6 @@ void rscompat_postprocess(struct rscompat_info *info) } action_iterate_end; } - if (info->ver_effects < 20) { - struct effect *peffect; - - /* Post successful action move fragment loss for "Bombard" - * has moved to the ruleset. */ - peffect = effect_new(EFT_ACTION_SUCCESS_MOVE_COST, - MAX_MOVE_FRAGS, NULL); - - /* The reduction only applies to "Bombard". */ - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, TRUE, - TRUE, "Bombard")); - - /* Post successful action move fragment loss for "Heal Unit" - * has moved to the ruleset. */ - peffect = effect_new(EFT_ACTION_SUCCESS_MOVE_COST, - MAX_MOVE_FRAGS, NULL); - - /* The reduction only applies to "Heal Unit". */ - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, TRUE, - TRUE, "Heal Unit")); - - /* Post successful action move fragment loss for "Expel Unit" - * has moved to the ruleset. */ - peffect = effect_new(EFT_ACTION_SUCCESS_MOVE_COST, - SINGLE_MOVE, NULL); - - /* The reduction only applies to "Expel Unit". */ - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, TRUE, - TRUE, "Expel Unit")); - - /* Post successful action move fragment loss for "Capture Units" - * has moved to the ruleset. */ - peffect = effect_new(EFT_ACTION_SUCCESS_MOVE_COST, - SINGLE_MOVE, NULL); - - /* The reduction only applies to "Capture Units". */ - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, TRUE, - TRUE, "Capture Units")); - - /* Post successful action move fragment loss for "Establish Embassy" - * has moved to the ruleset. */ - peffect = effect_new(EFT_ACTION_SUCCESS_MOVE_COST, - 1, NULL); - - /* The reduction only applies to "Establish Embassy". */ - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, TRUE, - TRUE, "Establish Embassy")); - - /* Post successful action move fragment loss for "Investigate City" - * has moved to the ruleset. */ - peffect = effect_new(EFT_ACTION_SUCCESS_MOVE_COST, - 1, NULL); - - /* The reduction only applies to "Investigate City". */ - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, TRUE, - TRUE, "Investigate City")); - - /* Post successful action move fragment loss for targets of "Expel Unit" - * has moved to the ruleset. */ - peffect = effect_new(EFT_ACTION_SUCCESS_TARGET_MOVE_COST, - MAX_MOVE_FRAGS, NULL); - - /* The reduction only applies to "Expel Unit". */ - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, TRUE, - TRUE, "Expel Unit")); - - /* Post successful action move fragment loss for "OneAttack" - * has moved to the ruleset. */ - peffect = effect_new(EFT_ACTION_SUCCESS_MOVE_COST, - MAX_MOVE_FRAGS, NULL); - /* The reduction only applies to "Attack". */ - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, TRUE, - TRUE, "Attack")); - /* The reduction only applies to "OneAttack". */ - effect_req_append(peffect, req_from_str("UnitFlag", "Local", FALSE, TRUE, - TRUE, "OneAttack")); - - action_by_result_iterate(paction, act_id, ACTRES_ATTACK) { - if (paction->actor_consuming_always) { - /* Not relevant. */ - continue; - } - - peffect = effect_new(EFT_ACTION_SUCCESS_MOVE_COST, - SINGLE_MOVE, NULL); - /* The reduction only applies to this action. */ - effect_req_append(peffect, req_from_str("Action", "Local", - FALSE, TRUE, TRUE, - action_rule_name(paction))); - /* The reduction doesn't apply to "OneAttack". */ - effect_req_append(peffect, req_from_str("UnitFlag", "Local", - FALSE, FALSE, TRUE, - "OneAttack")); - } action_by_result_iterate_end; - - /* Post successful action move fragment loss for spy post action escape - * has moved to the ruleset. */ - action_iterate(act_id) { - struct action *paction = action_by_number(act_id); - - if (paction->actor.is_unit.moves_actor != MAK_ESCAPE - || paction->actor_consuming_always) { - /* Not relevant. */ - continue; - } - - peffect = effect_new(EFT_ACTION_SUCCESS_MOVE_COST, - MAX_MOVE_FRAGS, NULL); - /* The reduction only applies to this action. */ - effect_req_append(peffect, req_from_str("Action", "Local", - FALSE, TRUE, TRUE, - action_rule_name(paction))); - } action_iterate_end; - - /* Post successful action move fragment loss for targets of - * "Paradrop Unit" has moved to the Action_Success_Actor_Move_Cost - * effect. */ - unit_type_iterate(putype) { - if (!utype_can_do_action(putype, ACTION_PARADROP)) { - /* Not relevant */ - continue; - } - - if (putype->rscompat_cache.paratroopers_mr_sub == 0) { - /* Not relevant */ - continue; - } - - action_by_result_iterate(paction, act_id, ACTRES_PARADROP) { - paratroopers_mr_sub_to_effect(putype, paction); - } action_by_result_iterate_end; - action_by_result_iterate(paction, act_id, ACTRES_PARADROP_CONQUER) { - paratroopers_mr_sub_to_effect(putype, paction); - } action_by_result_iterate_end; - } unit_type_iterate_end; - - /* Fortifying rules have been unhardcoded to effects. */ - peffect = effect_new(EFT_FORTIFY_DEFENSE_BONUS, 50, NULL); - - /* Unit actually fortified. This does not need checks for unit class or - * type flags for unit's ability to fortify as it would not be fortified - * if it can't. */ - effect_req_append(peffect, req_from_str("Activity", "Local", FALSE, TRUE, - FALSE, "Fortified")); - - /* Fortify bonus in cities */ - peffect = effect_new(EFT_FORTIFY_DEFENSE_BONUS, 50, NULL); - - /* City center */ - effect_req_append(peffect, req_from_str("CityTile", "Local", FALSE, TRUE, - FALSE, "Center")); - /* Not cumulative with regular fortified bonus */ - effect_req_append(peffect, req_from_str("Activity", "Local", FALSE, FALSE, - FALSE, "Fortified")); - /* Unit flags */ - effect_req_append(peffect, req_from_str("UnitClassFlag", "Local", FALSE, TRUE, - FALSE, "CanFortify")); - effect_req_append(peffect, req_from_str("UnitFlag", "Local", FALSE, FALSE, - FALSE, "Cant_Fortify")); - - /* The probability that "Steal Maps" and "Steal Maps Escape" steals the - * map of a tile has moved to the ruleset. */ - peffect = effect_new(EFT_MAPS_STOLEN_PCT, -50, NULL); - - /* The rule that "Recycle Unit"'s unit shield value is 50% has moved to - * the ruleset. */ - peffect = effect_new(EFT_UNIT_SHIELD_VALUE_PCT, -50, NULL); - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, TRUE, - FALSE, "Recycle Unit")); - - /* The rule that "Upgrade Unit"'s current unit shield value is 50% when - * calculating unit upgrade price has moved to the ruleset. */ - peffect = effect_new(EFT_UNIT_SHIELD_VALUE_PCT, -50, NULL); - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, TRUE, - FALSE, "Upgrade Unit")); - - /* The rule that "Heal Unit" heals up to 25% has moved to the - * ruleset. */ - peffect = effect_new(EFT_HEAL_UNIT_PCT, -75, NULL); - effect_req_append(peffect, req_from_str("Action", "Local", FALSE, TRUE, - FALSE, "Heal Unit")); - - /* Help ruleset authors specify the new arguments to unit_move() and - * unit_teleport() by introducing boolean effects */ - log_normal(_("Preparing user effects to help you port edit.unit_move()" - " and edit.unit_teleport() Lua calls.")); - log_normal(_("It is safe to delete the effects if you don't use" - " unit_move() or unit_teleport() or if you want to fill" - " in the new parameters with your own values.")); - log_normal(_("Use effects.unit_bonus() and effects.unit_vs_tile_bonus()" - " to get the value of the user effects" - " if you wish to use them.")); - - /* EFT_USER_EFFECT_1 is if a unit may occupy a city */ - log_normal(_("User_Effect_1 is now if a unit can conquer a city.")); - peffect = effect_new(EFT_USER_EFFECT_1, 1, NULL); - effect_req_append(peffect, - req_from_str("UnitClassFlag", "Local", - FALSE, TRUE, FALSE, "CanOccupyCity")); - effect_req_append(peffect, - req_from_str("UnitFlag", "Local", - FALSE, FALSE, FALSE, "NonMil")); - effect_req_append(peffect, - req_from_str("DiplRel", "Local", - FALSE, TRUE, FALSE, "War")); - nations_iterate(pnation) { - if (nation_barbarian_type(pnation) == ANIMAL_BARBARIAN) { - effect_req_append(peffect, - req_from_str("Nation", "Local", - FALSE, FALSE, FALSE, - nation_rule_name(pnation))); - } - } nations_iterate_end; - - /* EFT_USER_EFFECT_2 is if a unit may occupy an extra */ - log_normal(_("User_Effect_2 is now if a unit can conquer an extra.")); - peffect = effect_new(EFT_USER_EFFECT_2, 1, NULL); - effect_req_append(peffect, - req_from_str("DiplRel", "Local", - FALSE, TRUE, FALSE, "War")); - - peffect = effect_new(EFT_USER_EFFECT_2, 1, NULL); - effect_req_append(peffect, - req_from_str("CityTile", "Local", - FALSE, FALSE, FALSE, "Extras Owned")); - - /* EFT_USER_EFFECT_3 is if a unit may enter a hut */ - log_normal(_("User_Effect_3 is now if a unit can enter a hut.")); - peffect = effect_new(EFT_USER_EFFECT_3, 1, NULL); - effect_req_append(peffect, - req_from_str("UnitClassFlag", "Local", - FALSE, FALSE, FALSE, "HutFrighten")); - effect_req_append(peffect, - req_from_str("UnitClassFlag", "Local", - FALSE, FALSE, FALSE, "HutNothing")); - - /* EFT_USER_EFFECT_4 is if a unit may frighten a hut */ - log_normal(_("User_Effect_4 is now if a unit can frighten a hut.")); - peffect = effect_new(EFT_USER_EFFECT_4, 1, NULL); - effect_req_append(peffect, - req_from_str("UnitClassFlag", "Local", - FALSE, TRUE, FALSE, "HutFrighten")); - effect_req_append(peffect, - req_from_str("UnitClassFlag", "Local", - FALSE, FALSE, FALSE, "HutNothing")); - } - - if (info->ver_game < 20) { - /* New enablers */ - struct action_enabler *enabler; - struct requirement e_req; - struct action *paction; - - paction = action_by_number(ACTION_NUKE_CITY); - paction->target_kind = ATK_CITY; - paction->actor_consuming_always = TRUE; - paction->min_distance = 1; - paction->max_distance = RS_DEFAULT_ACTION_MAX_RANGE; - - paction = action_by_number(ACTION_NUKE); - paction->actor_consuming_always = TRUE; - paction->min_distance = 0; - - paction = action_by_number(ACTION_NUKE_UNITS); - paction->actor_consuming_always = TRUE; - paction->min_distance = 1; - - enabler = action_enabler_new(); - enabler->action = ACTION_PILLAGE; - e_req = req_from_str("UnitClassFlag", "Local", FALSE, TRUE, FALSE, - "CanPillage"); - requirement_vector_append(&enabler->actor_reqs, e_req); - action_enabler_add(enabler); - - enabler = action_enabler_new(); - enabler->action = ACTION_CLEAN_FALLOUT; - e_req = req_from_values(VUT_UTFLAG, REQ_RANGE_LOCAL, FALSE, TRUE, FALSE, - UTYF_SETTLERS); - requirement_vector_append(&enabler->actor_reqs, e_req); - action_enabler_add(enabler); - - enabler = action_enabler_new(); - enabler->action = ACTION_CLEAN_POLLUTION; - e_req = req_from_values(VUT_UTFLAG, REQ_RANGE_LOCAL, FALSE, TRUE, FALSE, - UTYF_SETTLERS); - requirement_vector_append(&enabler->actor_reqs, e_req); - action_enabler_add(enabler); - - enabler = action_enabler_new(); - enabler->action = ACTION_FORTIFY; - e_req = req_from_str("UnitClassFlag", "Local", FALSE, TRUE, TRUE, - "CanFortify"); - requirement_vector_append(&enabler->actor_reqs, e_req); - e_req = req_from_str("UnitFlag", "Local", FALSE, FALSE, TRUE, - "Cant_Fortify"); - requirement_vector_append(&enabler->actor_reqs, e_req); - e_req = req_from_str("TerrainFlag", "Local", FALSE, FALSE, TRUE, - "NoFortify"); - requirement_vector_append(&enabler->actor_reqs, e_req); - action_enabler_add(enabler); - - enabler = action_enabler_new(); - enabler->action = ACTION_FORTIFY; - e_req = req_from_str("UnitClassFlag", "Local", FALSE, TRUE, TRUE, - "CanFortify"); - requirement_vector_append(&enabler->actor_reqs, e_req); - e_req = req_from_str("UnitFlag", "Local", FALSE, FALSE, TRUE, - "Cant_Fortify"); - requirement_vector_append(&enabler->actor_reqs, e_req); - e_req = req_from_str("CityTile", "Local", FALSE, TRUE, TRUE, - "Center"); - requirement_vector_append(&enabler->actor_reqs, e_req); - action_enabler_add(enabler); - - enabler = action_enabler_new(); - enabler->action = ACTION_ROAD; - e_req = req_from_values(VUT_UTFLAG, REQ_RANGE_LOCAL, FALSE, TRUE, FALSE, - UTYF_SETTLERS); - requirement_vector_append(&enabler->actor_reqs, e_req); - action_enabler_add(enabler); - - enabler = action_enabler_new(); - enabler->action = ACTION_CONVERT; - action_enabler_add(enabler); - - enabler = action_enabler_new(); - enabler->action = ACTION_BASE; - e_req = req_from_values(VUT_UTFLAG, REQ_RANGE_LOCAL, FALSE, TRUE, FALSE, - UTYF_SETTLERS); - requirement_vector_append(&enabler->actor_reqs, e_req); - action_enabler_add(enabler); - - enabler = action_enabler_new(); - enabler->action = ACTION_TRANSPORT_ALIGHT; - action_enabler_add(enabler); - - enabler = action_enabler_new(); - enabler->action = ACTION_TRANSPORT_BOARD; - action_enabler_add(enabler); - - enabler = action_enabler_new(); - enabler->action = ACTION_TRANSPORT_EMBARK; - action_enabler_add(enabler); - - enabler = action_enabler_new(); - enabler->action = ACTION_TRANSPORT_UNLOAD; - action_enabler_add(enabler); - - /* Assume the player knows that the unit is able to move */ - paction = action_by_number(ACTION_UNIT_MOVE); - paction->quiet = TRUE; - - enabler = action_enabler_new(); - enabler->action = ACTION_UNIT_MOVE; - e_req = req_from_values(VUT_MINMOVES, REQ_RANGE_LOCAL, - FALSE, TRUE, FALSE, 1); - requirement_vector_append(&enabler->actor_reqs, e_req); - e_req = req_from_values(VUT_UNITSTATE, REQ_RANGE_LOCAL, - FALSE, FALSE, FALSE, - USP_TRANSPORTED); - requirement_vector_append(&enabler->actor_reqs, e_req); - action_enabler_add(enabler); - - /* Update action enablers. */ - rscompat_enablers_add_obligatory_hard_reqs(); - action_enablers_iterate(ae) { - /* "Attack" is split in a unit consuming and a non unit consuming - * version. */ - if (ae->action == ACTION_ATTACK) { - /* The old rule is represented with two action enablers. */ - enabler = action_enabler_copy(ae); - - /* One allows regular attacks. */ - requirement_vector_append(&ae->actor_reqs, - req_from_str("UnitClassFlag", "Local", - FALSE, FALSE, TRUE, - "Missile")); - - /* The other allows suicide attacks. */ - enabler->action = ACTION_SUICIDE_ATTACK; - requirement_vector_append(&enabler->actor_reqs, - req_from_str("UnitClassFlag", "Local", - FALSE, TRUE, TRUE, - "Missile")); - - /* Add after the action was changed. */ - action_enabler_add(enabler); - } - - /* "Explode Nuclear"'s adjacent tile attack is split to "Nuke City" - * and "Nuke Units". */ - if (ae->action == ACTION_NUKE) { - /* The old rule is represented with three action enablers: - * 1) "Explode Nuclear" against the actors own tile. - * 2) "Nuke City" against adjacent enemy cities. - * 3) "Nuke Units" against adjacent enemy unit stacks. */ - - struct action_enabler *city; - struct action_enabler *units; - - /* Against city targets. */ - city = action_enabler_copy(ae); - city->action = ACTION_NUKE_CITY; - - /* Against unit stack targets. */ - units = action_enabler_copy(ae); - units->action = ACTION_NUKE_UNITS; - - /* "Explode Nuclear" required this to target an adjacent tile. */ - /* While this isn't a real move (because of enemy city/units) at - * target tile it pretends to be one. */ - requirement_vector_append(&city->actor_reqs, - req_from_values(VUT_MINMOVES, - REQ_RANGE_LOCAL, - FALSE, TRUE, FALSE, 1)); - requirement_vector_append(&units->actor_reqs, - req_from_values(VUT_MINMOVES, - REQ_RANGE_LOCAL, - FALSE, TRUE, FALSE, 1)); - - /* Be slightly stricter about the relationship to target unit stacks - * than "Explode Nuclear" was before it would target an adjacent - * tile. I think the intention was that you shouldn't nuke your - * friends and allies. */ - requirement_vector_append(&city->actor_reqs, - req_from_values(VUT_DIPLREL, - REQ_RANGE_LOCAL, - FALSE, TRUE, FALSE, - DS_WAR)); - requirement_vector_append(&units->actor_reqs, - req_from_values(VUT_DIPLREL, - REQ_RANGE_LOCAL, - FALSE, TRUE, FALSE, - DS_WAR)); - - /* Only display one nuke action at once. */ - requirement_vector_append(&units->target_reqs, - req_from_values(VUT_CITYTILE, - REQ_RANGE_LOCAL, - FALSE, FALSE, FALSE, - CITYT_CENTER)); - - /* Add after the action was changed. */ - action_enabler_add(city); - action_enabler_add(units); - } - - /* "Targeted Sabotage City" is split in a production targeted and a - * building targeted version. */ - if (ae->action == ACTION_SPY_TARGETED_SABOTAGE_CITY) { - /* The old rule is represented with two action enablers. */ - enabler = action_enabler_copy(ae); - - enabler->action = ACTION_SPY_SABOTAGE_CITY_PRODUCTION; - - /* Add after the action was changed. */ - action_enabler_add(enabler); - } - - /* "Targeted Sabotage City Escape" is split in a production targeted - * and a building targeted version. */ - if (ae->action == ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC) { - /* The old rule is represented with two action enablers. */ - enabler = action_enabler_copy(ae); - - enabler->action = ACTION_SPY_SABOTAGE_CITY_PRODUCTION_ESC; - - /* Add after the action was changed. */ - action_enabler_add(enabler); - } - } action_enablers_iterate_end; - - /* The paratroopers_mr_req field has moved to the enabler for the - * "Paradrop Unit" action. */ - { - bool generic_in_use = FALSE; - struct action_enabler_list *ae_custom = action_enabler_list_new(); - - action_enabler_list_iterate( - action_enablers_for_action(ACTION_PARADROP), ae) { - unit_type_iterate(putype) { - if (!requirement_fulfilled_by_unit_type(putype, - &(ae->actor_reqs))) { - /* This action enabler isn't for this unit type at all. */ - continue; - } - - requirement_vector_iterate(&ae->actor_reqs, preq) { - if (preq->source.kind == VUT_MINMOVES) { - if (!preq->present) { - /* A max move fragments req has been found. Is it too - * large? */ - if (preq->source.value.minmoves - < putype->rscompat_cache.paratroopers_mr_req) { - /* Avoid self contradiciton */ - continue; - } - } - } - } requirement_vector_iterate_end; - - if (putype->rscompat_cache.paratroopers_mr_req > 0) { - /* This unit type needs a custom enabler */ - - enabler = action_enabler_copy(ae); - - /* This enabler is specific to the unit type */ - e_req = req_from_values(VUT_UTYPE, - REQ_RANGE_LOCAL, - FALSE, TRUE, FALSE, - utype_number(putype)); - requirement_vector_append(&enabler->actor_reqs, e_req); - - /* Add the minimum amout of move fragments */ - e_req = req_from_values(VUT_MINMOVES, - REQ_RANGE_LOCAL, - FALSE, TRUE, FALSE, - putype->rscompat_cache - .paratroopers_mr_req); - requirement_vector_append(&enabler->actor_reqs, e_req); - - action_enabler_list_append(ae_custom, enabler); - - log_debug("paratroopers_mr_req upgrade: %s uses custom enabler", - utype_rule_name(putype)); - } else { - /* The old one works just fine */ - - generic_in_use = TRUE; - - log_debug("paratroopers_mr_req upgrade: %s uses generic enabler", - utype_rule_name(putype)); - } - } unit_type_iterate_end; - - if (!generic_in_use) { - /* The generic enabler isn't in use any more */ - action_enabler_remove(ae); - } - } action_enabler_list_iterate_end; - - action_enabler_list_iterate(ae_custom, ae) { - /* Append the custom enablers. */ - action_enabler_add(ae); - } action_enabler_list_iterate_end; - - action_enabler_list_destroy(ae_custom); - } - - /* Enable all clause types */ - { - int i; - - for (i = 0; i < CLAUSE_COUNT; i++) { - struct clause_info *cinfo = clause_info_get(i); - - cinfo->enabled = TRUE; - } - } - - /* Used to live in unit_move() and new in 3.1 so they should be non - * controversial enough. */ - action_iterate(act_id) { - if (action_id_has_result_safe(act_id, ACTRES_TRANSPORT_DISEMBARK) - || action_id_has_result_safe(act_id, ACTRES_CONQUER_EXTRAS) - || action_id_has_result_safe(act_id, ACTRES_HUT_ENTER) - || action_id_has_result_safe(act_id, ACTRES_HUT_FRIGHTEN)) { - BV_SET(action_by_number(ACTION_UNIT_MOVE)->blocked_by, act_id); - } - } action_iterate_end; - - { - struct action_auto_perf *auto_perf; - int pos; - - /* The forced post successful action move action list has moved to the - * ruleset. */ - - /* "Bribe Unit" */ - auto_perf = action_auto_perf_slot_number(ACTION_AUTO_POST_BRIBE); - auto_perf->alternatives[0] = ACTION_TRANSPORT_EMBARK; - auto_perf->alternatives[1] = ACTION_TRANSPORT_EMBARK2; - auto_perf->alternatives[2] = ACTION_TRANSPORT_EMBARK3; - auto_perf->alternatives[3] = ACTION_TRANSPORT_DISEMBARK1; - auto_perf->alternatives[4] = ACTION_TRANSPORT_DISEMBARK2; - auto_perf->alternatives[5] = ACTION_TRANSPORT_DISEMBARK3; - auto_perf->alternatives[6] = ACTION_TRANSPORT_DISEMBARK4; - auto_perf->alternatives[7] = ACTION_CONQUER_EXTRAS; - auto_perf->alternatives[8] = ACTION_CONQUER_EXTRAS2; - auto_perf->alternatives[9] = ACTION_CONQUER_EXTRAS3; - auto_perf->alternatives[10] = ACTION_CONQUER_EXTRAS4; - auto_perf->alternatives[11] = ACTION_HUT_ENTER; - auto_perf->alternatives[12] = ACTION_HUT_ENTER2; - auto_perf->alternatives[13] = ACTION_HUT_ENTER3; - auto_perf->alternatives[14] = ACTION_HUT_ENTER4; - auto_perf->alternatives[15] = ACTION_HUT_FRIGHTEN; - auto_perf->alternatives[16] = ACTION_HUT_FRIGHTEN2; - auto_perf->alternatives[17] = ACTION_HUT_FRIGHTEN3; - auto_perf->alternatives[18] = ACTION_HUT_FRIGHTEN4; - auto_perf->alternatives[19] = ACTION_UNIT_MOVE; - auto_perf->alternatives[20] = ACTION_UNIT_MOVE2; - auto_perf->alternatives[21] = ACTION_UNIT_MOVE3; - action_list_end(auto_perf->alternatives, 22); - - /* "Attack" */ - auto_perf = action_auto_perf_slot_number(ACTION_AUTO_POST_ATTACK); - auto_perf->alternatives[0] = ACTION_CONQUER_CITY; - auto_perf->alternatives[1] = ACTION_CONQUER_CITY2; - auto_perf->alternatives[2] = ACTION_CONQUER_CITY3; - auto_perf->alternatives[3] = ACTION_CONQUER_CITY4; - auto_perf->alternatives[4] = ACTION_TRANSPORT_DISEMBARK1; - auto_perf->alternatives[5] = ACTION_TRANSPORT_DISEMBARK2; - auto_perf->alternatives[6] = ACTION_TRANSPORT_DISEMBARK3; - auto_perf->alternatives[7] = ACTION_TRANSPORT_DISEMBARK4; - auto_perf->alternatives[8] = ACTION_CONQUER_EXTRAS; - auto_perf->alternatives[9] = ACTION_CONQUER_EXTRAS2; - auto_perf->alternatives[10] = ACTION_CONQUER_EXTRAS3; - auto_perf->alternatives[11] = ACTION_CONQUER_EXTRAS4; - auto_perf->alternatives[12] = ACTION_HUT_ENTER; - auto_perf->alternatives[13] = ACTION_HUT_ENTER2; - auto_perf->alternatives[14] = ACTION_HUT_ENTER3; - auto_perf->alternatives[15] = ACTION_HUT_ENTER4; - auto_perf->alternatives[16] = ACTION_HUT_FRIGHTEN; - auto_perf->alternatives[17] = ACTION_HUT_FRIGHTEN2; - auto_perf->alternatives[18] = ACTION_HUT_FRIGHTEN3; - auto_perf->alternatives[19] = ACTION_HUT_FRIGHTEN4; - auto_perf->alternatives[20] = ACTION_UNIT_MOVE; - auto_perf->alternatives[21] = ACTION_UNIT_MOVE2; - auto_perf->alternatives[22] = ACTION_UNIT_MOVE3; - action_list_end(auto_perf->alternatives, 23); - - - /* The city that made the unit's current tile native is gone. - * Evaluated against an adjacent tile. */ - auto_perf = action_auto_perf_slot_number(ACTION_AUTO_ESCAPE_CITY); - auto_perf->alternatives[0] = ACTION_TRANSPORT_EMBARK; - auto_perf->alternatives[1] = ACTION_TRANSPORT_EMBARK2; - auto_perf->alternatives[2] = ACTION_TRANSPORT_EMBARK3; - auto_perf->alternatives[3] = ACTION_HUT_ENTER; - auto_perf->alternatives[4] = ACTION_HUT_ENTER2; - auto_perf->alternatives[5] = ACTION_HUT_ENTER3; - auto_perf->alternatives[6] = ACTION_HUT_ENTER4; - auto_perf->alternatives[7] = ACTION_HUT_FRIGHTEN; - auto_perf->alternatives[8] = ACTION_HUT_FRIGHTEN2; - auto_perf->alternatives[9] = ACTION_HUT_FRIGHTEN3; - auto_perf->alternatives[10] = ACTION_HUT_FRIGHTEN4; - auto_perf->alternatives[11] = ACTION_UNIT_MOVE; - auto_perf->alternatives[12] = ACTION_UNIT_MOVE2; - auto_perf->alternatives[13] = ACTION_UNIT_MOVE3; - action_list_end(auto_perf->alternatives, 14); - - - /* The unit's stack has been defeated and is scheduled for execution - * but the unit has the CanEscape unit type flag. - * Evaluated against an adjacent tile. */ - pos = 0; - auto_perf = action_auto_perf_slot_number(ACTION_AUTO_ESCAPE_STACK); - action_list_add_all_by_result(auto_perf->alternatives, &pos, - ACTRES_TRANSPORT_EMBARK); - action_list_add_all_by_result(auto_perf->alternatives, &pos, - ACTRES_CONQUER_EXTRAS); - action_list_add_all_by_result(auto_perf->alternatives, &pos, - ACTRES_HUT_ENTER); - action_list_add_all_by_result(auto_perf->alternatives, &pos, - ACTRES_HUT_FRIGHTEN); - action_list_add_all_by_result(auto_perf->alternatives, &pos, - ACTRES_UNIT_MOVE); - action_list_end(auto_perf->alternatives, pos); - } - - /* diplchance setting control over initial dice roll odds has moved to - * the ruleset. */ - action_iterate(act_id) { - struct action *act = action_by_number(act_id); - - if (action_has_result_safe(act, ACTRES_SPY_SPREAD_PLAGUE) - || action_has_result_safe(act, ACTRES_SPY_STEAL_TECH) - || action_has_result_safe(act, ACTRES_SPY_TARGETED_STEAL_TECH) - || action_has_result_safe(act, ACTRES_SPY_INCITE_CITY) - || action_has_result_safe(act, ACTRES_SPY_SABOTAGE_CITY) - || action_has_result_safe(act, ACTRES_SPY_TARGETED_SABOTAGE_CITY) - || action_has_result_safe(act, - ACTRES_SPY_SABOTAGE_CITY_PRODUCTION) - || action_has_result_safe(act, ACTRES_SPY_STEAL_GOLD) - || action_has_result_safe(act, ACTRES_STEAL_MAPS) - || action_has_result_safe(act, ACTRES_SPY_NUKE)) { - BV_SET(game.info.diplchance_initial_odds, act->id); - } - } action_iterate_end; - - - /* "Paradrop Unit" has been split by side effects. */ - split_action_name_update(action_by_number(ACTION_PARADROP), - action_by_number(ACTION_PARADROP_CONQUER), - "Contested %s"); - split_action_name_update(action_by_number(ACTION_PARADROP), - action_by_number(ACTION_PARADROP_ENTER), - "Enter Hut %s"); - split_action_name_update(action_by_number(ACTION_PARADROP), - action_by_number( - ACTION_PARADROP_ENTER_CONQUER), - "Enter Hut Contested %s"); - split_action_name_update(action_by_number(ACTION_PARADROP), - action_by_number(ACTION_PARADROP_FRIGHTEN), - "Frighten Hut %s"); - split_action_name_update(action_by_number(ACTION_PARADROP), - action_by_number( - ACTION_PARADROP_FRIGHTEN_CONQUER), - "Frighten Hut Contested %s"); - - action_enabler_list_iterate( - action_enablers_for_action(ACTION_PARADROP), ae) { - struct action_enabler *edit; - - action_by_result_iterate(para_action, para_id, - ACTRES_PARADROP_CONQUER) { - /* Conquer City and/or owned Extra during war if one is there */ - edit = action_enabler_copy(ae); - edit->action = para_action->id; - e_req = req_from_values(VUT_DIPLREL, REQ_RANGE_LOCAL, - FALSE, TRUE, TRUE, DS_WAR); - requirement_vector_append(&edit->actor_reqs, e_req); - e_req = req_from_values(VUT_CITYTILE, REQ_RANGE_LOCAL, - FALSE, TRUE, TRUE, CITYT_CLAIMED); - if (!is_req_in_vec(&e_req, &ae->target_reqs)) { - requirement_vector_append(&edit->target_reqs, e_req); - } - e_req = req_from_values(VUT_UCFLAG, REQ_RANGE_LOCAL, - FALSE, TRUE, TRUE, - UCF_CAN_OCCUPY_CITY); - requirement_vector_append(&edit->actor_reqs, e_req); - e_req = req_from_values(VUT_UTFLAG, REQ_RANGE_LOCAL, - FALSE, FALSE, TRUE, - UTYF_CIVILIAN); - requirement_vector_append(&edit->actor_reqs, e_req); - action_enabler_add(edit); - - /* Conquer owned Extra during war if there */ - edit = action_enabler_copy(ae); - edit->action = para_action->id; - e_req = req_from_values(VUT_DIPLREL, REQ_RANGE_LOCAL, - FALSE, TRUE, TRUE, DS_WAR); - requirement_vector_append(&edit->actor_reqs, e_req); - e_req = req_from_values(VUT_CITYTILE, REQ_RANGE_LOCAL, - FALSE, TRUE, TRUE, CITYT_CLAIMED); - if (!is_req_in_vec(&e_req, &ae->target_reqs)) { - requirement_vector_append(&edit->target_reqs, e_req); - } - e_req = req_from_values(VUT_CITYTILE, REQ_RANGE_LOCAL, - FALSE, FALSE, TRUE, CITYT_CENTER); - requirement_vector_append(&edit->target_reqs, e_req); - action_enabler_add(edit); - - /* Unowned Extra conquest */ - extra_type_by_cause_iterate(EC_BASE, pextra) { - if (!territory_claiming_base(extra_base_get(pextra))) { - /* Only territory claiming bases can be conquered in 3.0 */ - continue; - } - - edit = action_enabler_copy(ae); - edit->action = para_action->id; - e_req = req_from_values(VUT_CITYTILE, REQ_RANGE_LOCAL, - FALSE, FALSE, TRUE, CITYT_CLAIMED); - if (!is_req_in_vec(&e_req, &ae->target_reqs)) { - requirement_vector_append(&edit->target_reqs, e_req); - } - e_req = req_from_values(VUT_CITYTILE, REQ_RANGE_LOCAL, - FALSE, FALSE, TRUE, CITYT_CENTER); - requirement_vector_append(&edit->target_reqs, e_req); - e_req = req_from_values(VUT_EXTRA, REQ_RANGE_LOCAL, - FALSE, TRUE, TRUE, pextra->id); - requirement_vector_append(&edit->target_reqs, e_req); - action_enabler_add(edit); - } extra_type_by_cause_iterate_end; - } action_by_result_iterate_end; - - action_by_result_iterate(para_action, para_id, ACTRES_PARADROP) { - if (para_action->id == ACTION_PARADROP) { - /* Use when not at war and against unclaimed tiles. */ - e_req = req_from_values(VUT_CITYTILE, REQ_RANGE_LOCAL, - FALSE, FALSE, TRUE, CITYT_CLAIMED); - if (is_req_in_vec(&e_req, &ae->target_reqs)) { - /* Use Conquer version for unowned Extras */ - extra_type_by_cause_iterate(EC_BASE, pextra) { - if (!territory_claiming_base(extra_base_get(pextra))) { - /* Only territory claiming bases can be conquered in 3.0 */ - continue; - } - - e_req = req_from_values(VUT_EXTRA, REQ_RANGE_LOCAL, - FALSE, FALSE, TRUE, pextra->id); - requirement_vector_append(&ae->target_reqs, e_req); - } extra_type_by_cause_iterate_end; - } else { - /* Use Conquer version during war. */ - e_req = req_from_values(VUT_DIPLREL, REQ_RANGE_LOCAL, - FALSE, FALSE, TRUE, DS_WAR); - requirement_vector_append(&ae->actor_reqs, e_req); - } - } else { - /* !War req requirement added before the copy. */ - edit = action_enabler_copy(ae); - edit->action = para_action->id; - action_enabler_add(edit); - } - } action_by_result_iterate_end; - } action_enabler_list_iterate_end; - - /* The non hut popping version is only legal when hut_behavior is - * "Nothing". */ - action_enablers_iterate(ae) { - if (ae->action != ACTION_PARADROP - && ae->action != ACTION_PARADROP_CONQUER) { - /* Not relevant. */ - continue; - } - - e_req = req_from_str("UnitClassFlag", "local", - FALSE, TRUE, FALSE, "HutNothing"); - requirement_vector_append(&ae->actor_reqs, e_req); - } action_enablers_iterate_end; - } - - if (info->ver_units < 20) { - enum unit_class_flag_id nothing - = unit_class_flag_id_by_name("HutNothing", fc_strcasecmp); - - unit_class_iterate(uc) { - if (uc->rscompat_cache_from_3_0.hut_behavior == HUT_NOTHING) { - BV_SET(uc->flags, nothing); - } else if (uc->rscompat_cache_from_3_0.hut_behavior == HUT_FRIGHTEN) { - BV_SET(uc->flags, UCF_HUT_FRIGHTEN); - } - } unit_class_iterate_end; - } - /* Make sure that all action enablers added or modified by the * compatibility post processing fulfills all hard action requirements. */ rscompat_enablers_add_obligatory_hard_reqs(); diff --git a/server/ruleset.c b/server/ruleset.c index ebb3b52f6e..ddcfca077a 100644 --- a/server/ruleset.c +++ b/server/ruleset.c @@ -2054,29 +2054,6 @@ static bool load_ruleset_units(struct section_file *file, "%s.non_native_def_pct", sec_name); - if (compat->compat_mode && compat->ver_units < 20) { - const char *hut_str; - - hut_str = secfile_lookup_str_default(file, "Normal", - "%s.hut_behavior", sec_name); - if (fc_strcasecmp(hut_str, "Normal") == 0) { - uc->rscompat_cache_from_3_0.hut_behavior = HUT_NORMAL; - } else if (fc_strcasecmp(hut_str, "Nothing") == 0) { - uc->rscompat_cache_from_3_0.hut_behavior = HUT_NOTHING; - } else if (fc_strcasecmp(hut_str, "Frighten") == 0) { - uc->rscompat_cache_from_3_0.hut_behavior = HUT_FRIGHTEN; - } else { - ruleset_error(LOG_ERROR, - "\"%s\" unit_class \"%s\":" - " Illegal hut behavior \"%s\".", - filename, - uclass_rule_name(uc), - hut_str); - ok = FALSE; - break; - } - } - BV_CLR_ALL(uc->flags); slist = secfile_lookup_str_vec(file, &nval, "%s.flags", sec_name); for (j = 0; j < nval; j++) { @@ -2445,17 +2422,7 @@ static bool load_ruleset_units(struct section_file *file, u->paratroopers_range = secfile_lookup_int_default(file, 0, "%s.paratroopers_range", sec_name); - if (compat->compat_mode && compat->ver_units < 20) { - u->rscompat_cache.paratroopers_mr_req - = SINGLE_MOVE * secfile_lookup_int_default( - file, 0, "%s.paratroopers_mr_req", sec_name); - u->rscompat_cache.paratroopers_mr_sub - = SINGLE_MOVE * secfile_lookup_int_default( - file, 0, "%s.paratroopers_mr_sub", sec_name); - } else { - u->rscompat_cache.paratroopers_mr_req = 0; - u->rscompat_cache.paratroopers_mr_sub = 0; - } + u->bombard_rate = secfile_lookup_int_default(file, 0, "%s.bombard_rate", sec_name); u->city_slots = secfile_lookup_int_default(file, 0, -- 2.30.2