Change: Store station blocked/wires/pylons flags in map.
This stores three flags in unused map bits, and avoids having to look up station graphics and custom station specs to determine blocked/wires/pylons status. This potentially affects rail pathfinding performance. Savegame version is not bumped, as the flags can just be updated every time. (cherry picked from commit cb658e6cc6e1c114c1eaafaaa5b14849f04ca083)
This commit is contained in:

committed by
Jonathan G Rennison

parent
e162e7a331
commit
b2a1ec96f1
@@ -317,6 +317,18 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
|
||||
MakeRailWaypoint(tile, wp->owner, wp->index, axis, layout_ptr[i], GetRailType(tile));
|
||||
if (old_specindex != map_spec_index) DeallocateSpecFromStation(wp, old_specindex);
|
||||
SetCustomStationSpecIndex(tile, map_spec_index);
|
||||
|
||||
/* Should be the same as layout but axis component could be wrong... */
|
||||
StationGfx gfx = GetStationGfx(tile);
|
||||
bool blocked = spec != nullptr && HasBit(spec->blocked, gfx);
|
||||
/* Default stations do not draw pylons under roofs (gfx >= 4) */
|
||||
bool pylons = spec != nullptr ? HasBit(spec->pylons, gfx) : gfx < 4;
|
||||
bool wires = spec == nullptr || !HasBit(spec->wires, gfx);
|
||||
|
||||
SetStationTileBlocked(tile, blocked);
|
||||
SetStationTileHavePylons(tile, pylons);
|
||||
SetStationTileHaveWires(tile, wires);
|
||||
|
||||
SetRailStationReservation(tile, reserved);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
|
||||
|
Reference in New Issue
Block a user