Feature #1094 » 0078-Add-Civil-War-action-type.patch
common/actions.c | ||
---|---|---|
const int min_distance,
|
||
const int max_distance,
|
||
bool actor_consuming_always);
|
||
static struct action *
|
||
player_action_new(action_id id,
|
||
enum action_result result);
|
||
static bool is_enabler_active(const struct action_enabler *enabler,
|
||
const struct req_context *actor,
|
||
... | ... | |
MAK_FORCED,
|
||
1, 1, FALSE);
|
||
actions[ACTION_CIVIL_WAR] =
|
||
player_action_new(ACTION_CIVIL_WAR, ACTRES_ENABLER_CHECK);
|
||
/* The structure even for these need to be created, for
|
||
* the action_id_rule_name() to work on iterations. */
|
||
... | ... | |
return act;
|
||
}
|
||
/**********************************************************************//**
|
||
Create a new action performed by a player actor.
|
||
**************************************************************************/
|
||
static struct action *
|
||
player_action_new(action_id id,
|
||
enum action_result result)
|
||
{
|
||
struct action *act = action_new(id, result,
|
||
0, 0, FALSE);
|
||
return act;
|
||
}
|
||
/**********************************************************************//**
|
||
Returns TRUE iff the specified action ID refers to a valid action.
|
||
**************************************************************************/
|
||
... | ... | |
unit_tile(actor_unit));
|
||
}
|
||
/**********************************************************************//**
|
||
Returns TRUE if actor_plr can do wanted_action as far as
|
||
action enablers are concerned.
|
||
**************************************************************************/
|
||
bool is_action_enabled_player(const struct civ_map *nmap,
|
||
const action_id wanted_action,
|
||
const struct player *actor_plr)
|
||
{
|
||
return is_action_enabled(nmap, wanted_action,
|
||
&(const struct req_context) {
|
||
.player = actor_plr,
|
||
},
|
||
nullptr, nullptr, nullptr);
|
||
}
|
||
/**********************************************************************//**
|
||
Find out if the action is enabled, may be enabled or isn't enabled given
|
||
what the player owning the actor knowns.
|
||
... | ... | |
return "ui_name_user_action_4";
|
||
case ACTION_GAIN_VETERANCY:
|
||
case ACTION_ESCAPE:
|
||
case ACTION_CIVIL_WAR:
|
||
fc_assert(!action_id_is_internal(act)); /* Fail always */
|
||
break;
|
||
case ACTION_COUNT:
|
||
... | ... | |
return N_("%sGain Veterancy%s");
|
||
case ACTION_ESCAPE:
|
||
return N_("%sEscape%s");
|
||
case ACTION_CIVIL_WAR:
|
||
return N_("%sCivil War%s");
|
||
case ACTION_COUNT:
|
||
fc_assert(act != ACTION_COUNT);
|
||
break;
|
||
... | ... | |
case ACTION_SPY_ESCAPE:
|
||
case ACTION_GAIN_VETERANCY:
|
||
case ACTION_ESCAPE:
|
||
case ACTION_CIVIL_WAR:
|
||
/* Min range is not ruleset changeable */
|
||
return NULL;
|
||
case ACTION_NUKE:
|
||
... | ... | |
case ACTION_SPY_ESCAPE:
|
||
case ACTION_GAIN_VETERANCY:
|
||
case ACTION_ESCAPE:
|
||
case ACTION_CIVIL_WAR:
|
||
/* Max range is not ruleset changeable */
|
||
return NULL;
|
||
case ACTION_HELP_WONDER:
|
||
... | ... | |
case ACTION_SPY_ESCAPE:
|
||
case ACTION_GAIN_VETERANCY:
|
||
case ACTION_ESCAPE:
|
||
case ACTION_CIVIL_WAR:
|
||
/* Target kind is not ruleset changeable */
|
||
return NULL;
|
||
case ACTION_NUKE:
|
||
... | ... | |
case ACTION_SPY_ESCAPE:
|
||
case ACTION_GAIN_VETERANCY:
|
||
case ACTION_ESCAPE:
|
||
case ACTION_CIVIL_WAR:
|
||
/* Actor consuming always is not ruleset changeable */
|
||
return NULL;
|
||
case ACTION_FOUND_CITY:
|
||
... | ... | |
case ACTION_HUT_FRIGHTEN3:
|
||
case ACTION_HUT_FRIGHTEN4:
|
||
case ACTION_GAIN_VETERANCY:
|
||
case ACTION_CIVIL_WAR:
|
||
case ACTION_ESCAPE:
|
||
case ACTION_USER_ACTION1:
|
||
case ACTION_USER_ACTION2:
|
||
... | ... | |
case ACTION_SPY_ESCAPE:
|
||
case ACTION_GAIN_VETERANCY:
|
||
case ACTION_ESCAPE:
|
||
case ACTION_CIVIL_WAR:
|
||
case ACTION_USER_ACTION1:
|
||
case ACTION_USER_ACTION2:
|
||
case ACTION_USER_ACTION3:
|
common/actions.h | ||
---|---|---|
const action_id wanted_action,
|
||
const struct unit *actor_unit);
|
||
bool is_action_enabled_player(const struct civ_map *nmap,
|
||
const action_id wanted_action,
|
||
const struct player *actor_plr);
|
||
struct act_prob action_prob_vs_city(const struct civ_map *nmap,
|
||
const struct unit *actor,
|
||
const action_id act_id,
|
common/game.h | ||
---|---|---|
/* Defined in the ruleset. */
|
||
/* Game settings & other data. */
|
||
struct {
|
||
bool civil_war_enabled;
|
||
} deprecated;
|
||
enum city_names_mode allowed_city_names;
|
||
enum plrcolor_mode plrcolormode;
|
common/networking/packets.def | ||
---|---|---|
BOOL year_0_hack;
|
||
UINT8 top_cities_count;
|
||
UINT16 fragment_count;
|
||
BOOL civil_war_enabled;
|
||
UINT16 granularity;
|
||
WONDER_VISIB small_wonder_visibility;
|
||
end
|
data/alien/game.ruleset | ||
---|---|---|
; due to negative bulbs, if techlossforgiveness allows loss
|
||
tech_loss_allow_holes = TRUE
|
||
; Whether civil war is possible at all
|
||
civil_war_enabled = FALSE
|
||
; Comma separated list of things to happen, in addition to death
|
||
; of owner, when gameloss unit dies
|
||
; "CivilWar" - Part of the empire remains, controlled by a new player
|
data/civ1/actions.ruleset | ||
---|---|---|
{ "type", "name", "range", "present"
|
||
"UnitTypeFlag", "NoVeteran", "Local", FALSE
|
||
}
|
||
[enabler_civil_war]
|
||
action = "Civil War"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
}
|
data/civ1/game.ruleset | ||
---|---|---|
; due to negative bulbs, if techlossforgiveness allows loss
|
||
tech_loss_allow_holes = FALSE
|
||
; Whether civil war is possible at all
|
||
civil_war_enabled = TRUE
|
||
; Comma separated list of things to happen, in addition to death
|
||
; of owner, when gameloss unit dies
|
||
; "CivilWar" - Part of the empire remains, controlled by a new player
|
data/civ2/actions.ruleset | ||
---|---|---|
{ "type", "name", "range", "present"
|
||
"UnitTypeFlag", "NoVeteran", "Local", FALSE
|
||
}
|
||
[enabler_civil_war]
|
||
action = "Civil War"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
}
|
data/civ2/game.ruleset | ||
---|---|---|
; due to negative bulbs, if techlossforgiveness allows loss
|
||
tech_loss_allow_holes = TRUE
|
||
; Whether civil war is possible at all
|
||
civil_war_enabled = TRUE
|
||
; Comma separated list of things to happen, in addition to death
|
||
; of owner, when gameloss unit dies
|
||
; "CivilWar" - Part of the empire remains, controlled by a new player
|
data/civ2civ3/actions.ruleset | ||
---|---|---|
{ "type", "name", "range", "present"
|
||
"UnitTypeFlag", "NoVeteran", "Local", FALSE
|
||
}
|
||
[enabler_civil_war]
|
||
action = "Civil War"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
}
|
data/civ2civ3/game.ruleset | ||
---|---|---|
; due to negative bulbs, if techlossforgiveness allows loss
|
||
tech_loss_allow_holes = FALSE
|
||
; Whether civil war is possible at all
|
||
civil_war_enabled = TRUE
|
||
; Comma separated list of things to happen, in addition to death
|
||
; of owner, when gameloss unit dies
|
||
; "CivilWar" - Part of the empire remains, controlled by a new player
|
data/classic/actions.ruleset | ||
---|---|---|
[enabler_gain_veterancy]
|
||
action = "Gain Veterancy"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
{ "type", "name", "range", "present"
|
||
}
|
||
[enabler_civil_war]
|
||
action = "Civil War"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
}
|
data/classic/game.ruleset | ||
---|---|---|
; due to negative bulbs, if techlossforgiveness allows loss
|
||
tech_loss_allow_holes = TRUE
|
||
; Whether civil war is possible at all
|
||
civil_war_enabled = TRUE
|
||
; Comma separated list of things to happen, in addition to death
|
||
; of owner, when gameloss unit dies
|
||
; "CivilWar" - Part of the empire remains, controlled by a new player
|
data/goldkeep/actions.ruleset | ||
---|---|---|
[enabler_gain_veterancy]
|
||
action = "Gain Veterancy"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
{ "type", "name", "range", "present"
|
||
}
|
||
[enabler_civil_war]
|
||
action = "Civil War"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
}
|
data/goldkeep/game.ruleset | ||
---|---|---|
; due to negative bulbs, if techlossforgiveness allows loss
|
||
tech_loss_allow_holes = TRUE
|
||
; Whether civil war is possible at all
|
||
civil_war_enabled = TRUE
|
||
; Comma separated list of things to happen, in addition to death
|
||
; of owner, when gameloss unit dies
|
||
; "CivilWar" - Part of the empire remains, controlled by a new player
|
data/granularity/actions.ruleset | ||
---|---|---|
[enabler_gain_veterancy]
|
||
action = "Gain Veterancy"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
{ "type", "name", "range", "present"
|
||
}
|
||
[enabler_civil_war]
|
||
action = "Civil War"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
}
|
data/granularity/game.ruleset | ||
---|---|---|
; due to negative bulbs, if techlossforgiveness allows loss
|
||
tech_loss_allow_holes = TRUE
|
||
; Whether civil war is possible at all
|
||
civil_war_enabled = TRUE
|
||
; Comma separated list of things to happen, in addition to death
|
||
; of owner, when gameloss unit dies
|
||
; "CivilWar" - Part of the empire remains, controlled by a new player
|
data/multiplayer/actions.ruleset | ||
---|---|---|
[enabler_gain_veterancy]
|
||
action = "Gain Veterancy"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
{ "type", "name", "range", "present"
|
||
}
|
||
[enabler_civil_war]
|
||
action = "Civil War"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
}
|
data/multiplayer/game.ruleset | ||
---|---|---|
; due to negative bulbs, if techlossforgiveness allows loss
|
||
tech_loss_allow_holes = TRUE
|
||
; Whether civil war is possible at all
|
||
civil_war_enabled = TRUE
|
||
; Comma separated list of things to happen, in addition to death
|
||
; of owner, when gameloss unit dies
|
||
; "CivilWar" - Part of the empire remains, controlled by a new player
|
data/sandbox/actions.ruleset | ||
---|---|---|
{ "type", "name", "range", "present"
|
||
"UnitTypeFlag", "NoVeteran", "Local", FALSE
|
||
}
|
||
[enabler_civil_war]
|
||
action = "Civil War"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
}
|
data/sandbox/game.ruleset | ||
---|---|---|
; due to negative bulbs, if techlossforgiveness allows loss
|
||
tech_loss_allow_holes = FALSE
|
||
; Whether civil war is possible at all
|
||
civil_war_enabled = TRUE
|
||
; Comma separated list of things to happen, in addition to death
|
||
; of owner, when gameloss unit dies
|
||
; "CivilWar" - Part of the empire remains, controlled by a new player
|
data/stub/game.ruleset | ||
---|---|---|
; due to negative bulbs, if techlossforgiveness allows loss
|
||
tech_loss_allow_holes = TRUE
|
||
; Whether civil war is possible at all
|
||
civil_war_enabled = TRUE
|
||
; Comma separated list of things to happen, in addition to death
|
||
; of owner, when gameloss unit dies
|
||
; "CivilWar" - Part of the empire remains, controlled by a new player
|
data/webperimental/actions.ruleset | ||
---|---|---|
[enabler_gain_veterancy]
|
||
action = "Gain Veterancy"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
{ "type", "name", "range", "present"
|
||
}
|
||
[enabler_civil_war]
|
||
action = "Civil War"
|
||
actor_reqs =
|
||
{ "type", "name", "range", "present"
|
||
}
|
data/webperimental/game.ruleset | ||
---|---|---|
; due to negative bulbs, if techlossforgiveness allows loss
|
||
tech_loss_allow_holes = FALSE
|
||
; Whether civil war is possible at all
|
||
civil_war_enabled = TRUE
|
||
; Comma separated list of things to happen, in addition to death
|
||
; of owner, when gameloss unit dies
|
||
; "CivilWar" - Part of the empire remains, controlled by a new player
|
gen_headers/enums/actions_enums.def | ||
---|---|---|
# Enabler checks only
|
||
ACTION_GAIN_VETERANCY "Gain Veterancy"
|
||
ACTION_ESCAPE "Escape"
|
||
ACTION_CIVIL_WAR "Civil War"
|
||
# User actions
|
||
ACTION_USER_ACTION1 "User Action 1"
|
server/plrhand.c | ||
---|---|---|
bool honour_server_option)
|
||
{
|
||
int n;
|
||
const struct civ_map *nmap = &(wld.map);
|
||
if (!game.info.civil_war_enabled) {
|
||
if (!is_action_enabled_player(nmap, ACTION_CIVIL_WAR, pplayer)) {
|
||
return FALSE;
|
||
}
|
||
n = city_list_size(pplayer->cities);
|
||
if (n - (conquering_city?1:0) < GAME_MIN_CIVILWARSIZE) {
|
||
if (n - (conquering_city ? 1 : 0) < GAME_MIN_CIVILWARSIZE) {
|
||
return FALSE;
|
||
}
|
||
if (honour_server_option) {
|
server/ruleset/rscompat.c | ||
---|---|---|
requirement_vector_append(&enabler->actor_reqs, e_req);
|
||
action_enabler_add(enabler);
|
||
if (game.server.deprecated.civil_war_enabled) {
|
||
enabler = action_enabler_new();
|
||
enabler->action = ACTION_CIVIL_WAR;
|
||
action_enabler_add(enabler);
|
||
}
|
||
/* Upgrade existing effects. Done before new effects are added to prevent
|
||
* the new effects from being upgraded by accident. */
|
||
iterate_effect_cache(effect_list_compat_cb, info);
|
server/ruleset/ruleload.c | ||
---|---|---|
RS_MIN_FOOD_COST,
|
||
RS_MAX_FOOD_COST,
|
||
"civstyle.food_cost");
|
||
game.info.civil_war_enabled
|
||
= secfile_lookup_bool_default(file, TRUE, "civstyle.civil_war_enabled");
|
||
if (compat->compat_mode && compat->version < RSFORMAT_3_3) {
|
||
game.server.deprecated.civil_war_enabled
|
||
= secfile_lookup_bool_default(file, TRUE, "civstyle.civil_war_enabled");
|
||
rscompat_civil_war_effects_3_3(file);
|
||
} else {
|
||
/* Avoid additional Civil War enabler */
|
||
game.server.deprecated.civil_war_enabled = FALSE;
|
||
}
|
||
game.info.base_bribe_cost
|
tools/ruleutil/rulesave.c | ||
---|---|---|
save_default_int(sfile, game.info.food_cost,
|
||
RS_DEFAULT_FOOD_COST,
|
||
"civstyle.food_cost", nullptr);
|
||
save_default_bool(sfile, game.info.civil_war_enabled,
|
||
TRUE,
|
||
"civstyle.civil_war_enabled", nullptr);
|
||
save_default_bool(sfile,
|
||
BV_ISSET(action_by_number(ACTION_PARADROP)->sub_results,
|
||
ACT_SUB_RES_MAY_EMBARK),
|