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:

committed by
Jonathan G Rennison

parent
59677d5c6f
commit
5cc56d6ad9
@@ -116,7 +116,7 @@ static inline bool IsRailDepotTile(TileIndex t)
|
||||
*/
|
||||
static inline RailType GetRailType(TileIndex t)
|
||||
{
|
||||
return (RailType)GB(_m[t].m3, 0, 4);
|
||||
return (RailType)((GB(_m[t].m1, 7, 1) << 4) | GB(_m[t].m3, 0, 4));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,7 +126,8 @@ static inline RailType GetRailType(TileIndex t)
|
||||
*/
|
||||
static inline void SetRailType(TileIndex t, RailType r)
|
||||
{
|
||||
SB(_m[t].m3, 0, 4, r);
|
||||
SB(_m[t].m1, 7, 1, GB(r, 4, 1));
|
||||
SB(_m[t].m3, 0, 4, GB(r, 0, 4));
|
||||
}
|
||||
|
||||
|
||||
@@ -554,7 +555,8 @@ static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r)
|
||||
SetTileType(t, MP_RAILWAY);
|
||||
SetTileOwner(t, o);
|
||||
_m[t].m2 = 0;
|
||||
_m[t].m3 = r;
|
||||
_m[t].m3 = 0;
|
||||
SetRailType(t, r);
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = RAIL_TILE_NORMAL << 6 | b;
|
||||
SB(_me[t].m6, 2, 4, 0);
|
||||
@@ -567,7 +569,8 @@ static inline void MakeRailDepot(TileIndex t, Owner o, DepotID did, DiagDirectio
|
||||
SetTileType(t, MP_RAILWAY);
|
||||
SetTileOwner(t, o);
|
||||
_m[t].m2 = did;
|
||||
_m[t].m3 = r;
|
||||
_m[t].m3 = 0;
|
||||
SetRailType(t, r);
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = RAIL_TILE_DEPOT << 6 | d;
|
||||
SB(_me[t].m6, 2, 4, 0);
|
||||
|
Reference in New Issue
Block a user