Project

General

Profile

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

Marko Lindqvist, 05/01/2025 09:34 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/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/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/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/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/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/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/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/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/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. */
......
* the new effects from being upgraded by accident. */
iterate_effect_cache(effect_list_compat_cb, info);
if (!game.server.deprecated.homeless_gold_upkeep) {
struct requirement e_req;
struct effect *peffect = effect_new(EFT_UPKEEP_FACTOR, -1, nullptr);
e_req = req_from_values(VUT_OTYPE, REQ_RANGE_LOCAL,
FALSE, TRUE, FALSE, O_GOLD);
effect_req_append(peffect, e_req);
}
/* 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();
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);
(1-1/2)