From 231f0990d0b2bdfc0ab0164312a376202ea068a7 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 29 Jan 2023 13:02:33 +0200 Subject: [PATCH 40/40] Expose extra specifc clean times to ruleset See osdn #46636 Signed-off-by: Marko Lindqvist --- client/gui-qt/helpdlg.cpp | 6 +- client/helpdata.c | 131 ++++++++++++----------------- client/packhand.c | 2 - common/actions.c | 18 ++-- common/networking/packets.def | 2 - common/terrain.c | 4 +- common/terrain.h | 6 -- data/alien/terrain.ruleset | 59 ++++++++----- data/civ1/terrain.ruleset | 52 +++++++++++- data/civ2/terrain.ruleset | 52 +++++++++++- data/civ2civ3/terrain.ruleset | 101 +++++++++++++++------- data/classic/terrain.ruleset | 101 +++++++++++++++------- data/goldkeep/terrain.ruleset | 101 +++++++++++++++------- data/granularity/terrain.ruleset | 28 +++--- data/multiplayer/terrain.ruleset | 101 +++++++++++++++------- data/ruledit/comments-3.2.txt | 8 +- data/sandbox/terrain.ruleset | 101 +++++++++++++++------- data/stub/terrain.ruleset | 18 ++-- data/webperimental/terrain.ruleset | 101 +++++++++++++++------- server/rscompat.c | 51 ++++++++++- server/rscompat.h | 10 +++ server/ruleset.c | 94 ++++++++++++--------- tools/civmanual.c | 6 -- tools/ruleutil/rulesave.c | 18 +++- 24 files changed, 770 insertions(+), 401 deletions(-) diff --git a/client/gui-qt/helpdlg.cpp b/client/gui-qt/helpdlg.cpp index 5283bcd681..6e4403cc2d 100644 --- a/client/gui-qt/helpdlg.cpp +++ b/client/gui-qt/helpdlg.cpp @@ -1576,7 +1576,7 @@ void help_widget::set_topic_goods(const help_item* topic, /**********************************************************************//** Retrieves the maximum values any terrain will ever have. Supported fields: - base_time, clean_fallout_time, clean_pollution_time, defense_bonus, + base_time, defense_bonus, irrigation_food_incr, irrigation_time, mining_shield_incr, mining_time, movement_cost, output, pillage_time, road_output_incr_pct, road_time, transform_time @@ -1590,8 +1590,6 @@ struct terrain *help_widget::terrain_max_values() struct terrain *max = new struct terrain; max->base_time = 0; - max->_retire.clean_fallout_time = 0; - max->_retire.clean_pollution_time = 0; max->defense_bonus = 0; max->irrigation_food_incr = 0; max->irrigation_time = 0; @@ -1619,8 +1617,6 @@ struct terrain *help_widget::terrain_max_values() #define SET_MAX(v) \ max->v = max->v > terrain->v ? max->v : terrain->v SET_MAX(base_time); - SET_MAX(_retire.clean_fallout_time); - SET_MAX(_retire.clean_pollution_time); SET_MAX(defense_bonus); SET_MAX(irrigation_food_incr); SET_MAX(irrigation_time); diff --git a/client/helpdata.c b/client/helpdata.c index 60fba38907..45931f34ad 100644 --- a/client/helpdata.c +++ b/client/helpdata.c @@ -210,7 +210,7 @@ static bool insert_generated_text(char *outbuf, size_t outlen, const char *name) } if (0 == strcmp(name, "TerrainAlterations")) { - int clean_pollution_time = -1, clean_fallout_time = -1, pillage_time = -1; + int clean_time = -1, pillage_time = -1; bool terrain_independent_extras = FALSE; CATLSTR(outbuf, outlen, @@ -269,24 +269,31 @@ static bool insert_generated_text(char *outbuf, size_t outlen, const char *name) (pterrain->transform_result == T_NONE) ? "-" : transform_time, transform_result); - if (clean_pollution_time != 0 && pterrain->_retire.clean_pollution_time != 0) { - if (clean_pollution_time < 0) { - clean_pollution_time = pterrain->_retire.clean_pollution_time; - } else { - if (clean_pollution_time != pterrain->_retire.clean_pollution_time) { - clean_pollution_time = 0; /* Give up */ + if (clean_time != 0) { + extra_type_by_rmcause_iterate(ERM_CLEANPOLLUTION, pextra) { + int rmtime = pterrain->extra_removal_times[extra_index(pextra)]; + + if (rmtime != 0) { + if (clean_time < 0) { + clean_time = rmtime; + } else if (clean_time != rmtime) { + clean_time = 0; /* Give up */ + } } - } - } - if (clean_fallout_time != 0 && pterrain->_retire.clean_fallout_time != 0) { - if (clean_fallout_time < 0) { - clean_fallout_time = pterrain->_retire.clean_fallout_time; - } else { - if (clean_fallout_time != pterrain->_retire.clean_fallout_time) { - clean_fallout_time = 0; /* Give up */ + } extra_type_by_rmcause_iterate_end; + extra_type_by_rmcause_iterate(ERM_CLEANFALLOUT, pextra) { + int rmtime = pterrain->extra_removal_times[extra_index(pextra)]; + + if (rmtime != 0) { + if (clean_time < 0) { + clean_time = rmtime; + } else if (clean_time != rmtime) { + clean_time = 0; /* Give up */ + } } - } + } extra_type_by_rmcause_iterate_end; } + if (pillage_time != 0 && pterrain->pillage_time != 0) { if (pillage_time < 0) { pillage_time = pterrain->pillage_time; @@ -321,31 +328,6 @@ static bool insert_generated_text(char *outbuf, size_t outlen, const char *name) } } } extra_type_by_rmcause_iterate_end; - if (factor < 0) { - /* No extra has terrain-dependent clean time; use extra's time */ - if (time >= 0) { - clean_pollution_time = time; - } else { - clean_pollution_time = 0; - } - } else if (clean_pollution_time != 0) { - /* At least one extra's time depends on terrain */ - fc_assert(clean_pollution_time > 0); - if (time > 0 && factor > 0 && time != clean_pollution_time * factor) { - clean_pollution_time = 0; - } else if (time >= 0) { - clean_pollution_time = time; - } else if (factor >= 0) { - clean_pollution_time = clean_pollution_time * factor; - } else { - fc_assert(FALSE); - } - } - } - - { - int time = -1, factor = -1; - extra_type_by_rmcause_iterate(ERM_CLEANFALLOUT, pextra) { if (pextra->removal_time == 0) { if (factor < 0) { @@ -361,22 +343,24 @@ static bool insert_generated_text(char *outbuf, size_t outlen, const char *name) } } } extra_type_by_rmcause_iterate_end; + if (factor < 0) { /* No extra has terrain-dependent clean time; use extra's time */ if (time >= 0) { - clean_fallout_time = time; + clean_time = time; } else { - clean_fallout_time = 0; + clean_time = 0; } - } else if (clean_fallout_time != 0) { + } else if (clean_time != 0) { /* At least one extra's time depends on terrain */ - fc_assert(clean_fallout_time > 0); - if (time > 0 && factor > 0 && time != clean_fallout_time * factor) { - clean_fallout_time = 0; + fc_assert(clean_time > 0); + + if (time > 0 && factor > 0 && time != clean_time * factor) { + clean_time = 0; } else if (time >= 0) { - clean_fallout_time = time; + clean_time = time; } else if (factor >= 0) { - clean_fallout_time = clean_fallout_time * factor; + clean_time *= factor; } else { fc_assert(FALSE); } @@ -441,7 +425,7 @@ static bool insert_generated_text(char *outbuf, size_t outlen, const char *name) } extra_type_by_cause_iterate_end; } - if (clean_pollution_time > 0 || clean_fallout_time > 0 || pillage_time > 0 + if (clean_time > 0 || pillage_time > 0 || terrain_independent_extras) { CATLSTR(outbuf, outlen, "\n"); CATLSTR(outbuf, outlen, @@ -454,15 +438,15 @@ static bool insert_generated_text(char *outbuf, size_t outlen, const char *name) _("Activity Time\n")); CATLSTR(outbuf, outlen, "---------------------------"); - if (clean_pollution_time > 0) - cat_snprintf(outbuf, outlen, - _("\nClean pollution %3d"), clean_pollution_time); - if (clean_fallout_time > 0) - cat_snprintf(outbuf, outlen, - _("\nClean fallout %3d"), clean_fallout_time); - if (pillage_time > 0) - cat_snprintf(outbuf, outlen, - _("\nPillage %3d"), pillage_time); + if (clean_time > 0) { + cat_snprintf(outbuf, outlen, + _("\nClean %3d"), clean_time); + } + if (pillage_time > 0) { + cat_snprintf(outbuf, outlen, + _("\nPillage %3d"), pillage_time); + } + extra_type_by_cause_iterate(EC_ROAD, pextra) { if (pextra->buildable && pextra->build_time > 0) { const char *rname = extra_name_translation(pextra); @@ -475,6 +459,7 @@ static bool insert_generated_text(char *outbuf, size_t outlen, const char *name) pextra->build_time); } } extra_type_by_cause_iterate_end; + extra_type_by_cause_iterate(EC_BASE, pextra) { if (pextra->buildable && pextra->build_time > 0) { const char *bname = extra_name_translation(pextra); @@ -488,6 +473,7 @@ static bool insert_generated_text(char *outbuf, size_t outlen, const char *name) } } extra_type_by_cause_iterate_end; } + return TRUE; } else if (0 == strcmp(name, "VeteranLevels")) { return insert_veteran_help(outbuf, outlen, game.veteran, @@ -498,8 +484,8 @@ static bool insert_generated_text(char *outbuf, size_t outlen, const char *name) cat_snprintf(outbuf, outlen, /* TRANS: First %s is version string, e.g., - * "Freeciv version 2.3.0-beta1 (beta version)" (translated). - * Second %s is client_string, e.g., "gui-gtk-2.0". */ + * "Freeciv version 3.2.0-beta1 (beta version)" (translated). + * Second %s is client_string, e.g., "gui-gtk-4.0". */ _("This is %s, %s client."), ver, client_string); insert_client_build_info(outbuf, outlen); @@ -3848,26 +3834,12 @@ void helptext_extra(char *buf, size_t bufsz, struct player *pplayer, } else { terrain_type_iterate(pterrain) { int terr_clean_time = -1; + int rmtime = pterrain->extra_removal_times[extra_index(pextra)]; - if (is_extra_removed_by(pextra, ERM_CLEANPOLLUTION) - && pterrain->_retire.clean_pollution_time != 0) { - terr_clean_time = pterrain->_retire.clean_pollution_time - * pextra->removal_time_factor; - } - if (is_extra_removed_by(pextra, ERM_CLEANFALLOUT) - && pterrain->_retire.clean_fallout_time != 0) { - int terr_clean_fall_time = pterrain->_retire.clean_fallout_time - * pextra->removal_time_factor; - - if (terr_clean_time > 0 - && terr_clean_time != terr_clean_fall_time) { - /* Pollution/fallout cleaning activities taking different time - * on same terrain. Give up. */ - clean_time = -1; - break; - } - terr_clean_time = terr_clean_fall_time; + if (rmtime != 0) { + terr_clean_time = rmtime * pextra->removal_time_factor; } + if (clean_time < 0) { clean_time = terr_clean_time; } else if (clean_time != terr_clean_time) { @@ -3877,6 +3849,7 @@ void helptext_extra(char *buf, size_t bufsz, struct player *pplayer, } } terrain_type_iterate_end; } + if (clean_time < 0) { CATLSTR(buf, bufsz, _("Can be cleaned by units (time is terrain-dependent).\n")); diff --git a/client/packhand.c b/client/packhand.c index f10dd09ef5..3246df734f 100644 --- a/client/packhand.c +++ b/client/packhand.c @@ -4053,8 +4053,6 @@ void handle_ruleset_terrain(const struct packet_ruleset_terrain *p) pterrain->transform_time = p->transform_time; pterrain->placing_time = p->placing_time; pterrain->pillage_time = p->pillage_time; - pterrain->_retire.clean_pollution_time = p->clean_pollution_time; - pterrain->_retire.clean_fallout_time = p->clean_fallout_time; for (j = 0; j < p->extra_count; j++) { pterrain->extra_removal_times[j] = p->extra_removal_times[j]; diff --git a/common/actions.c b/common/actions.c index eca997bd65..986def6408 100644 --- a/common/actions.c +++ b/common/actions.c @@ -4334,12 +4334,12 @@ is_action_possible(const action_id wanted_action, actor->unit); } - if (pextra != NULL && pterrain->_retire.clean_pollution_time > 0 + if (pextra != NULL && pterrain->extra_removal_times[extra_index(pextra)] > 0 && can_remove_extra(pextra, actor->unit, target->tile)) { return TRI_YES; } - if (fextra != NULL && pterrain->_retire.clean_fallout_time > 0 + if (fextra != NULL && pterrain->extra_removal_times[extra_index(fextra)] > 0 && can_remove_extra(fextra, actor->unit, target->tile)) { return TRI_YES; } @@ -4352,9 +4352,6 @@ is_action_possible(const action_id wanted_action, const struct extra_type *pextra; pterrain = tile_terrain(target->tile); - if (pterrain->_retire.clean_pollution_time == 0) { - return TRI_NO; - } if (target_extra != NULL) { pextra = target_extra; @@ -4379,6 +4376,10 @@ is_action_possible(const action_id wanted_action, } } + if (pterrain->extra_removal_times[extra_index(pextra)] == 0) { + return TRI_NO; + } + if (can_remove_extra(pextra, actor->unit, target->tile)) { return TRI_YES; } @@ -4392,9 +4393,6 @@ is_action_possible(const action_id wanted_action, const struct extra_type *pextra; pterrain = tile_terrain(target->tile); - if (pterrain->_retire.clean_fallout_time == 0) { - return TRI_NO; - } if (target_extra != NULL) { pextra = target_extra; @@ -4419,6 +4417,10 @@ is_action_possible(const action_id wanted_action, } } + if (pterrain->extra_removal_times[extra_index(pextra)] == 0) { + return TRI_NO; + } + if (can_remove_extra(pextra, actor->unit, target->tile)) { return TRI_YES; } diff --git a/common/networking/packets.def b/common/networking/packets.def index 333e63fda3..2707289401 100644 --- a/common/networking/packets.def +++ b/common/networking/packets.def @@ -1714,8 +1714,6 @@ PACKET_RULESET_TERRAIN = 151; sc, lsend TERRAIN transform_result; UINT8 transform_time; UINT8 placing_time; - UINT8 clean_pollution_time; - UINT8 clean_fallout_time; UINT8 pillage_time; # extra_count = game.control.num_extra_types, but generated packets code does not diff --git a/common/terrain.c b/common/terrain.c index 355ccbccb3..5cdb19ee64 100644 --- a/common/terrain.c +++ b/common/terrain.c @@ -760,11 +760,9 @@ int terrain_extra_removal_time(const struct terrain *pterrain, /* Terrain and activity specific removal time */ switch (activity) { case ACTIVITY_CLEAN: - return pterrain->extra_removal_times[extra_index(tgt)] * factor; case ACTIVITY_POLLUTION: - return pterrain->_retire.clean_pollution_time * factor; case ACTIVITY_FALLOUT: - return pterrain->_retire.clean_fallout_time * factor; + return pterrain->extra_removal_times[extra_index(tgt)] * factor; case ACTIVITY_PILLAGE: return pterrain->pillage_time * factor; default: diff --git a/common/terrain.h b/common/terrain.h index 64e6a6152b..259252aaaa 100644 --- a/common/terrain.h +++ b/common/terrain.h @@ -231,12 +231,6 @@ struct terrain { struct terrain *transform_result; int transform_time; - - struct { - int clean_pollution_time; - int clean_fallout_time; - } _retire; - int pillage_time; /* Currently only clean times, but named for future */ diff --git a/data/alien/terrain.ruleset b/data/alien/terrain.ruleset index 3b01791646..25a35f9e28 100644 --- a/data/alien/terrain.ruleset +++ b/data/alien/terrain.ruleset @@ -149,10 +149,10 @@ ocean_resources = TRUE ; Default is 1. ; pillage_time = time to pillage extra from the tile (0 = impossible) ; Nonzero values only affect extras with removal_time 0. -; clean_pollution_time = time for 'clean pollution' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. -; clean_fallout_time = time for 'clean fallout' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. +; extra_settings = table of extra specific settings +; - "extra" - Name of the extra +; - "removal_time" - Time for cleaning activities (0 = impossible) +; Nonzero values only affect extras with removal_time 0. ; animal = unit type that can appear as animal on the terrain ; warmer_wetter_result = result of global warming for wet terrains; one of: ; "no" -- no change; doesn''t count for warming @@ -242,8 +242,6 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 0 -clean_pollution_time = 0 -clean_fallout_time = 0 animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -284,8 +282,11 @@ transform_result = "no" transform_time = 0 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -329,8 +330,11 @@ transform_result = "no" transform_time = 0 placing_time = 5 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -377,8 +381,11 @@ transform_result = "no" transform_time = 0 placing_time = 7 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -424,8 +431,11 @@ transform_result = "Grassland" transform_time = 40 placing_time = 6 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -468,8 +478,11 @@ transform_result = "no" transform_time = 0 placing_time = 12 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -513,8 +526,11 @@ transform_result = "no" transform_time = 0 placing_time = 1 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -557,8 +573,11 @@ transform_result = "no" transform_time = 0 placing_time = 1 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" diff --git a/data/civ1/terrain.ruleset b/data/civ1/terrain.ruleset index 269b01b2d8..d58575739f 100644 --- a/data/civ1/terrain.ruleset +++ b/data/civ1/terrain.ruleset @@ -143,10 +143,10 @@ igter_cost = 1 ; Default is 1. ; pillage_time = time to pillage extra from the tile (0 = impossible) ; Nonzero values only affect extras with removal_time 0. -; clean_pollution_time = time for 'clean pollution' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. -; clean_fallout_time = time for 'clean fallout' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. +; extra_settings = table of extra specific settings +; - "extra" - Name of the extra +; - "removal_time" - Time for cleaning activities (0 = impossible) +; Nonzero values only affect extras with removal_time 0. ; animal = unit type that can appear as animal on the terrain ; warmer_wetter_result = result of global warming for wet terrains; one of: ; "no" -- no change; does not count for warming @@ -235,6 +235,10 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -281,6 +285,10 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -325,6 +333,10 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "no" @@ -369,6 +381,10 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "Jungle" warmer_drier_result = "Desert" @@ -415,6 +431,10 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "Desert" @@ -458,6 +478,10 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -506,6 +530,10 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -549,6 +577,10 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -595,6 +627,10 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "Desert" @@ -639,6 +675,10 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "Desert" @@ -684,6 +724,10 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" diff --git a/data/civ2/terrain.ruleset b/data/civ2/terrain.ruleset index dda016acc9..fc62fccc49 100644 --- a/data/civ2/terrain.ruleset +++ b/data/civ2/terrain.ruleset @@ -143,10 +143,10 @@ pythagorean_diagonal = FALSE ; Default is 1. ; pillage_time = time to pillage extra from the tile (0 = impossible) ; Nonzero values only affect extras with removal_time 0. -; clean_pollution_time = time for 'clean pollution' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. -; clean_fallout_time = time for 'clean fallout' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. +; extra_settings = table of extra specific settings +; - "extra" - Name of the extra +; - "removal_time" - Time for cleaning activities (0 = impossible) +; Nonzero values only affect extras with removal_time 0. ; animal = unit type that can appear as animal on the terrain ; warmer_wetter_result = result of global warming for wet terrains; one of: ; "no" -- no change; does not count for warming @@ -235,6 +235,10 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -277,6 +281,10 @@ transform_result = "Tundra" transform_time = 24 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -321,6 +329,10 @@ transform_result = "Plains" transform_time = 24 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "no" @@ -366,6 +378,10 @@ transform_result = "Grassland" transform_time = 24 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "Jungle" warmer_drier_result = "Desert" @@ -412,6 +428,10 @@ transform_result = "Hills" transform_time = 24 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "Desert" @@ -455,6 +475,10 @@ transform_result = "Plains" transform_time = 24 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -499,6 +523,10 @@ transform_result = "Plains" transform_time = 24 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -544,6 +572,10 @@ transform_result = "Hills" transform_time = 24 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -587,6 +619,10 @@ transform_result = "Grassland" transform_time = 24 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "Desert" @@ -632,6 +668,10 @@ transform_result = "Plains" transform_time = 24 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "Desert" @@ -678,6 +718,10 @@ transform_result = "Desert" transform_time = 24 placing_time = 0 pillage_time = 1 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" diff --git a/data/civ2civ3/terrain.ruleset b/data/civ2civ3/terrain.ruleset index 1cc5b29be0..8f80ae7bcf 100644 --- a/data/civ2civ3/terrain.ruleset +++ b/data/civ2civ3/terrain.ruleset @@ -155,10 +155,10 @@ ocean_resources = FALSE ; Default is 1. ; pillage_time = time to pillage extra from the tile (0 = impossible) ; Nonzero values only affect extras with removal_time 0. -; clean_pollution_time = time for 'clean pollution' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. -; clean_fallout_time = time for 'clean fallout' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. +; extra_settings = table of extra specific settings +; - "extra" - Name of the extra +; - "removal_time" - Time for cleaning activities (0 = impossible) +; Nonzero values only affect extras with removal_time 0. ; animal = unit type that can appear as animal on the terrain ; warmer_wetter_result = result of global warming for wet terrains; one of: ; "no" -- no change; does not count for warming @@ -248,8 +248,6 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 0 -clean_pollution_time = 0 -clean_fallout_time = 0 animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -292,8 +290,11 @@ transform_result = "Grassland" transform_time = 36 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "no" @@ -338,8 +339,11 @@ transform_result = "Grassland" transform_time = 36 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -385,8 +389,11 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -432,8 +439,11 @@ transform_result = "Lake" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Tundra" @@ -480,8 +490,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "no" @@ -537,8 +550,11 @@ transform_result = "Hills" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Jungle" warmer_drier_result = "no" @@ -587,8 +603,11 @@ transform_result = "Lake" transform_time = 36 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "Swamp" @@ -634,8 +653,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -685,8 +707,11 @@ transform_result = "Forest" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -735,8 +760,11 @@ transform_result = "Hills" transform_time = 36 placing_time = 6 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -787,8 +815,11 @@ transform_result = "Lake" transform_time = 36 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "Desert" @@ -835,8 +866,11 @@ transform_result = "Grassland" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Desert" warmer_drier_result = "no" @@ -886,8 +920,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "Swamp" diff --git a/data/classic/terrain.ruleset b/data/classic/terrain.ruleset index d4e7ace6d8..47b23f8305 100644 --- a/data/classic/terrain.ruleset +++ b/data/classic/terrain.ruleset @@ -148,10 +148,10 @@ ocean_resources = FALSE ; Default is 1. ; pillage_time = time to pillage extra from the tile (0 = impossible) ; Nonzero values only affect extras with removal_time 0. -; clean_pollution_time = time for 'clean pollution' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. -; clean_fallout_time = time for 'clean fallout' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. +; extra_settings = table of extra specific settings +; - "extra" - Name of the extra +; - "removal_time" - Time for cleaning activities (0 = impossible) +; Nonzero values only affect extras with removal_time 0. ; animal = unit type that can appear as animal on the terrain ; warmer_wetter_result = result of global warming for wet terrains; one of: ; "no" -- no change; does not count for warming @@ -241,8 +241,6 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 0 -clean_pollution_time = 0 -clean_fallout_time = 0 animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -285,8 +283,11 @@ transform_result = "Swamp" transform_time = 36 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "Swamp" @@ -331,8 +332,11 @@ transform_result = "Swamp" transform_time = 36 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "Swamp" @@ -378,8 +382,11 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -425,8 +432,11 @@ transform_result = "Tundra" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Tundra" warmer_drier_result = "Tundra" @@ -475,8 +485,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Grassland" warmer_drier_result = "no" @@ -526,8 +539,11 @@ transform_result = "Grassland" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Jungle" warmer_drier_result = "Plains" @@ -576,8 +592,11 @@ transform_result = "Hills" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -623,8 +642,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -671,8 +693,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -720,8 +745,11 @@ transform_result = "Hills" transform_time = 24 placing_time = 6 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -767,8 +795,11 @@ transform_result = "Grassland" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -815,8 +846,11 @@ transform_result = "Lake" transform_time = 36 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -865,8 +899,11 @@ transform_result = "Desert" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" diff --git a/data/goldkeep/terrain.ruleset b/data/goldkeep/terrain.ruleset index 36d67a3ade..68f3284047 100644 --- a/data/goldkeep/terrain.ruleset +++ b/data/goldkeep/terrain.ruleset @@ -150,10 +150,10 @@ ocean_resources = FALSE ; Default is 1. ; pillage_time = time to pillage extra from the tile (0 = impossible) ; Nonzero values only affect extras with removal_time 0. -; clean_pollution_time = time for 'clean pollution' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. -; clean_fallout_time = time for 'clean fallout' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. +; extra_settings = table of extra specific settings +; - "extra" - Name of the extra +; - "removal_time" - Time for cleaning activities (0 = impossible) +; Nonzero values only affect extras with removal_time 0. ; animal = unit type that can appear as animal on the terrain ; warmer_wetter_result = result of global warming for wet terrains; one of: ; "no" -- no change; does not count for warming @@ -243,8 +243,6 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 0 -clean_pollution_time = 0 -clean_fallout_time = 0 animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -285,8 +283,11 @@ transform_result = "Swamp" transform_time = 36 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "Swamp" @@ -329,8 +330,11 @@ transform_result = "Swamp" transform_time = 36 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "Swamp" @@ -374,8 +378,11 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -419,8 +426,11 @@ transform_result = "Tundra" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Tundra" warmer_drier_result = "Tundra" @@ -467,8 +477,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Grassland" warmer_drier_result = "no" @@ -516,8 +529,11 @@ transform_result = "Grassland" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Jungle" warmer_drier_result = "Plains" @@ -564,8 +580,11 @@ transform_result = "Hills" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -609,8 +628,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -655,8 +677,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -702,8 +727,11 @@ transform_result = "Hills" transform_time = 24 placing_time = 6 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -747,8 +775,11 @@ transform_result = "Grassland" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -793,8 +824,11 @@ transform_result = "Lake" transform_time = 36 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -841,8 +875,11 @@ transform_result = "Desert" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" diff --git a/data/granularity/terrain.ruleset b/data/granularity/terrain.ruleset index 38a6276aac..882c561a46 100644 --- a/data/granularity/terrain.ruleset +++ b/data/granularity/terrain.ruleset @@ -145,10 +145,10 @@ ocean_resources = FALSE ; Default is 1. ; pillage_time = time to pillage extra from the tile (0 = impossible) ; Nonzero values only affect extras with removal_time 0. -; clean_pollution_time = time for 'clean pollution' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. -; clean_fallout_time = time for 'clean fallout' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. +; extra_settings = table of extra specific settings +; - "extra" - Name of the extra +; - "removal_time" - Time for cleaning activities (0 = impossible) +; Nonzero values only affect extras with removal_time 0. ; animal = unit type that can appear as animal on the terrain ; warmer_wetter_result = result of global warming for wet terrains; one of: ; "no" -- no change; doesn''t count for warming @@ -237,8 +237,9 @@ transform_result = "no" transform_time = 0 placing_time = 1 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -284,8 +285,9 @@ transform_result = "no" transform_time = 0 placing_time = 1 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -332,8 +334,9 @@ transform_result = "Grassland" transform_time = 24 placing_time = 1 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -380,8 +383,9 @@ transform_result = "no" transform_time = 0 placing_time = 1 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" diff --git a/data/multiplayer/terrain.ruleset b/data/multiplayer/terrain.ruleset index 32a7278d07..bb039bc9d9 100644 --- a/data/multiplayer/terrain.ruleset +++ b/data/multiplayer/terrain.ruleset @@ -148,10 +148,10 @@ ocean_resources = FALSE ; Default is 1. ; pillage_time = time to pillage extra from the tile (0 = impossible) ; Nonzero values only affect extras with removal_time 0. -; clean_pollution_time = time for 'clean pollution' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. -; clean_fallout_time = time for 'clean fallout' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. +; extra_settings = table of extra specific settings +; - "extra" - Name of the extra +; - "removal_time" - Time for cleaning activities (0 = impossible) +; Nonzero values only affect extras with removal_time 0. ; animal = unit type that can appear as animal on the terrain ; warmer_wetter_result = result of global warming for wet terrains; one of: ; "no" -- no change; does not count for warming @@ -241,8 +241,6 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 0 -clean_pollution_time = 0 -clean_fallout_time = 0 animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -283,8 +281,11 @@ transform_result = "Swamp" transform_time = 36 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "Swamp" @@ -327,8 +328,11 @@ transform_result = "Swamp" transform_time = 36 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "Swamp" @@ -372,8 +376,11 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -417,8 +424,11 @@ transform_result = "Tundra" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Tundra" warmer_drier_result = "Tundra" @@ -465,8 +475,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Grassland" warmer_drier_result = "no" @@ -514,8 +527,11 @@ transform_result = "Grassland" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Jungle" warmer_drier_result = "Plains" @@ -562,8 +578,11 @@ transform_result = "Hills" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -607,8 +626,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -653,8 +675,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -700,8 +725,11 @@ transform_result = "Hills" transform_time = 24 placing_time = 6 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -745,8 +773,11 @@ transform_result = "Grassland" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -791,8 +822,11 @@ transform_result = "Lake" transform_time = 36 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -839,8 +873,11 @@ transform_result = "Desert" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" diff --git a/data/ruledit/comments-3.2.txt b/data/ruledit/comments-3.2.txt index 9f8c6ec05e..20b39357cb 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -631,10 +631,10 @@ terrains = "\ ; Default is 1.\n\ ; pillage_time = time to pillage extra from the tile (0 = impossible)\n\ ; Nonzero values only affect extras with removal_time 0.\n\ -; clean_pollution_time = time to clean pollution (0 = impossible)\n\ -; Nonzero values only affect extras with removal_time 0.\n\ -; clean_fallout_time = time to clean fallout (0 = impossible)\n\ -; Nonzero values only affect extras with removal_time 0.\n\ +; extra_settings = table of extra specific settings\n\ +; - \"extra\" - Name of the extra\n\ +; - \"removal_time\" - Time for cleaning activities (0 = impossible)\n\ +; Nonzero values only affect extras with removal_time 0.\n\ ; animal = unit type that can appear as animal on the terrain\n\ ; warmer_wetter_result = result of global warming for wet terrains; one of:\n\ ; \"no\" -- no change; does not count for warming\n\ diff --git a/data/sandbox/terrain.ruleset b/data/sandbox/terrain.ruleset index d8d688ccf2..29bb5bd776 100644 --- a/data/sandbox/terrain.ruleset +++ b/data/sandbox/terrain.ruleset @@ -156,10 +156,10 @@ ocean_resources = FALSE ; Default is 1. ; pillage_time = time to pillage extra from the tile (0 = impossible) ; Nonzero values only affect extras with removal_time 0. -; clean_pollution_time = time for 'clean pollution' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. -; clean_fallout_time = time for 'clean fallout' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. +; extra_settings = table of extra specific settings +; - "extra" - Name of the extra +; - "removal_time" - Time for cleaning activities (0 = impossible) +; Nonzero values only affect extras with removal_time 0. ; animal = unit type that can appear as animal on the terrain ; warmer_wetter_result = result of global warming for wet terrains; one of: ; "no" -- no change; does not count for warming @@ -249,8 +249,6 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 0 -clean_pollution_time = 0 -clean_fallout_time = 0 animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -293,8 +291,11 @@ transform_result = "Grassland" transform_time = 36 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "no" @@ -339,8 +340,11 @@ transform_result = "Grassland" transform_time = 36 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -386,8 +390,11 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -433,8 +440,11 @@ transform_result = "Lake" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Tundra" @@ -481,8 +491,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "no" @@ -538,8 +551,11 @@ transform_result = "Hills" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Jungle" warmer_drier_result = "no" @@ -588,8 +604,11 @@ transform_result = "Lake" transform_time = 36 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "Swamp" @@ -635,8 +654,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -686,8 +708,11 @@ transform_result = "Forest" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -736,8 +761,11 @@ transform_result = "Hills" transform_time = 36 placing_time = 6 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -788,8 +816,11 @@ transform_result = "Lake" transform_time = 36 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "Desert" @@ -836,8 +867,11 @@ transform_result = "Grassland" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Desert" warmer_drier_result = "no" @@ -887,8 +921,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Swamp" warmer_drier_result = "Swamp" diff --git a/data/stub/terrain.ruleset b/data/stub/terrain.ruleset index ba6ad04384..06a84d99e9 100644 --- a/data/stub/terrain.ruleset +++ b/data/stub/terrain.ruleset @@ -136,10 +136,10 @@ ocean_resources = FALSE ; Default is 1. ; pillage_time = time to pillage extra from the tile (0 = impossible) ; Nonzero values only affect extras with removal_time 0. -; clean_pollution_time = time for 'clean pollution' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. -; clean_fallout_time = time for 'clean fallout' activity (0 = impossible) -; Nonzero values only affect extras with removal_time 0. +; extra_settings = table of extra specific settings +; - "extra" - Name of the extra +; - "removal_time" - Time for cleaning activities (0 = impossible) +; Nonzero values only affect extras with removal_time 0. ; animal = unit type that can appear as animal on the terrain ; warmer_wetter_result = result of global warming for wet terrains; one of: ; "no" -- no change; doesn''t count for warming @@ -228,8 +228,9 @@ transform_result = "no" transform_time = 0 placing_time = 1 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -275,8 +276,9 @@ transform_result = "no" transform_time = 0 placing_time = 1 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" diff --git a/data/webperimental/terrain.ruleset b/data/webperimental/terrain.ruleset index d488550736..b2bd8184ba 100644 --- a/data/webperimental/terrain.ruleset +++ b/data/webperimental/terrain.ruleset @@ -148,10 +148,10 @@ ocean_resources = FALSE ; Default is 1. ; pillage_time = time to pillage extra from the tile (0 = impossible) ; Nonzero values only affect extras with removal_time 0. -; clean_pollution_time = time to clean pollution (0 = impossible) -; Nonzero values only affect extras with removal_time 0. -; clean_fallout_time = time to clean fallout (0 = impossible) -; Nonzero values only affect extras with removal_time 0. +; extra_settings = table of extra specific settings +; - "extra" - Name of the extra +; - "removal_time" - Time for cleaning activities (0 = impossible) +; Nonzero values only affect extras with removal_time 0. ; animal = unit type that can appear as animal on the terrain ; warmer_wetter_result = result of global warming for wet terrains; one of: ; "no" -- no change; does not count for warming @@ -241,8 +241,6 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 0 -clean_pollution_time = 0 -clean_fallout_time = 0 animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -285,8 +283,11 @@ transform_result = "Swamp" transform_time = 36 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "Swamp" @@ -331,8 +332,11 @@ transform_result = "Swamp" transform_time = 36 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "Swamp" @@ -378,8 +382,11 @@ transform_result = "no" transform_time = 0 placing_time = 0 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -425,8 +432,11 @@ transform_result = "Tundra" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Tundra" warmer_drier_result = "Tundra" @@ -475,8 +485,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Grassland" warmer_drier_result = "no" @@ -526,8 +539,11 @@ transform_result = "Grassland" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Jungle" warmer_drier_result = "Plains" @@ -576,8 +592,11 @@ transform_result = "Hills" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -623,8 +642,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -671,8 +693,11 @@ transform_result = "Plains" transform_time = 24 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -720,8 +745,11 @@ transform_result = "Hills" transform_time = 24 placing_time = 6 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "no" warmer_drier_result = "no" @@ -767,8 +795,11 @@ transform_result = "Grassland" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -815,8 +846,11 @@ transform_result = "Lake" transform_time = 36 placing_time = 4 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" @@ -865,8 +899,11 @@ transform_result = "Desert" transform_time = 24 placing_time = 2 pillage_time = 1 -clean_pollution_time = 3 -clean_fallout_time = 3 +extra_settings = + { "extra", "removal_time" + "Pollution", 3 + "Fallout", 3 + } animal = "None" warmer_wetter_result = "Lake" warmer_drier_result = "Desert" diff --git a/server/rscompat.c b/server/rscompat.c index 20764b0de9..576e3109fa 100644 --- a/server/rscompat.c +++ b/server/rscompat.c @@ -546,6 +546,8 @@ int add_user_extra_flags_3_2(int start) { int i = 0; + /* TODO: Do we need "CleanAsPollution", or can we treat + * it as the default while "CleanAsFallout" is special case? */ set_user_extra_flag_name(EF_USER_FLAG_1 + start + i++, "CleanAsPollution", NULL); set_user_extra_flag_name(EF_USER_FLAG_1 + start + i++, @@ -572,12 +574,17 @@ void rscompat_extra_adjust_3_2(struct extra_type *pextra) "-980")); } - if (is_extra_removed_by(pextra, ERM_CLEANPOLLUTION)) { + /* Don't give these flags to extras that have been using + * removal time not tied to terrain, so it won't get + * overridden by "ActivityTime" effects we also add. */ + if (is_extra_removed_by(pextra, ERM_CLEANPOLLUTION) + && pextra->removal_time == 0) { BV_SET(pextra->flags, extra_flag_id_by_name("CleanAsPollution", fc_strcasecmp)); } - if (is_extra_removed_by(pextra, ERM_CLEANFALLOUT)) { + if (is_extra_removed_by(pextra, ERM_CLEANFALLOUT) + && pextra->removal_time == 0) { BV_SET(pextra->flags, extra_flag_id_by_name("CleanAsFallout", fc_strcasecmp)); } @@ -673,3 +680,43 @@ void rscompat_settings_do_special_handling(struct section_file *file, } } } + +/**********************************************************************//** + Migrate pollution and fallout time to extra specific removal times. +**************************************************************************/ +bool rscompat_terrain_extra_rmtime_3_2(struct section_file *file, + const char *tsection, + struct terrain *pterrain) +{ + int pol_time = 3; /* Old default */ + int fal_time = 3; /* Old default */ + const char *filename = secfile_name(file); + bool ok = TRUE; + + lookup_time(file, &pol_time, + tsection, "clean_pollution_time", filename, NULL, &ok); + lookup_time(file, &fal_time, + tsection, "clean_fallout_time", filename, NULL, &ok); + + if (pol_time == fal_time) { + extra_type_iterate(pextra) { + pterrain->extra_removal_times[extra_index(pextra)] = pol_time; + } extra_type_iterate_end; + } else { + struct effect *peffect; + + extra_type_iterate(pextra) { + pterrain->extra_removal_times[extra_index(pextra)] = pol_time; + } extra_type_iterate_end; + + peffect = effect_new(EFT_ACTIVITY_TIME, fal_time, NULL); + effect_req_append(peffect, req_from_str("ExtraFlag", "Local", + FALSE, TRUE, TRUE, + "CleanAsFallout")); + effect_req_append(peffect, req_from_str("Terrain", "Tile", + FALSE, TRUE, TRUE, + terrain_rule_name(pterrain))); + } + + return ok; +} diff --git a/server/rscompat.h b/server/rscompat.h index 1cbb0acf16..ac23da00cb 100644 --- a/server/rscompat.h +++ b/server/rscompat.h @@ -71,6 +71,16 @@ void rscompat_extra_adjust_3_2(struct extra_type *pextra); bool rscompat_setting_needs_special_handling(const char *name); void rscompat_settings_do_special_handling(struct section_file *file, const char *section, void (*setdef)(struct setting *pset)); +bool rscompat_terrain_extra_rmtime_3_2(struct section_file *file, + const char *tsection, + struct terrain *pterrain); + +/* In ruleset.c, but should not be in public interface - make static again once + * rscompat.c no longer needs. */ +bool lookup_time(const struct section_file *secfile, int *turns, + const char *sec_name, const char *property_name, + const char *filename, const char *item_name, + bool *ok); #ifdef __cplusplus } diff --git a/server/ruleset.c b/server/ruleset.c index 5ef778138c..0ee1f3f8e8 100644 --- a/server/ruleset.c +++ b/server/ruleset.c @@ -1261,10 +1261,10 @@ static bool lookup_terrain(struct section_file *file, Returns FALSE if not found in secfile, but TRUE even if validation failed. Sets *ok to FALSE if validation failed, leaves it alone otherwise. **************************************************************************/ -static bool lookup_time(const struct section_file *secfile, int *turns, - const char *sec_name, const char *property_name, - const char *filename, const char *item_name, - bool *ok) +bool lookup_time(const struct section_file *secfile, int *turns, + const char *sec_name, const char *property_name, + const char *filename, const char *item_name, + bool *ok) { /* Assumes that PACKET_UNIT_INFO.activity_count in packets.def is UINT16 */ const int max_turns = 65535 / ACTIVITY_FACTOR; @@ -3281,6 +3281,7 @@ static bool load_ruleset_terrain(struct section_file *file, const int i = terrain_index(pterrain); const char *tsection = &terrain_sections[i * MAX_SECTION_LABEL]; const char *cstr; + const char *ename; sz_strlcpy(pterrain->graphic_str, secfile_lookup_str(file, "%s.graphic", tsection)); @@ -3520,12 +3521,6 @@ static bool load_ruleset_terrain(struct section_file *file, pterrain->pillage_time = 1; /* Default */ lookup_time(file, &pterrain->pillage_time, tsection, "pillage_time", filename, NULL, &ok); - pterrain->_retire.clean_pollution_time = 3; /* Default */ - lookup_time(file, &pterrain->_retire.clean_pollution_time, - tsection, "clean_pollution_time", filename, NULL, &ok); - pterrain->_retire.clean_fallout_time = 3; /* Default */ - lookup_time(file, &pterrain->_retire.clean_fallout_time, - tsection, "clean_fallout_time", filename, NULL, &ok); if (!lookup_terrain(file, "warmer_wetter_result", filename, pterrain, &pterrain->warmer_wetter_result, TRUE) @@ -3539,24 +3534,61 @@ static bool load_ruleset_terrain(struct section_file *file, break; } - slist = secfile_lookup_str_vec(file, &nval, "%s.flags", tsection); - BV_CLR_ALL(pterrain->flags); - for (j = 0; j < nval; j++) { - const char *sval = slist[j]; - enum terrain_flag_id flag - = terrain_flag_id_by_name(sval, fc_strcasecmp); + /* Set default removal times */ + extra_type_iterate(pextra) { + pterrain->extra_removal_times[extra_index(pextra)] = 0; + } extra_type_iterate_end; - if (!terrain_flag_id_is_valid(flag)) { - ruleset_error(NULL, LOG_ERROR, - "\"%s\" [%s] has unknown flag \"%s\".", - filename, tsection, sval); + if (compat->compat_mode && compat->version < RSFORMAT_3_2) { + if (!rscompat_terrain_extra_rmtime_3_2(file, tsection, pterrain)) { ok = FALSE; break; + } + } + + for (j = 0; (ename = secfile_lookup_str_default(file, NULL, + "%s.extra_settings%d.extra", + tsection, j)); j++) { + const struct extra_type *pextra = extra_type_by_rule_name(ename); + + if (pextra != NULL) { + char time_sections[512]; + + fc_snprintf(time_sections, sizeof(time_sections), + "%s.extra_settings%d", tsection, j); + + lookup_time(file, &pterrain->extra_removal_times[extra_index(pextra)], + time_sections, "removal_time", filename, NULL, &ok); } else { - BV_SET(pterrain->flags, flag); + ruleset_error(NULL, LOG_ERROR, + "\"%s\" [%s] has settings for unknown extra \"%s\".", + filename, tsection, ename); + ok = FALSE; + break; } } - free(slist); + + if (ok) { + slist = secfile_lookup_str_vec(file, &nval, "%s.flags", tsection); + BV_CLR_ALL(pterrain->flags); + for (j = 0; j < nval; j++) { + const char *sval = slist[j]; + enum terrain_flag_id flag + = terrain_flag_id_by_name(sval, fc_strcasecmp); + + if (!terrain_flag_id_is_valid(flag)) { + ruleset_error(NULL, LOG_ERROR, + "\"%s\" [%s] has unknown flag \"%s\".", + filename, tsection, sval); + ok = FALSE; + break; + } else { + BV_SET(pterrain->flags, flag); + } + } + + free(slist); + } if (!ok) { break; @@ -3697,22 +3729,6 @@ static bool load_ruleset_terrain(struct section_file *file, } else { pextra->rmcauses |= (1 << rmcause); extra_to_removed_by_list(pextra, rmcause); - - terrain_type_iterate(pterr) { - int cleantime = 0; - - if (rmcause == ERM_CLEANPOLLUTION) { - cleantime = pterr->_retire.clean_pollution_time; - } else if (rmcause == ERM_CLEANFALLOUT) { - cleantime = pterr->_retire.clean_fallout_time; - } - - if (cleantime > 0 - && (pterr->extra_removal_times[eidx] == 0 - || cleantime < pterr->extra_removal_times[eidx])) { - pterr->extra_removal_times[eidx] = cleantime; - } - } terrain_type_iterate_end; } } @@ -8465,8 +8481,6 @@ static void send_ruleset_terrain(struct conn_list *dest) packet.placing_time = pterrain->placing_time; packet.pillage_time = pterrain->pillage_time; packet.transform_time = pterrain->transform_time; - packet.clean_pollution_time = pterrain->_retire.clean_pollution_time; - packet.clean_fallout_time = pterrain->_retire.clean_fallout_time; packet.extra_count = game.control.num_extra_types; for (i = 0; i < game.control.num_extra_types; i++) { diff --git a/tools/civmanual.c b/tools/civmanual.c index dac8fa806d..621cc20420 100644 --- a/tools/civmanual.c +++ b/tools/civmanual.c @@ -462,8 +462,6 @@ static bool manual_command(struct tag_types *tag_info) _("Irrigation"), _("Cultivate"), _("Mining"), _("Plant"), _("Transform"), /* xgettext:no-c-format */ _("% of Road bonus"), _("turns")); - fprintf(doc, "%s
%s", - _("Clean pollution"), _("Clean fallout")); ri = 0; if (game.control.num_road_types > 0) { fprintf(doc, ""); @@ -557,10 +555,6 @@ static bool manual_command(struct tag_types *tag_info) pterrain->road_output_incr_pct[O_SHIELD], pterrain->road_output_incr_pct[O_TRADE]); - fprintf(doc, "%d / %d", - pterrain->_retire.clean_pollution_time, - pterrain->_retire.clean_fallout_time); - ri = 0; if (game.control.num_road_types > 0) { fprintf(doc, ""); diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index 2ad4d48290..dadf70427c 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -2623,10 +2623,20 @@ static bool save_terrain_ruleset(const char *filename, const char *name) "%s.placing_time", path); secfile_insert_int(sfile, pterr->pillage_time, "%s.pillage_time", path); - secfile_insert_int(sfile, pterr->_retire.clean_pollution_time, - "%s.clean_pollution_time", path); - secfile_insert_int(sfile, pterr->_retire.clean_fallout_time, - "%s.clean_fallout_time", path); + + i = 0; + extra_type_iterate(pextra) { + int rmtime = pterr->extra_removal_times[extra_index(pextra)]; + + if (rmtime != 0) { + secfile_insert_str(sfile, extra_rule_name(pextra), + "%s.extra_settings%d.extra", + path, i); + secfile_insert_int(sfile, rmtime, + "%s.extra_settings%d.removal_time", + path, i++); + } + } extra_type_iterate_end; save_terrain_ref(sfile, pterr->warmer_wetter_result, pterr, path, "warmer_wetter_result"); -- 2.39.0