Project

General

Profile

Feature #1032 ยป 0054-Replace-civstyle-civil-war-bonus-values-with-Civil_W.patch

Marko Lindqvist, 10/29/2024 11:40 PM

View differences:

common/game.h
#define RS_MIN_FOOD_COST 0
#define RS_MAX_FOOD_COST 10000
#define RS_DEFAULT_CIVIL_WAR_CELEB -5
#define RS_DEFAULT_CIVIL_WAR_UNHAPPY 5
#define RS_DEFAULT_TIRED_ATTACK FALSE
#define RS_DEFAULT_NUKE_POP_LOSS_PCT 49
#define RS_MIN_NUKE_POP_LOSS_PCT 0
common/networking/packets.def
UINT8 top_cities_count;
UINT16 fragment_count;
BOOL civil_war_enabled;
SINT16 civil_war_bonus_celebrating;
SINT16 civil_war_bonus_unhappy;
UINT16 granularity;
WONDER_VISIB small_wonder_visibility;
end
data/alien/game.ruleset
; Whether civil war is possible at all
civil_war_enabled = FALSE
; How many percents each celebrating city affects chance of civil war
civil_war_bonus_celebrating = 0
; How many percents each unhappy city affects chance of civil war
civil_war_bonus_unhappy = 0
; 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/effects.ruleset
"TileRel", "Only Other Region", "Adjacent"
"TileRel", "Same Region", "Adjacent"
}
[effect_civil_war_city_celebration]
type = "Civil_War_City_Bonus"
value = 5
reqs =
{ "type", "name", "range"
"CityStatus", "Celebration", "City"
}
[effect_civil_war_city_disorder]
type = "Civil_War_City_Bonus"
value = -5
reqs =
{ "type", "name", "range"
"CityStatus", "Disorder", "City"
}
data/civ1/game.ruleset
; Whether civil war is possible at all
civil_war_enabled = TRUE
; How many percents each celebrating city affects chance of civil war
civil_war_bonus_celebrating = -5
; How many percents each unhappy city affects chance of civil war
civil_war_bonus_unhappy = 5
; 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/effects.ruleset
"TileRel", "Only Other Region", "Adjacent"
"TileRel", "Same Region", "Adjacent"
}
[effect_civil_war_city_celebration]
type = "Civil_War_City_Bonus"
value = 5
reqs =
{ "type", "name", "range"
"CityStatus", "Celebration", "City"
}
[effect_civil_war_city_disorder]
type = "Civil_War_City_Bonus"
value = -5
reqs =
{ "type", "name", "range"
"CityStatus", "Disorder", "City"
}
data/civ2/game.ruleset
; Whether civil war is possible at all
civil_war_enabled = TRUE
; How many percents each celebrating city affects chance of civil war
civil_war_bonus_celebrating = -5
; How many percents each unhappy city affects chance of civil war
civil_war_bonus_unhappy = 5
; 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/effects.ruleset
"TileRel", "Only Other Region", "Adjacent"
"TileRel", "Same Region", "Adjacent"
}
[effect_civil_war_city_celebration]
type = "Civil_War_City_Bonus"
value = 5
reqs =
{ "type", "name", "range"
"CityStatus", "Celebration", "City"
}
[effect_civil_war_city_disorder]
type = "Civil_War_City_Bonus"
value = -5
reqs =
{ "type", "name", "range"
"CityStatus", "Disorder", "City"
}
data/civ2civ3/game.ruleset
; Whether civil war is possible at all
civil_war_enabled = TRUE
; How many percents each celebrating city affects chance of civil war
civil_war_bonus_celebrating = -5
; How many percents each unhappy city affects chance of civil war
civil_war_bonus_unhappy = 5
; 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/effects.ruleset
"TileRel", "Only Other Region", "Adjacent"
"TileRel", "Same Region", "Adjacent"
}
[effect_civil_war_city_celebration]
type = "Civil_War_City_Bonus"
value = 5
reqs =
{ "type", "name", "range"
"CityStatus", "Celebration", "City"
}
[effect_civil_war_city_disorder]
type = "Civil_War_City_Bonus"
value = -5
reqs =
{ "type", "name", "range"
"CityStatus", "Disorder", "City"
}
data/classic/game.ruleset
; Whether civil war is possible at all
civil_war_enabled = TRUE
; How many percents each celebrating city affects chance of civil war
civil_war_bonus_celebrating = -5
; How many percents each unhappy city affects chance of civil war
civil_war_bonus_unhappy = 5
; 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/effects.ruleset
"TileRel", "Only Other Region", "Adjacent"
"TileRel", "Same Region", "Adjacent"
}
[effect_civil_war_city_celebration]
type = "Civil_War_City_Bonus"
value = 5
reqs =
{ "type", "name", "range"
"CityStatus", "Celebration", "City"
}
[effect_civil_war_city_disorder]
type = "Civil_War_City_Bonus"
value = -5
reqs =
{ "type", "name", "range"
"CityStatus", "Disorder", "City"
}
data/goldkeep/game.ruleset
; Whether civil war is possible at all
civil_war_enabled = TRUE
; How many percents each celebrating city affects chance of civil war
civil_war_bonus_celebrating = -5
; How many percents each unhappy city affects chance of civil war
civil_war_bonus_unhappy = 5
; 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/game.ruleset
; Whether civil war is possible at all
civil_war_enabled = TRUE
; How many percents each celebrating city affects chance of civil war
civil_war_bonus_celebrating = 0
; How many percents each unhappy city affects chance of civil war
civil_war_bonus_unhappy = 0
; 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/effects.ruleset
"TileRel", "Only Other Region", "Adjacent"
"TileRel", "Same Region", "Adjacent"
}
[effect_civil_war_city_celebration]
type = "Civil_War_City_Bonus"
value = 5
reqs =
{ "type", "name", "range"
"CityStatus", "Celebration", "City"
}
[effect_civil_war_city_disorder]
type = "Civil_War_City_Bonus"
value = -5
reqs =
{ "type", "name", "range"
"CityStatus", "Disorder", "City"
}
data/multiplayer/game.ruleset
; Whether civil war is possible at all
civil_war_enabled = TRUE
; How many percents each celebrating city affects chance of civil war
civil_war_bonus_celebrating = -5
; How many percents each unhappy city affects chance of civil war
civil_war_bonus_unhappy = 5
; 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/effects.ruleset
"TileRel", "Only Other Region", "Adjacent"
"TileRel", "Same Region", "Adjacent"
}
[effect_civil_war_city_celebration]
type = "Civil_War_City_Bonus"
value = 5
reqs =
{ "type", "name", "range"
"CityStatus", "Celebration", "City"
}
[effect_civil_war_city_disorder]
type = "Civil_War_City_Bonus"
value = -5
reqs =
{ "type", "name", "range"
"CityStatus", "Disorder", "City"
}
data/sandbox/game.ruleset
; Whether civil war is possible at all
civil_war_enabled = TRUE
; How many percents each celebrating city affects chance of civil war
civil_war_bonus_celebrating = -5
; How many percents each unhappy city affects chance of civil war
civil_war_bonus_unhappy = 5
; 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
; Whether civil war is possible at all
civil_war_enabled = TRUE
; How many percents each celebrating city affects chance of civil war
civil_war_bonus_celebrating = 0
; How many percents each unhappy city affects chance of civil war
civil_war_bonus_unhappy = 0
; 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/effects.ruleset
"TileRel", "Only Other Region", "Adjacent"
"TileRel", "Same Region", "Adjacent"
}
[effect_civil_war_city_celebration]
type = "Civil_War_City_Bonus"
value = 5
reqs =
{ "type", "name", "range"
"CityStatus", "Celebration", "City"
}
[effect_civil_war_city_disorder]
type = "Civil_War_City_Bonus"
value = -5
reqs =
{ "type", "name", "range"
"CityStatus", "Disorder", "City"
}
data/webperimental/game.ruleset
; Whether civil war is possible at all
civil_war_enabled = TRUE
; How many percents each celebrating city affects chance of civil war
civil_war_bonus_celebrating = -5
; How many percents each unhappy city affects chance of civil war
civil_war_bonus_unhappy = 5
; 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
server/plrhand.c
/* Now compute the contribution of the cities. */
city_list_iterate(pplayer->cities, pcity) {
if (city_unhappy(pcity)) {
prob += game.info.civil_war_bonus_unhappy;
}
if (city_celebrating(pcity)) {
prob += game.info.civil_war_bonus_celebrating;
}
prob -= get_city_bonus(pcity, EFT_CIVIL_WAR_CITY_BONUS);
} city_list_iterate_end;
server/ruleset/rscompat.c
return nullptr;
}
#define RS_DEFAULT_CIVIL_WAR_CELEB -5
#define RS_DEFAULT_CIVIL_WAR_UNHAPPY 5
/**********************************************************************//**
Add civil war bonus effects matching old civstyle values.
**************************************************************************/
void rscompat_civil_war_effects_3_3(struct section_file *game_rs)
{
int bonus = secfile_lookup_int_default(game_rs, RS_DEFAULT_CIVIL_WAR_CELEB,
"civstyle.civil_war_bonus_celebrating");
if (bonus != 0) {
struct requirement e_req;
struct effect *peffect;
peffect = effect_new(EFT_CIVIL_WAR_CITY_BONUS, -bonus, nullptr);
e_req = req_from_str("CityStatus", "City", FALSE, TRUE, FALSE,
"Celebration");
effect_req_append(peffect, e_req);
}
bonus = secfile_lookup_int_default(game_rs, RS_DEFAULT_CIVIL_WAR_UNHAPPY,
"civstyle.civil_war_bonus_unhappy");
if (bonus != 0) {
struct requirement e_req;
struct effect *peffect;
peffect = effect_new(EFT_CIVIL_WAR_CITY_BONUS, -bonus, nullptr);
e_req = req_from_str("CityStatus", "City", FALSE, TRUE, FALSE,
"Disorder");
effect_req_append(peffect, e_req);
}
}
server/ruleset/rscompat.h
const char *blocked_by_old_name_3_3(const char *new_name);
const char *ui_name_old_name_3_3(const char *new_name);
void rscompat_civil_war_effects_3_3(struct section_file *game_rs);
#ifdef __cplusplus
}
#endif /* __cplusplus */
server/ruleset/ruleload.c
game.info.civil_war_enabled
= secfile_lookup_bool_default(file, TRUE, "civstyle.civil_war_enabled");
game.info.civil_war_bonus_celebrating
= secfile_lookup_int_default(file, RS_DEFAULT_CIVIL_WAR_CELEB,
"civstyle.civil_war_bonus_celebrating");
game.info.civil_war_bonus_unhappy
= secfile_lookup_int_default(file, RS_DEFAULT_CIVIL_WAR_UNHAPPY,
"civstyle.civil_war_bonus_unhappy");
if (compat->compat_mode && compat->version < RSFORMAT_3_3) {
rscompat_civil_war_effects_3_3(file);
}
game.info.base_bribe_cost
= secfile_lookup_int_default_min_max(file,
tools/ruleutil/rulesave.c
save_default_bool(sfile, game.info.civil_war_enabled,
TRUE,
"civstyle.civil_war_enabled", nullptr);
save_default_int(sfile, game.info.civil_war_bonus_celebrating,
RS_DEFAULT_CIVIL_WAR_CELEB,
"civstyle.civil_war_bonus_celebrating", nullptr);
save_default_int(sfile, game.info.civil_war_bonus_unhappy,
RS_DEFAULT_CIVIL_WAR_UNHAPPY,
"civstyle.civil_war_bonus_unhappy", nullptr);
save_default_bool(sfile,
BV_ISSET(action_by_number(ACTION_PARADROP)->sub_results,
ACT_SUB_RES_MAY_EMBARK),
    (1-1/1)