Add setting to enable multiple churches/stadiums in scenario editor

See: #177
This commit is contained in:
Jonathan G Rennison
2020-08-03 18:46:52 +01:00
parent 3dfbeb07f6
commit b7118b60fe
10 changed files with 37 additions and 11 deletions

View File

@@ -3773,6 +3773,13 @@ bool AfterLoadGame()
_settings_game.game_creation.generation_unique_id = _interactive_random.Next(UINT32_MAX-1) + 1; /* Generates between [1;UINT32_MAX] */
}
if (SlXvIsFeatureMissing(XSLFI_TOWN_MULTI_BUILDING)) {
for (Town *t : Town::Iterate()) {
t->church_count = HasBit(t->flags, 1) ? 1 : 0;
t->stadium_count = HasBit(t->flags, 2) ? 1 : 0;
}
}
/* This needs to be done after conversion. */
RebuildViewportKdtree();
ViewportMapBuildTunnelCache();

View File

@@ -124,6 +124,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
{ XSLFI_STATION_GOODS_EXTRA, XSCF_NULL, 1, 1, "station_goods_extra", nullptr, nullptr, nullptr },
{ XSLFI_DOCKING_CACHE_VER, XSCF_IGNORABLE_ALL, 1, 1, "docking_cache_ver", nullptr, nullptr, nullptr },
{ XSLFI_EXTRA_CHEATS, XSCF_NULL, 1, 1, "extra_cheats", nullptr, nullptr, "CHTX" },
{ XSLFI_TOWN_MULTI_BUILDING, XSCF_NULL, 1, 1, "town_multi_building", nullptr, nullptr, nullptr },
{ XSLFI_NULL, XSCF_NULL, 0, 0, nullptr, nullptr, nullptr, nullptr },// This is the end marker
};

View File

@@ -81,6 +81,7 @@ enum SlXvFeatureIndex {
XSLFI_STATION_GOODS_EXTRA, ///< Extra station goods entry statuses
XSLFI_DOCKING_CACHE_VER, ///< Multiple docks - docking tile cache version
XSLFI_EXTRA_CHEATS, ///< Extra cheats
XSLFI_TOWN_MULTI_BUILDING, ///< Allow multiple stadium/church buildings in a single town
XSLFI_RIFF_HEADER_60_BIT, ///< Size field in RIFF chunk header is 60 bit
XSLFI_HEIGHT_8_BIT, ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk

View File

@@ -130,6 +130,7 @@ static const SaveLoad _town_desc[] = {
SLE_CONDSTR(Town, name, SLE_STR | SLF_ALLOW_CONTROL, 0, SLV_84, SL_MAX_VERSION),
SLE_VAR(Town, flags, SLE_UINT8),
SLE_CONDVAR_X(Town, church_count, SLE_UINT8, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_SPRINGPP)),
SLE_CONDVAR(Town, statues, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_104),
SLE_CONDVAR(Town, statues, SLE_UINT16, SLV_104, SL_MAX_VERSION),