Project

General

Profile

Feature #1336 » 0032-Remove-homeless_gold_upkeep-ruleset-setting.patch

Marko Lindqvist, 05/01/2025 10:06 PM

View differences:

common/game.h
/* Defined in the ruleset. */
/* Game settings & other data. */
struct {
bool homeless_gold_upkeep;
} deprecated;
enum city_names_mode allowed_city_names;
enum plrcolor_mode plrcolormode;
int aqueductloss;
common/networking/packets.def
UINT32 globalwarming;
GOLD gold;
GOLD_UPKEEP_STYLE gold_upkeep_style;
BOOL homeless_gold_upkeep;
UINT32 infrapoints;
REVOLENTYPE revolentype;
GOVERNMENT default_government_id;
data/alien/effects.ruleset
type = "City_Vision_Radius_Sq"
value = 5
[effect_base_unit_upkeep]
[effect_base_unit_upkeep_not_gold]
type = "Upkeep_Factor"
value = 1
value = 1
reqs =
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", FALSE
}
[effect_base_unit_upkeep_gold]
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range"
"OutputType", "Gold", "Local"
"UnitState", "HasHomeCity", "Local"
}
[effect_empire_size_base]
type = "Empire_Size_Base"
data/alien/game.ruleset
; upkeep are disbanded.
gold_upkeep_style = "Nation"
; Whether also homeless units pay gold upkeep. Enabling requires that
; gold_upkeep_style is not "City"
homeless_gold_upkeep = FALSE
; How many points of output one basic unit consists of. Typically you
; want this to be some 10^n.
output_granularity = 1
data/civ1/effects.ruleset
type = "Max_Rates"
value = 100
[effect_base_unit_upkeep]
[effect_base_unit_upkeep_not_gold]
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", FALSE
}
[effect_base_unit_upkeep_gold]
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range"
"OutputType", "Gold", "Local"
"UnitState", "HasHomeCity", "Local"
}
[effect_republic_unit_upkeep]
type = "Upkeep_Factor"
data/civ1/game.ruleset
; upkeep are disbanded.
gold_upkeep_style = "City"
; Whether also homeless units pay gold upkeep. Enabling requires that
; gold_upkeep_style is not "City"
homeless_gold_upkeep = FALSE
; How many points of output one basic unit consists of. Typically you
; want this to be some 10^n.
output_granularity = 1
data/civ2/effects.ruleset
"Gov", "Republic", "Player"
}
[effect_base_unit_upkeep]
[effect_base_unit_upkeep_not_gold]
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", FALSE
}
[effect_base_unit_upkeep_gold]
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range"
"OutputType", "Gold", "Local"
"UnitState", "HasHomeCity", "Local"
}
[effect_communism_unit_upkeep]
type = "Upkeep_Factor"
data/civ2/game.ruleset
; upkeep are disbanded.
gold_upkeep_style = "City"
; Whether also homeless units pay gold upkeep. Enabling requires that
; gold_upkeep_style is not "City"
homeless_gold_upkeep = FALSE
; How many points of output one basic unit consists of. Typically you
; want this to be some 10^n.
output_granularity = 1
data/civ2civ3/effects.ruleset
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", TRUE
"Gov", "Anarchy", "Player", FALSE
"Gov", "Tribal", "Player", FALSE
"Gov", "Communism", "Player", FALSE
; "Gov", "Despotism", "Player", FALSE
; "Gov", "Monarchy", "Player", FALSE
; "Gov", "Fundamentalism", "Player", FALSE
; "Gov", "Federation", "Player", FALSE
"Gov", "Republic", "Player", FALSE
; "Gov", "Democracy", "Player", FALSE
}
; additive with previous => x2 for Fundamentalism, Federation, Democracy
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", TRUE
"Gov", "Anarchy", "Player", FALSE
"Gov", "Tribal", "Player", FALSE
"Gov", "Communism", "Player", FALSE
; "Gov", "Despotism", "Player", FALSE
; "Gov", "Monarchy", "Player", FALSE
; "Gov", "Fundamentalism", "Player", FALSE
; "Gov", "Federation", "Player", FALSE
"Gov", "Republic", "Player", FALSE
; "Gov", "Democracy", "Player", FALSE
"UnitState", "HasHomeCity", "Local", TRUE
}
; Additive with previous => x2 for Fundamentalism, Federation, Democracy
[effect_base_unit_upkeep_gold_2]
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", TRUE
"Gov", "Anarchy", "Player", FALSE
"Gov", "Tribal", "Player", FALSE
"Gov", "Communism", "Player", FALSE
"Gov", "Despotism", "Player", FALSE
"Gov", "Monarchy", "Player", FALSE
; "Gov", "Fundamentalism", "Player", FALSE
; "Gov", "Federation", "Player", FALSE
"Gov", "Republic", "Player", FALSE
; "Gov", "Democracy", "Player", FALSE
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", TRUE
"Gov", "Anarchy", "Player", FALSE
"Gov", "Tribal", "Player", FALSE
"Gov", "Communism", "Player", FALSE
"Gov", "Despotism", "Player", FALSE
"Gov", "Monarchy", "Player", FALSE
; "Gov", "Fundamentalism", "Player", FALSE
; "Gov", "Federation", "Player", FALSE
"Gov", "Republic", "Player", FALSE
; "Gov", "Democracy", "Player", FALSE
"UnitState", "HasHomeCity", "Local", TRUE
}
[effect_base_unit_upkeep_shield]
data/civ2civ3/game.ruleset
; upkeep are disbanded.
gold_upkeep_style = "Mixed"
; Whether also homeless units pay gold upkeep. Enabling requires that
; gold_upkeep_style is not "City"
homeless_gold_upkeep = FALSE
; How many points of output one basic unit consists of. Typically you
; want this to be some 10^n.
output_granularity = 1
data/classic/effects.ruleset
"OutputType", "Trade", "Local"
}
[effect_base_unit_upkeep]
[effect_base_unit_upkeep_not_gold]
type = "Upkeep_Factor"
value = 1
value = 1
reqs =
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", FALSE
}
[effect_base_unit_upkeep_gold]
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range"
"OutputType", "Gold", "Local"
"UnitState", "HasHomeCity", "Local"
}
[effect_republic_unit_upkeep]
type = "Upkeep_Factor"
data/classic/game.ruleset
; upkeep are disbanded.
gold_upkeep_style = "City"
; Whether also homeless units pay gold upkeep. Enabling requires that
; gold_upkeep_style is not "City"
homeless_gold_upkeep = FALSE
; How many points of output one basic unit consists of. Typically you
; want this to be some 10^n.
output_granularity = 1
data/goldkeep/effects.ruleset
"OutputType", "Trade", "Local"
}
[effect_base_unit_upkeep]
[effect_base_unit_upkeep_not_gold]
type = "Upkeep_Factor"
value = 1
value = 1
reqs =
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", FALSE
}
[effect_base_unit_upkeep_gold]
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range"
"OutputType", "Gold", "Local"
"UnitState", "HasHomeCity", "Local"
}
[effect_republic_unit_upkeep]
type = "Upkeep_Factor"
data/goldkeep/game.ruleset
; upkeep are disbanded.
gold_upkeep_style = "Mixed"
; Whether also homeless units pay gold upkeep. Enabling requires that
; gold_upkeep_style is not "City"
homeless_gold_upkeep = FALSE
; How many points of output one basic unit consists of. Typically you
; want this to be some 10^n.
output_granularity = 1
data/granularity/game.ruleset
; upkeep are disbanded.
gold_upkeep_style = "City"
; Whether also homeless units pay gold upkeep. Enabling requires that
; gold_upkeep_style is not "City"
homeless_gold_upkeep = FALSE
; How many points of output one basic unit consists of. Typically you
; want this to be some 10^n.
output_granularity = 100
data/multiplayer/effects.ruleset
"OutputType", "Trade", "Local"
}
[effect_base_unit_upkeep]
[effect_base_unit_upkeep_not_gold]
type = "Upkeep_Factor"
value = 1
value = 1
reqs =
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", FALSE
}
[effect_base_unit_upkeep_gold]
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range"
"OutputType", "Gold", "Local"
"UnitState", "HasHomeCity", "Local"
}
[effect_republic_unit_upkeep]
type = "Upkeep_Factor"
data/multiplayer/game.ruleset
; upkeep are disbanded.
gold_upkeep_style = "City"
; Whether also homeless units pay gold upkeep. Enabling requires that
; gold_upkeep_style is not "City"
homeless_gold_upkeep = FALSE
; How many points of output one basic unit consists of. Typically you
; want this to be some 10^n.
output_granularity = 1
data/ruledit/comments-3.4.txt
; upkeep are disbanded.\
"
homeless_gold_upkeep = "\n\
; Whether also homeless units pay gold upkeep. Enabling requires that\n\
; gold_upkeep_style is not \"City\"\
"
airlift_always_enabled = "\n\
; Is it possible to airlift even with zero airlift capacity when\n\
; airliftingstyle server setting has been set to unlimited airlifts?\
data/sandbox/effects.ruleset
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", TRUE
"Gov", "Anarchy", "Player", FALSE
"Gov", "Tribal", "Player", FALSE
"Gov", "Communism", "Player", FALSE
; "Gov", "Despotism", "Player", FALSE
; "Gov", "Monarchy", "Player", FALSE
; "Gov", "Fundamentalism", "Player", FALSE
; "Gov", "Federation", "Player", FALSE
"Gov", "Republic", "Player", FALSE
; "Gov", "Democracy", "Player", FALSE
}
; additive with previous => x2 for Fundamentalism, Federation, Democracy
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", TRUE
"Gov", "Anarchy", "Player", FALSE
"Gov", "Tribal", "Player", FALSE
"Gov", "Communism", "Player", FALSE
; "Gov", "Despotism", "Player", FALSE
; "Gov", "Monarchy", "Player", FALSE
; "Gov", "Fundamentalism", "Player", FALSE
; "Gov", "Federation", "Player", FALSE
"Gov", "Republic", "Player", FALSE
; "Gov", "Democracy", "Player", FALSE
"UnitState", "HasHomeCity", "Local", TRUE
}
; Additive with previous => x2 for Fundamentalism, Federation, Democracy
[effect_base_unit_upkeep_gold_2]
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", TRUE
"Gov", "Anarchy", "Player", FALSE
"Gov", "Tribal", "Player", FALSE
"Gov", "Communism", "Player", FALSE
"Gov", "Despotism", "Player", FALSE
"Gov", "Monarchy", "Player", FALSE
; "Gov", "Fundamentalism", "Player", FALSE
; "Gov", "Federation", "Player", FALSE
"Gov", "Republic", "Player", FALSE
; "Gov", "Democracy", "Player", FALSE
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", TRUE
"Gov", "Anarchy", "Player", FALSE
"Gov", "Tribal", "Player", FALSE
"Gov", "Communism", "Player", FALSE
"Gov", "Despotism", "Player", FALSE
"Gov", "Monarchy", "Player", FALSE
; "Gov", "Fundamentalism", "Player", FALSE
; "Gov", "Federation", "Player", FALSE
"Gov", "Republic", "Player", FALSE
; "Gov", "Democracy", "Player", FALSE
"UnitState", "HasHomeCity", "Local", TRUE
}
[effect_base_unit_upkeep_shield]
data/sandbox/game.ruleset
; upkeep are disbanded.
gold_upkeep_style = "Mixed"
; Whether also homeless units pay gold upkeep. Enabling requires that
; gold_upkeep_style is not "City"
homeless_gold_upkeep = FALSE
; How many points of output one basic unit consists of. Typically you
; want this to be some 10^n.
output_granularity = 1
data/stub/game.ruleset
; upkeep are disbanded.
gold_upkeep_style = "City"
; Whether also homeless units pay gold upkeep. Enabling requires that
; gold_upkeep_style is not "City"
homeless_gold_upkeep = FALSE
; How many points of output one basic unit consists of. Typically you
; want this to be some 10^n.
output_granularity = 1
data/webperimental/effects.ruleset
"OutputType", "Trade", "Local"
}
[effect_base_unit_upkeep]
[effect_base_unit_upkeep_not_gold]
type = "Upkeep_Factor"
value = 1
value = 1
reqs =
{ "type", "name", "range", "present"
"OutputType", "Gold", "Local", FALSE
}
[effect_base_unit_upkeep_gold]
type = "Upkeep_Factor"
value = 1
reqs =
{ "type", "name", "range"
"OutputType", "Gold", "Local"
"UnitState", "HasHomeCity", "Local"
}
[effect_republic_unit_upkeep]
type = "Upkeep_Factor"
data/webperimental/game.ruleset
; upkeep are disbanded.
gold_upkeep_style = "City"
; Whether also homeless units pay gold upkeep. Enabling requires that
; gold_upkeep_style is not "City"
homeless_gold_upkeep = FALSE
; How many points of output one basic unit consists of. Typically you
; want this to be some 10^n.
output_granularity = 1
server/plrhand.c
{
char buf[200 + MAX_LEN_NAME];
/* gold_upkeep_style check currently redundant, but something we need
* once homeless_gold_upkeep retired. */
if (game.info.gold_upkeep_style != GOLD_UPKEEP_CITY
&& game.info.homeless_gold_upkeep) {
if (game.info.gold_upkeep_style != GOLD_UPKEEP_CITY) {
unit_list_iterate(pplayer->units, punit) {
if (is_unit_homeless(punit)) {
int gold = unit_upkeep_cost(punit, O_GOLD);
server/ruleset/rscompat.c
struct rscompat_info *info = (struct rscompat_info *)data;
if (info->version < RSFORMAT_3_4) {
if (!game.server.deprecated.homeless_gold_upkeep) {
if (peffect->type == EFT_UPKEEP_FACTOR) {
bool gold_included = TRUE;
bool only_gold = FALSE;
requirement_vector_iterate(&peffect->reqs, preq) {
if (preq->source.kind == VUT_OTYPE) {
if ((preq->source.value.outputtype != O_GOLD
&& preq->present)
|| (preq->source.value.outputtype == O_GOLD
&& !preq->present)) {
gold_included = FALSE;
} else if (preq->source.value.outputtype == O_GOLD) {
only_gold = TRUE;
}
}
} requirement_vector_iterate_end;
if (gold_included) {
if (!only_gold) {
struct effect *copy = effect_copy(peffect, EFT_UPKEEP_FACTOR);
/* Split to gold-only and not-gold effects.
* Make sure the gold-only is the one we currently handle
* (and not the one we add), so we don't encounter it again
* when iterating forward. */
requirement_vector_append(&peffect->reqs,
req_from_str("OutputType", "Local",
FALSE, TRUE, FALSE,
"Gold"));
requirement_vector_append(&copy->reqs,
req_from_str("OutputType", "Local",
FALSE, FALSE, FALSE,
"Gold"));
}
requirement_vector_append(&peffect->reqs,
req_from_str("UnitState", "Local",
FALSE, TRUE, FALSE,
"HasHomeCity"));
}
}
}
}
/* Go to the next effect. */
server/ruleset/ruleload.c
ok = FALSE;
}
game.info.homeless_gold_upkeep
= secfile_lookup_bool_default(file, FALSE, "civstyle.homeless_gold_upkeep");
if (compat->compat_mode
&& compat->version < RSFORMAT_3_4) {
game.server.deprecated.homeless_gold_upkeep
= secfile_lookup_bool_default(file, FALSE, "civstyle.homeless_gold_upkeep");
if (game.info.homeless_gold_upkeep
&& game.info.gold_upkeep_style == GOLD_UPKEEP_CITY) {
ruleset_error(NULL, LOG_ERROR,
"Cannot have homeless_gold_upkeep while gold_upkeep_style \"City\".");
ok = FALSE;
if (game.server.deprecated.homeless_gold_upkeep
&& game.info.gold_upkeep_style == GOLD_UPKEEP_CITY) {
ruleset_error(NULL, LOG_ERROR,
"Cannot have homeless_gold_upkeep while gold_upkeep_style \"City\".");
ok = FALSE;
}
} else {
game.server.deprecated.homeless_gold_upkeep = TRUE;
}
game.info.granularity = secfile_lookup_int_default(file, 1,
......
game.info.airlift_to_always_enabled
= secfile_lookup_bool_default(file, TRUE, "civstyle.airlift_to_always_enabled");
/* section: wonder_visibility */
/* Section: wonder_visibility */
if (ok) {
const char *text;
tools/ruleutil/comments.c
char *civstyle_ransom_gold;
char *civstyle_gameloss_style;
char *civstyle_gold_upkeep_style;
char *civstyle_homeless_gold_upkeep;
char *civstyle_airlift_always;
char *wonder_visibility_small_wonders;
char *incite_cost;
......
"entrydoc.gameloss_style");
comment_load(comments_storage.civstyle_gold_upkeep_style, comment_file,
"entrydoc.gold_upkeep_style");
comment_load(comments_storage.civstyle_homeless_gold_upkeep, comment_file,
"entrydoc.homeless_gold_upkeep");
comment_load(comments_storage.civstyle_airlift_always, comment_file,
"entrydoc.airlift_always_enabled");
comment_load(comments_storage.wonder_visibility_small_wonders, comment_file,
......
"civstyle");
}
/**********************************************************************//**
Write civstyle homeless_gold_upkeep settings header.
**************************************************************************/
void comment_civstyle_homeless_gold_upkeep(struct section_file *sfile)
{
comment_entry_write(sfile, comments_storage.civstyle_homeless_gold_upkeep,
"civstyle");
}
/**********************************************************************//**
Write civstyle airlift always enabled settings header.
**************************************************************************/
tools/ruleutil/comments.h
void comment_civstyle_ransom_gold(struct section_file *sfile);
void comment_civstyle_gameloss_style(struct section_file *sfile);
void comment_civstyle_gold_upkeep_style(struct section_file *sfile);
void comment_civstyle_homeless_gold_upkeep(struct section_file *sfile);
void comment_civstyle_airlift_always(struct section_file *sfile);
void comment_wonder_visibility_small_wonders(struct section_file *sfile);
void comment_incite_cost(struct section_file *sfile);
tools/ruleutil/rulesave.c
gold_upkeep_style_name(game.info.gold_upkeep_style),
"civstyle.gold_upkeep_style");
}
if (game.info.homeless_gold_upkeep) {
comment_civstyle_homeless_gold_upkeep(sfile);
}
save_default_bool(sfile, game.info.homeless_gold_upkeep, FALSE,
"civstyle.homeless_gold_upkeep", nullptr);
save_default_int(sfile, game.info.granularity,
1, "civstyle.output_granularity", nullptr);
(2-2/2)