Make 32 instead of 16 rail types possible. by using one free bit of m1 in the map array.

(cherry picked from commit b44843800880cdc186f5183301ee0f42afbb5f84)

Also set non-rail type M3 bits to 0 where applicable.
Change savegame versioning to SLXI format.
This commit is contained in:
keldorkatarn
2016-04-01 21:27:19 +02:00
committed by Jonathan G Rennison
parent 59677d5c6f
commit 5cc56d6ad9
15 changed files with 90 additions and 59 deletions

View File

@@ -3213,6 +3213,19 @@ bool AfterLoadGame()
FOR_ALL_VEHICLES(v) v->profit_lifetime = 0;
}
// Before this version we didn't store the 5th bit of the tracktype here.
// So set it to 0 just in case there was garbage in there.
if (SlXvIsFeatureMissing(XSLFI_MORE_RAIL_TYPES)) {
for (TileIndex t = 0; t < map_size; t++) {
if (_m[t].type == MP_RAILWAY ||
_m[t].type == MP_ROAD ||
_m[t].type == MP_STATION ||
_m[t].type == MP_TUNNELBRIDGE) {
SB(_m[t].m1, 7, 1, 0);
}
}
}
/* Road stops is 'only' updating some caches */
AfterLoadRoadStops();
AfterLoadLabelMaps();

View File

@@ -69,6 +69,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
{ XSLFI_VEH_LIFETIME_PROFIT, XSCF_NULL, 1, 1, "veh_lifetime_profit", NULL, NULL, NULL },
{ XSLFI_LINKGRAPH_DAY_SCALE, XSCF_NULL, 1, 1, "linkgraph_day_scale", NULL, NULL, NULL },
{ XSLFI_TEMPLATE_REPLACEMENT, XSCF_NULL, 1, 1, "template_replacement", NULL, NULL, "TRPL,TMPL" },
{ XSLFI_MORE_RAIL_TYPES, XSCF_NULL, 1, 1, "more_rail_types", NULL, NULL, NULL },
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
};

View File

@@ -43,6 +43,7 @@ enum SlXvFeatureIndex {
XSLFI_VEH_LIFETIME_PROFIT, ///< Vehicle lifetime profit patch
XSLFI_LINKGRAPH_DAY_SCALE, ///< Linkgraph job duration & interval may be in non-scaled days
XSLFI_TEMPLATE_REPLACEMENT, ///< Template-based train replacement
XSLFI_MORE_RAIL_TYPES, ///< Increased number of rail types
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