Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #919172 ยป 0001-Change-force_action-to-action_blocked-by-list.patch

Sveinung Kvilhaugsvik, 2021-02-04 06:33 PM

View differences:

common/actions.c
fc_assert(act >= 0 && act < ACTION_COUNT);
return NULL;
}
/**********************************************************************//**
Return action blocked by ruleset variable name for the action or
NULL if actor consuming always can't be set in the ruleset.
TODO: make actions generic and put blocked by actions in a field of
the action.
**************************************************************************/
const char *action_blocked_by_ruleset_var_name(const struct action *act)
{
fc_assert_ret_val(act != NULL, NULL);
switch ((enum gen_action)action_number(act)) {
case ACTION_MARKETPLACE:
return "enter_marketplace_blocked_by";
case ACTION_BOMBARD:
return "bombard_blocked_by";
case ACTION_BOMBARD2:
return "bombard_2_blocked_by";
case ACTION_BOMBARD3:
return "bombard_3_blocked_by";
case ACTION_NUKE:
return "explode_nuclear_blocked_by";
case ACTION_NUKE_CITY:
return "nuke_city_blocked_by";
case ACTION_NUKE_UNITS:
return "nuke_units_blocked_by";
case ACTION_ATTACK:
return "attack_blocked_by";
case ACTION_SUICIDE_ATTACK:
return "suicide_attack_blocked_by";
case ACTION_CONQUER_CITY:
return "conquer_city_blocked_by";
case ACTION_CONQUER_CITY2:
return "conquer_city_2_blocked_by";
case ACTION_SPY_POISON:
case ACTION_SPY_POISON_ESC:
case ACTION_SPY_SABOTAGE_UNIT:
case ACTION_SPY_SABOTAGE_UNIT_ESC:
case ACTION_SPY_BRIBE_UNIT:
case ACTION_SPY_SABOTAGE_CITY:
case ACTION_SPY_SABOTAGE_CITY_ESC:
case ACTION_SPY_TARGETED_SABOTAGE_CITY:
case ACTION_SPY_SABOTAGE_CITY_PRODUCTION:
case ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC:
case ACTION_SPY_SABOTAGE_CITY_PRODUCTION_ESC:
case ACTION_SPY_INCITE_CITY:
case ACTION_SPY_INCITE_CITY_ESC:
case ACTION_ESTABLISH_EMBASSY:
case ACTION_ESTABLISH_EMBASSY_STAY:
case ACTION_SPY_STEAL_TECH:
case ACTION_SPY_STEAL_TECH_ESC:
case ACTION_SPY_TARGETED_STEAL_TECH:
case ACTION_SPY_TARGETED_STEAL_TECH_ESC:
case ACTION_SPY_INVESTIGATE_CITY:
case ACTION_INV_CITY_SPEND:
case ACTION_SPY_STEAL_GOLD:
case ACTION_SPY_STEAL_GOLD_ESC:
case ACTION_STEAL_MAPS:
case ACTION_STEAL_MAPS_ESC:
case ACTION_TRADE_ROUTE:
case ACTION_HELP_WONDER:
case ACTION_CAPTURE_UNITS:
case ACTION_EXPEL_UNIT:
case ACTION_FOUND_CITY:
case ACTION_JOIN_CITY:
case ACTION_SPY_NUKE:
case ACTION_SPY_NUKE_ESC:
case ACTION_DESTROY_CITY:
case ACTION_RECYCLE_UNIT:
case ACTION_DISBAND_UNIT:
case ACTION_HOME_CITY:
case ACTION_UPGRADE_UNIT:
case ACTION_PARADROP:
case ACTION_AIRLIFT:
case ACTION_STRIKE_BUILDING:
case ACTION_STRIKE_PRODUCTION:
case ACTION_HEAL_UNIT:
case ACTION_TRANSFORM_TERRAIN:
case ACTION_CULTIVATE:
case ACTION_PLANT:
case ACTION_PILLAGE:
case ACTION_CLEAN_POLLUTION:
case ACTION_CLEAN_FALLOUT:
case ACTION_FORTIFY:
case ACTION_ROAD:
case ACTION_CONVERT:
case ACTION_BASE:
case ACTION_MINE:
case ACTION_IRRIGATE:
case ACTION_TRANSPORT_ALIGHT:
case ACTION_TRANSPORT_BOARD:
case ACTION_TRANSPORT_EMBARK:
case ACTION_TRANSPORT_UNLOAD:
case ACTION_TRANSPORT_DISEMBARK1:
case ACTION_TRANSPORT_DISEMBARK2:
case ACTION_SPY_SPREAD_PLAGUE:
case ACTION_SPY_ATTACK:
case ACTION_CONQUER_EXTRAS:
case ACTION_USER_ACTION1:
case ACTION_USER_ACTION2:
case ACTION_USER_ACTION3:
/* blocked_by is not ruleset changeable */
return NULL;
case ACTION_COUNT:
fc_assert_ret_val(action_number(act) != ACTION_COUNT, NULL);
break;
}
return NULL;
}
common/actions.h
const char *action_target_kind_ruleset_var_name(int act);
const char *action_actor_consuming_always_ruleset_var_name(action_id act);
const char *action_blocked_by_ruleset_var_name(const struct action *act);
struct action_enabler_list *
action_enablers_for_action(action_id action);
common/game.h
#define RS_MIN_BASE_TECH_COST 0
#define RS_MAX_BASE_TECH_COST 20000
#define RS_DEFAULT_FORCE_TRADE_ROUTE FALSE
#define RS_DEFAULT_FORCE_CAPTURE_UNITS FALSE
#define RS_DEFAULT_FORCE_BOMBARD FALSE
#define RS_DEFAULT_FORCE_EXPLODE_NUCLEAR FALSE
#define RS_DEFAULT_POISON_EMPTIES_FOOD_STOCK FALSE
#define RS_DEFAULT_STEAL_MAP_REVEALS_CITIES TRUE
#define RS_DEFAULT_ACTION_ACTOR_CONSUMING_ALWAYS FALSE
data/alien/game.ruleset
}
[actions]
; If force_trade_route is set to TRUE it is illegal for an actor unit to
; enter the marketplace of a city if it can establish a trade route to it
; in stead.
force_trade_route = TRUE
; If force_capture_units is set to TRUE it is illegal for an actor unit to
; bombard, explode nuclear or perform a regular attack against a tile if
; it can capture units on it in stead.
force_capture_units = TRUE
; If force_bombard is set to TRUE it is illegal for an actor unit to
; explode nuclear or perform a regular attack against a tile if it can
; bombard it in stead.
force_bombard = TRUE
; If force_explode_nuclear is set to TRUE it is illegal for an actor unit
; to perform a regular attack against a tile if it can do explode nuclear
; in stead.
force_explode_nuclear = FALSE
; Forbid "Enter Marketplace" if any one of the listed actions are legal.
enter_marketplace_blocked_by = "Establish Trade Route"
; Forbid "Bombard" if any one of the listed actions are legal.
bombard_blocked_by = "Capture Units"
; Forbid "Attack" if any one of the listed actions are legal.
attack_blocked_by = "Capture Units", "Bombard"
; # Forbid "Suicide Attack" if any one of the listed actions are legal.
suicide_attack_blocked_by = "Capture Units", "Bombard"
; # Forbid "Conquer City" if any one of the listed actions are legal.
conquer_city_blocked_by = "Capture Units", "Bombard", "Attack",
"Suicide Attack"
; Forbid regular unit move if one of the actions below is legal.
move_is_blocked_by = "Transport Disembark", "Transport Disembark 2"
data/civ1/game.ruleset
}
[actions]
; If force_trade_route is set to TRUE it is illegal for an actor unit to
; enter the marketplace of a city if it can establish a trade route to it
; in stead.
force_trade_route = TRUE
; If force_capture_units is set to TRUE it is illegal for an actor unit to
; bombard, explode nuclear or perform a regular attack against a tile if
; it can capture units on it in stead.
force_capture_units = FALSE
; If force_bombard is set to TRUE it is illegal for an actor unit to
; explode nuclear or perform a regular attack against a tile if it can
; bombard it in stead.
force_bombard = FALSE
; If force_explode_nuclear is set to TRUE it is illegal for an actor unit
; to perform a regular attack against a tile if it can do explode nuclear
; in stead.
force_explode_nuclear = TRUE
; Forbid "Enter Marketplace" if any one of the listed actions are legal.
enter_marketplace_blocked_by = "Establish Trade Route"
; Forbid "Attack" if any one of the listed actions are legal.
attack_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Suicide Attack" if any one of the listed actions are legal.
suicide_attack_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Conquer City" if any one of the listed actions are legal.
conquer_city_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid regular unit move if one of the actions below is legal.
move_is_blocked_by = "Transport Disembark"
data/civ2/game.ruleset
}
[actions]
; If force_trade_route is set to TRUE it is illegal for an actor unit to
; enter the marketplace of a city if it can establish a trade route to it
; in stead.
force_trade_route = TRUE
; If force_capture_units is set to TRUE it is illegal for an actor unit to
; bombard, explode nuclear or perform a regular attack against a tile if
; it can capture units on it in stead.
force_capture_units = FALSE
; If force_bombard is set to TRUE it is illegal for an actor unit to
; explode nuclear or perform a regular attack against a tile if it can
; bombard it in stead.
force_bombard = FALSE
; If force_explode_nuclear is set to TRUE it is illegal for an actor unit
; to perform a regular attack against a tile if it can do explode nuclear
; in stead.
force_explode_nuclear = TRUE
; Forbid "Enter Marketplace" if any one of the listed actions are legal.
enter_marketplace_blocked_by = "Establish Trade Route"
; Forbid "Attack" if any one of the listed actions are legal.
attack_blocked_by="Explode Nuclear","Nuke City","Nuke Units"
; Forbid "Suicide Attack" if any one of the listed actions are legal.
suicide_attack_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Conquer City" if any one of the listed actions are legal.
conquer_city_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid regular unit move if one of the actions below is legal.
move_is_blocked_by = "Transport Disembark"
data/civ2civ3/game.ruleset
}
[actions]
; If force_trade_route is set to TRUE it is illegal for an actor unit to
; enter the marketplace of a city if it can establish a trade route to it
; in stead.
force_trade_route = TRUE
; If force_capture_units is set to TRUE it is illegal for an actor unit to
; bombard, explode nuclear or perform a regular attack against a tile if
; it can capture units on it in stead.
force_capture_units = TRUE
; If force_bombard is set to TRUE it is illegal for an actor unit to
; explode nuclear or perform a regular attack against a tile if it can
; bombard it in stead.
force_bombard = TRUE
; If force_explode_nuclear is set to TRUE it is illegal for an actor unit
; to perform a regular attack against a tile if it can do explode nuclear
; in stead.
force_explode_nuclear = TRUE
; Forbid "Bombard" if any one of the listed actions are legal.
bombard_blocked_by = "Capture Units"
; Forbid "Explode Nuclear" if any one of the listed actions are legal.
explode_nuclear_blocked_by = "Capture Units", "Bombard"
; Forbid "Nuke City" if any one of the listed actions are legal.
nuke_city_blocked_by = "Capture Units", "Bombard"
; Forbid "Nuke Units" if any one of the listed actions are legal.
nuke_units_blocked_by = "Capture Units", "Bombard"
; Forbid "Attack" if any one of the listed actions are legal.
attack_blocked_by = "Capture Units", "Bombard", "Explode Nuclear",
"Nuke City", "Nuke Units"
; Forbid "Suicide Attack" if any one of the listed actions are legal.
suicide_attack_blocked_by = "Capture Units", "Bombard", "Explode Nuclear",
"Nuke City", "Nuke Units"
; Forbid "Conquer City" if any one of the listed actions are legal.
conquer_city_blocked_by = "Capture Units", "Bombard", "Explode Nuclear",
"Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid "Conquer City 2" if any one of the listed actions are legal.
conquer_city_2_blocked_by = "Capture Units", "Bombard", "Explode Nuclear",
"Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid regular unit move if one of the actions below is legal.
move_is_blocked_by = "Transport Disembark", "Transport Disembark 2"
data/classic/game.ruleset
}
[actions]
; If force_trade_route is set to TRUE it is illegal for an actor unit to
; enter the marketplace of a city if it can establish a trade route to it
; in stead.
force_trade_route = TRUE
; If force_capture_units is set to TRUE it is illegal for an actor unit to
; bombard, explode nuclear or perform a regular attack against a tile if
; it can capture units on it in stead.
force_capture_units = FALSE
; If force_bombard is set to TRUE it is illegal for an actor unit to
; explode nuclear or perform a regular attack against a tile if it can
; bombard it in stead.
force_bombard = FALSE
; If force_explode_nuclear is set to TRUE it is illegal for an actor unit
; to perform a regular attack against a tile if it can do explode nuclear
; in stead.
force_explode_nuclear = TRUE
; Forbid "Enter Marketplace" if any one of the listed actions are legal.
enter_marketplace_blocked_by="Establish Trade Route"
; Forbid "Attack" if any one of the listed actions are legal.
attack_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Suicide Attack" if any one of the listed actions are legal.
suicide_attack_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Conquer City" if any one of the listed actions are legal.
conquer_city_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid "Conquer City 2" if any one of the listed actions are legal.
conquer_city_2_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid regular unit move if one of the actions below is legal.
move_is_blocked_by = "Transport Disembark", "Transport Disembark 2", "Conquer Extras"
data/experimental/game.ruleset
}
[actions]
; If force_trade_route is set to TRUE it is illegal for an actor unit to
; enter the marketplace of a city if it can establish a trade route to it
; in stead.
force_trade_route = FALSE
; If force_capture_units is set to TRUE it is illegal for an actor unit to
; bombard, explode nuclear or perform a regular attack against a tile if
; it can capture units on it in stead.
force_capture_units = FALSE
; If force_bombard is set to TRUE it is illegal for an actor unit to
; explode nuclear or perform a regular attack against a tile if it can
; bombard it in stead.
force_bombard = FALSE
; If force_explode_nuclear is set to TRUE it is illegal for an actor unit
; to perform a regular attack against a tile if it can do explode nuclear
; in stead.
force_explode_nuclear = TRUE
; Forbid "Attack" if any one of the listed actions are legal.
attack_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Suicide Attack" if any one of the listed actions are legal.
suicide_attack_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Conquer City" if any one of the listed actions are legal.
conquer_city_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid "Conquer City 2" if any one of the listed actions are legal.
conquer_city_2_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid regular unit move if one of the actions below is legal.
move_is_blocked_by = "Transport Disembark", "Transport Disembark 2", "Conquer Extras"
data/granularity/game.ruleset
}
[actions]
; If force_trade_route is set to TRUE it is illegal for an actor unit to
; enter the marketplace of a city if it can establish a trade route to it
; in stead.
force_trade_route = FALSE
; If force_capture_units is set to TRUE it is illegal for an actor unit to
; bombard, explode nuclear or perform a regular attack against a tile if
; it can capture units on it in stead.
force_capture_units = FALSE
; If force_bombard is set to TRUE it is illegal for an actor unit to
; explode nuclear or perform a regular attack against a tile if it can
; bombard it in stead.
force_bombard = FALSE
; If force_explode_nuclear is set to TRUE it is illegal for an actor unit
; to perform a regular attack against a tile if it can do explode nuclear
; in stead.
force_explode_nuclear = FALSE
; Forbid regular unit move if one of the actions below is legal.
move_is_blocked_by = "Transport Disembark", "Transport Disembark 2"
data/multiplayer/game.ruleset
}
[actions]
; If force_trade_route is set to TRUE it is illegal for an actor unit to
; enter the marketplace of a city if it can establish a trade route to it
; in stead.
force_trade_route = FALSE
; If force_capture_units is set to TRUE it is illegal for an actor unit to
; bombard, explode nuclear or perform a regular attack against a tile if
; it can capture units on it in stead.
force_capture_units = FALSE
; If force_bombard is set to TRUE it is illegal for an actor unit to
; explode nuclear or perform a regular attack against a tile if it can
; bombard it in stead.
force_bombard = FALSE
; If force_explode_nuclear is set to TRUE it is illegal for an actor unit
; to perform a regular attack against a tile if it can do explode nuclear
; in stead.
force_explode_nuclear = TRUE
; Forbid "Attack" if any one of the listed actions are legal.
attack_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Suicide Attack" if any one of the listed actions are legal.
suicide_attack_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Conquer City" if any one of the listed actions are legal.
conquer_city_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid "Conquer City 2" if any one of the listed actions are legal.
conquer_city_2_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid regular unit move if one of the actions below is legal.
move_is_blocked_by = "Transport Disembark", "Transport Disembark 2", "Conquer Extras"
data/sandbox/game.ruleset
}
[actions]
; If force_trade_route is set to TRUE it is illegal for an actor unit to
; enter the marketplace of a city if it can establish a trade route to it
; in stead.
force_trade_route = FALSE
; If force_capture_units is set to TRUE it is illegal for an actor unit to
; bombard, explode nuclear or perform a regular attack against a tile if
; it can capture units on it in stead.
force_capture_units = TRUE
; If force_bombard is set to TRUE it is illegal for an actor unit to
; explode nuclear or perform a regular attack against a tile if it can
; bombard it in stead.
force_bombard = TRUE
; If force_explode_nuclear is set to TRUE it is illegal for an actor unit
; to perform a regular attack against a tile if it can do explode nuclear
; in stead.
force_explode_nuclear = TRUE
; Forbid "Bombard" if any one of the listed actions are legal.
bombard_blocked_by = "Capture Units"
; Forbid "Explode Nuclear" if any one of the listed actions are legal.
explode_nuclear_blocked_by = "Capture Units", "Bombard"
; Forbid "Nuke City" if any one of the listed actions are legal.
nuke_city_blocked_by = "Capture Units", "Bombard"
; Forbid "Nuke Units" if any one of the listed actions are legal.
nuke_units_blocked_by = "Capture Units", "Bombard"
; Forbid "Attack" if any one of the listed actions are legal.
attack_blocked_by = "Capture Units", "Bombard",
"Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Suicide Attack" if any one of the listed actions are legal.
suicide_attack_blocked_by = "Capture Units", "Bombard",
"Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Conquer City" if any one of the listed actions are legal.
conquer_city_blocked_by = "Capture Units", "Bombard",
"Explode Nuclear", "Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid "Conquer City 2" if any one of the listed actions are legal.
conquer_city_2_blocked_by = "Capture Units", "Bombard",
"Explode Nuclear", "Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid regular unit move if one of the actions below is legal.
move_is_blocked_by = "Transport Disembark", "Transport Disembark 2", "Conquer Extras"
data/stub/game.ruleset
; }
[actions]
; If force_trade_route is set to TRUE it is illegal for an actor unit to
; enter the marketplace of a city if it can establish a trade route to it
; in stead.
force_trade_route = FALSE
; If force_capture_units is set to TRUE it is illegal for an actor unit to
; bombard, explode nuclear or perform a regular attack against a tile if
; it can capture units on it in stead.
force_capture_units = FALSE
; If force_bombard is set to TRUE it is illegal for an actor unit to
; explode nuclear or perform a regular attack against a tile if it can
; bombard it in stead.
force_bombard = FALSE
; If force_explode_nuclear is set to TRUE it is illegal for an actor unit
; to perform a regular attack against a tile if it can do explode nuclear
; in stead.
force_explode_nuclear = FALSE
; Forbid regular unit move if one of the actions below is legal.
;move_is_blocked_by = "Conquer Extras"
data/webperimental/game.ruleset
}
[actions]
; If force_trade_route is set to TRUE it is illegal for an actor unit to
; enter the marketplace of a city if it can establish a trade route to it
; in stead.
force_trade_route = TRUE
; If force_capture_units is set to TRUE it is illegal for an actor unit to
; bombard, explode nuclear or perform a regular attack against a tile if
; it can capture units on it in stead.
force_capture_units = FALSE
; If force_bombard is set to TRUE it is illegal for an actor unit to
; explode nuclear or perform a regular attack against a tile if it can
; bombard it in stead.
force_bombard = FALSE
; If force_explode_nuclear is set to TRUE it is illegal for an actor unit
; to perform a regular attack against a tile if it can do explode nuclear
; in stead.
force_explode_nuclear = TRUE
; Forbid "Enter Marketplace" if any one of the listed actions are legal.
enter_marketplace_blocked_by = "Establish Trade Route"
; Forbid "Attack" if any one of the listed actions are legal.
attack_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Suicide Attack" if any one of the listed actions are legal.
suicide_attack_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units"
; Forbid "Conquer City" if any one of the listed actions are legal.
conquer_city_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units",
"Attack", "Suicide Attack"
; Forbid regular unit move if one of the actions below is legal.
move_is_blocked_by = "Transport Disembark", "Conquer Extras"
doc/README.actions
"Enter Marketplace" - Get a one time bounus without creating a trade route.
* UI name can be set using ui_name_enter_marketplace
* actor must be aware that the target exists
* if force_trade_route is true "Establish Trade Route" must be impossible
* any action listed in enter_marketplace_blocked_by must be impossible
* actor must be on the same tile as the target or on the tile next to it.
* actor must have a home city. (!)
* target must be foreign or trademindist tiles away from that home city.
......
"Nuke City" - Detonate in the target city. Cause a nuclear explosion.
* UI name can be set using ui_name_nuke_city
* if force_capture_units is true "Capture Units" must be impossible
* if force_bombard is true "Bombard", "Bombard 2" and "Bombard 3" must be
impossible.
* any action listed in nuke_city_blocked_by must be impossible
* the actor unit must be on a tile next to the target unless
nuke_city_max_range allows it to be further away.
"Conquer City" - Conquer the target city.
* UI name can be set using ui_name_conquer_city
* actor must be aware that the target exists
* if force_capture_units is true "Capture Units" must be impossible
* if force_bombard is true "Bombard", "Bombard 2" and "Bombard 3" must be
impossible
* if force_explode_nuclear is true "Explode Nuclear", "Nuke Units" and
"Nuke City" must be impossible
* any action listed in conquer_city_blocked_by must be impossible
* "Attack" must be impossible
* the actor unit must be on a tile next to the target.
* the actor player's nation can't be an animal barbarian. (!)
......
"Bombard" - bombard the units (and city) at the tile without killing them.
* UI name can be set using ui_name_bombard
* if force_capture_units is true "Capture Units" must be impossible
* any action listed in bombard_blocked_by must be impossible
* actor must have a bombard_rate > 0
* actor must have an attack > 0
* actor must be on a tile next to the target or, if bombard_max_range
......
"Bombard 2" - bombard the units (and city) at the tile without killing them.
* UI name can be set using ui_name_bombard_2
* any action listed in bombard_2_blocked_by must be impossible
* actor must be on a tile next to the target or, if bombard_2_max_range
allows it, futher away.
* A copy of "Bombard".
......
"Bombard 3" - bombard the units (and city) at the tile without killing them.
* UI name can be set using ui_name_bombard_3
* any action listed in bombard_3_blocked_by must be impossible
* actor must be on a tile next to the target or, if bombard_3_max_range
allows it, futher away.
* A copy of "Bombard".
......
"Attack"
* UI name can be set using ui_name_attack
* if force_capture_units is true "Capture Units" must be impossible
* if force_bombard is true "Bombard", "Bombard 2" and "Bombard 3" must be
impossible
* if force_explode_nuclear is true "Explode Nuclear", "Nuke Units" and
"Nuke City" must be impossible
* any action listed in attack_blocked_by must be impossible
* the actor must be on the tile next to the target.
* the actor's attack must be above 0
* the actor can't have the "NonMil" unit type flag (!)
......
"Suicide Attack"
* UI name can be set using ui_name_suicide_attack
* spends the actor unit
* if force_capture_units is true "Capture Units" must be impossible
* if force_bombard is true "Bombard", "Bombard 2" and "Bombard 3" must be
impossible
* if force_explode_nuclear is true "Explode Nuclear", "Nuke Units" and
"Nuke City" must be impossible
* any action listed in suicide_attack_blocked_by must be impossible
* the actor must be on the tile next to the target.
* the actor's attack must be above 0
* the actor can't have the "NonMil" unit type flag (!)
......
"Nuke Units" - Detonate at the target unit stack. Cause a nuclear explosion.
* UI name can be set using ui_name_nuke_units
* if force_capture_units is true "Capture Units" must be impossible
* if force_bombard is true "Bombard", "Bombard 2" and "Bombard 3" must be
impossible
* any action listed in nuke_units_blocked_by must be impossible
* the actor unit must be on a tile next to the target unless
nuke_units_max_range allows it to be further away.
* one or all (unreachableprotects) non transported units at the target
......
"Explode Nuclear" - Detonate at the target tile. Cause a nuclear explosion.
* UI name can be set using ui_name_explode_nuclear
* if force_capture_units is true "Capture Units" must be impossible
* if force_bombard is true "Bombard", "Bombard 2" and "Bombard 3" must be
impossible
* any action listed in explode_nuclear_blocked_by must be impossible
* actor must be on the same tile as the target unless
explode_nuclear_max_range allows it to be further away.
server/ruleset.c
return TRUE;
}
/**********************************************************************//**
Load what actions can block the action
**************************************************************************/
static bool load_action_blocked_by_list(struct section_file *file,
const char *filename,
struct action *paction)
{
if (action_blocked_by_ruleset_var_name(paction) != NULL) {
/* Action blocking can be loaded from the ruleset. */
char fullpath[1024];
fc_snprintf(fullpath, sizeof(fullpath), "actions.%s",
action_blocked_by_ruleset_var_name(paction));
if (secfile_entry_by_path(file, fullpath)) {
enum gen_action *blocking_actions;
size_t asize;
int j;
blocking_actions =
secfile_lookup_enum_vec(file, &asize, gen_action, "%s", fullpath);
if (!blocking_actions) {
/* Entity exists but couldn't read it. */
ruleset_error(LOG_ERROR,
"\"%s\": %s: bad action list",
filename, fullpath);
return FALSE;
}
for (j = 0; j < asize; j++) {
BV_SET(paction->blocked_by, blocking_actions[j]);
}
free(blocking_actions);
}
}
return TRUE;
}
/**********************************************************************//**
Load ruleset file.
**************************************************************************/
......
/* section: actions */
if (ok) {
int force_capture_units, force_bombard, force_explode_nuclear;
if (compat->compat_mode && compat->ver_game < 20) {
int force_capture_units, force_bombard, force_explode_nuclear;
if (secfile_lookup_bool_default(file, RS_DEFAULT_FORCE_TRADE_ROUTE,
"actions.force_trade_route")) {
/* Forbid entering the marketplace when a trade route can be
if (secfile_lookup_bool_default(file, FALSE,
"actions.force_trade_route")) {
/* Forbid entering the marketplace when a trade route can be
* established. */
BV_SET(action_by_number(ACTION_MARKETPLACE)->blocked_by,
ACTION_TRADE_ROUTE);
}
BV_SET(action_by_number(ACTION_MARKETPLACE)->blocked_by,
ACTION_TRADE_ROUTE);
}
/* Forbid bombarding, exploading nuclear or attacking when it is
/* Forbid bombarding, exploading nuclear or attacking when it is
* legal to capture units. */
force_capture_units
= secfile_lookup_bool_default(file, RS_DEFAULT_FORCE_CAPTURE_UNITS,
"actions.force_capture_units");
if (force_capture_units) {
BV_SET(action_by_number(ACTION_BOMBARD)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_BOMBARD2)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_BOMBARD3)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_NUKE)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_NUKE_CITY)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_NUKE_UNITS)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_CAPTURE_UNITS);
}
/* Forbid exploding nuclear or attacking when it is legal to
force_capture_units
= secfile_lookup_bool_default(file,
FALSE,
"actions.force_capture_units");
if (force_capture_units) {
BV_SET(action_by_number(ACTION_BOMBARD)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_BOMBARD2)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_BOMBARD3)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_NUKE)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_NUKE_CITY)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_NUKE_UNITS)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_CAPTURE_UNITS);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_CAPTURE_UNITS);
}
/* Forbid exploding nuclear or attacking when it is legal to
* bombard. */
force_bombard
= secfile_lookup_bool_default(file, RS_DEFAULT_FORCE_BOMBARD,
"actions.force_bombard");
if (force_bombard) {
BV_SET(action_by_number(ACTION_NUKE)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_NUKE_CITY)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_NUKE_UNITS)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_NUKE)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_NUKE_CITY)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_NUKE_UNITS)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_NUKE)->blocked_by,
ACTION_BOMBARD3);
BV_SET(action_by_number(ACTION_NUKE_CITY)->blocked_by,
ACTION_BOMBARD3);
BV_SET(action_by_number(ACTION_NUKE_UNITS)->blocked_by,
ACTION_BOMBARD3);
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_BOMBARD3);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_BOMBARD3);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_BOMBARD3);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_BOMBARD3);
}
/* Forbid attacking when it is legal to do explode nuclear. */
force_explode_nuclear
= secfile_lookup_bool_default(file,
RS_DEFAULT_FORCE_EXPLODE_NUCLEAR,
"actions.force_explode_nuclear");
if (force_explode_nuclear) {
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_NUKE);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_NUKE);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_NUKE);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_NUKE);
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_NUKE_CITY);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_NUKE_CITY);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_NUKE_CITY);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_NUKE_CITY);
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_NUKE_UNITS);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_NUKE_UNITS);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_NUKE_UNITS);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_NUKE_UNITS);
force_bombard
= secfile_lookup_bool_default(file, FALSE,
"actions.force_bombard");
if (force_bombard) {
BV_SET(action_by_number(ACTION_NUKE)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_NUKE_CITY)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_NUKE_UNITS)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_BOMBARD);
BV_SET(action_by_number(ACTION_NUKE)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_NUKE_CITY)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_NUKE_UNITS)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_BOMBARD2);
BV_SET(action_by_number(ACTION_NUKE)->blocked_by,
ACTION_BOMBARD3);
BV_SET(action_by_number(ACTION_NUKE_CITY)->blocked_by,
ACTION_BOMBARD3);
BV_SET(action_by_number(ACTION_NUKE_UNITS)->blocked_by,
ACTION_BOMBARD3);
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_BOMBARD3);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_BOMBARD3);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_BOMBARD3);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_BOMBARD3);
}
/* Forbid attacking when it is legal to do explode nuclear. */
force_explode_nuclear
= secfile_lookup_bool_default(file,
FALSE,
"actions.force_explode_nuclear");
if (force_explode_nuclear) {
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_NUKE);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_NUKE);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_NUKE);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_NUKE);
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_NUKE_CITY);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_NUKE_CITY);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_NUKE_CITY);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_NUKE_CITY);
BV_SET(action_by_number(ACTION_SUICIDE_ATTACK)->blocked_by,
ACTION_NUKE_UNITS);
BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_NUKE_UNITS);
BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,
ACTION_NUKE_UNITS);
BV_SET(action_by_number(ACTION_CONQUER_CITY2)->blocked_by,
ACTION_NUKE_UNITS);
}
}
action_iterate(act_id) {
struct action *paction = action_by_number(act_id);
if (!load_action_blocked_by_list(file, filename, paction)) {
ok = FALSE;
}
} action_iterate_end;
if (secfile_entry_by_path(file, "actions.move_is_blocked_by")) {
enum gen_action *blocking_actions;
size_t asize;
tools/ruleutil/rulesave.c
return TRUE;
}
/**********************************************************************//**
Save what actions will block this action.
**************************************************************************/
static bool save_action_blocked_by(struct section_file *sfile,
struct action *paction)
{
enum gen_action action_vec[MAX_NUM_ACTIONS];
char comment[1024];
int i = 0;
if (action_blocked_by_ruleset_var_name(paction) == NULL) {
/* Action blocked by shouldn't be written to the ruleset for this
* action. */
return TRUE;
}
if (action_enabler_list_size(action_enablers_for_action(paction->id))
== 0) {
/* Don't save value for actions that aren't enabled. */
return TRUE;
}
fc_snprintf(comment, sizeof(comment),
"Forbid \"%s\" if any one of the listed actions are legal.",
action_rule_name(paction));
action_iterate(blocker_id) {
if (action_enabler_list_size(action_enablers_for_action(blocker_id))
== 0) {
/* Don't save value for actions that aren't enabled. */
continue;
}
if (BV_ISSET(paction->blocked_by, blocker_id)) {
action_vec[i] = blocker_id;
i++;
}
} action_iterate_end;
if (secfile_insert_enum_vec_comment(
sfile, &action_vec, i, gen_action, comment, "actions.%s",
action_blocked_by_ruleset_var_name(paction))
!= i) {
log_error("Didn't save all %s blocking actions.",
action_rule_name(paction));
return FALSE;
}
return TRUE;
}
/**********************************************************************//**
Save game.ruleset
**************************************************************************/
......
int i;
enum gen_action action_vec[MAX_NUM_ACTIONS];
bool locks;
int force_capture_units, force_bombard, force_explode_nuclear;
if (sfile == NULL) {
return FALSE;
......
"auto_attack", "if_attacker");
}
save_default_bool(sfile,
action_id_would_be_blocked_by(ACTION_MARKETPLACE,
ACTION_TRADE_ROUTE),
RS_DEFAULT_FORCE_TRADE_ROUTE,
"actions.force_trade_route", NULL);
/* The ruleset options force_capture_units, force_bombard and
* force_explode_nuclear sets their respective action to block many other
* actions' blocked_by. Checking one is therefore enough. */
force_capture_units =
BV_ISSET(action_by_number(ACTION_ATTACK)->blocked_by,
ACTION_CAPTURE_UNITS);
save_default_bool(sfile, force_capture_units,
RS_DEFAULT_FORCE_CAPTURE_UNITS,
"actions.force_capture_units", NULL);
force_bombard =
BV_ISSET(action_by_number(ACTION_ATTACK)->blocked_by, ACTION_BOMBARD);
save_default_bool(sfile, force_bombard,
RS_DEFAULT_FORCE_BOMBARD,
"actions.force_bombard", NULL);
force_explode_nuclear =
BV_ISSET(action_by_number(ACTION_ATTACK)->blocked_by, ACTION_NUKE);
save_default_bool(sfile, force_explode_nuclear,
RS_DEFAULT_FORCE_EXPLODE_NUCLEAR,
"actions.force_explode_nuclear", NULL);
i = 0;
action_iterate(act_id) {
if (BV_ISSET(game.info.move_is_blocked_by, act_id)) {
......
"actions.steal_maps_reveals_all_cities", NULL);
action_iterate(act_id) {
struct action *act = action_by_number(act_id);
save_action_ui_name(sfile,
act_id, action_ui_name_ruleset_var_name(act_id));
save_action_kind(sfile, act_id);
save_action_range(sfile, act_id);
save_action_actor_consuming_always(sfile, act_id);
save_action_blocked_by(sfile, act);
} action_iterate_end;
i = 0;
    (1-1/1)