Widen station type field in map array

This commit is contained in:
Jonathan G Rennison
2022-01-24 22:34:34 +00:00
parent fcc581fba9
commit ace75f6864
6 changed files with 16 additions and 5 deletions

View File

@@ -1050,6 +1050,15 @@ bool AfterLoadGame()
}
}
if (SlXvIsFeatureMissing(XSLFI_MORE_STATION_TYPES)) {
/* Expansion of station type field in m6 */
for (TileIndex t = 0; t < MapSize(); t++) {
if (IsTileType(t, MP_STATION)) {
ClrBit(_me[t].m6, 6);
}
}
}
for (TileIndex t = 0; t < map_size; t++) {
switch (GetTileType(t)) {
case MP_STATION: {

View File

@@ -166,6 +166,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
{ XSLFI_ST_INDUSTRY_CARGO_MODE, XSCF_IGNORABLE_UNKNOWN, 1, 1, "st_industry_cargo_mode", nullptr, nullptr, nullptr },
{ XSLFI_TL_SPEED_LIMIT, XSCF_IGNORABLE_UNKNOWN, 1, 1, "tl_speed_limit", nullptr, nullptr, nullptr },
{ XSLFI_WAYPOINT_FLAGS, XSCF_NULL, 1, 1, "waypoint_flags", nullptr, nullptr, nullptr },
{ XSLFI_MORE_STATION_TYPES, XSCF_NULL, 1, 1, "more_station_types", nullptr, nullptr, nullptr },
{ XSLFI_SCRIPT_INT64, XSCF_NULL, 1, 1, "script_int64", nullptr, nullptr, nullptr },
{ XSLFI_NULL, XSCF_NULL, 0, 0, nullptr, nullptr, nullptr, nullptr },// This is the end marker
};

View File

@@ -120,6 +120,7 @@ enum SlXvFeatureIndex {
XSLFI_ST_INDUSTRY_CARGO_MODE, ///< Station industry cargo mode setting
XSLFI_TL_SPEED_LIMIT, ///< Through load maximum speed setting
XSLFI_WAYPOINT_FLAGS, ///< Waypoint flags
XSLFI_MORE_STATION_TYPES, ///< More station types (field widening)
XSLFI_SCRIPT_INT64, ///< See: SLV_SCRIPT_INT64

View File

@@ -44,7 +44,7 @@ static const int GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET = 4; ///< The offset for the
static inline StationType GetStationType(TileIndex t)
{
assert_tile(IsTileType(t, MP_STATION), t);
return (StationType)GB(_me[t].m6, 3, 3);
return (StationType)GB(_me[t].m6, 3, 4);
}
/**
@@ -563,7 +563,7 @@ static inline void MakeStation(TileIndex t, Owner o, StationID sid, StationType
_m[t].m4 = 0;
_m[t].m5 = section;
SB(_me[t].m6, 2, 1, 0);
SB(_me[t].m6, 3, 3, st);
SB(_me[t].m6, 3, 4, st);
_me[t].m7 = 0;
_me[t].m8 = 0;
}