1
0
Fork 0

Change: Allow all tiles around docks to be docking tiles (#9578)

pull/9586/head
Loïc Guilloux 2021-09-26 19:31:55 +02:00 committed by GitHub
parent 11dece205c
commit 38a64eb2aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 15 deletions

View File

@ -3106,14 +3106,14 @@ bool AfterLoadGame()
} }
} }
if (IsSavegameVersionBeforeOrAt(SLV_ENDING_YEAR)) { if (IsSavegameVersionBefore(SLV_DOCK_DOCKINGTILES)) {
/* Update station docking tiles. Was only needed for pre-SLV_MULTITLE_DOCKS /* All tiles around docks may be docking tiles. */
* savegames, but a bug in docking tiles touched all savegames between
* SLV_MULTITILE_DOCKS and SLV_ENDING_YEAR. */
for (Station *st : Station::Iterate()) { for (Station *st : Station::Iterate()) {
if (st->ship_station.tile != INVALID_TILE) UpdateStationDockingTiles(st); if (st->ship_station.tile != INVALID_TILE) UpdateStationDockingTiles(st);
} }
}
if (IsSavegameVersionBeforeOrAt(SLV_ENDING_YEAR)) {
/* Reset roadtype/streetcartype info for non-road bridges. */ /* Reset roadtype/streetcartype info for non-road bridges. */
for (TileIndex t = 0; t < map_size; t++) { for (TileIndex t = 0; t < map_size; t++) {
if (IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) != TRANSPORT_ROAD) { if (IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) != TRANSPORT_ROAD) {

View File

@ -337,7 +337,8 @@ enum SaveLoadVersion : uint16 {
SLV_TABLE_CHUNKS, ///< 295 PR#9322 Introduction of CH_TABLE and CH_SPARSE_TABLE. SLV_TABLE_CHUNKS, ///< 295 PR#9322 Introduction of CH_TABLE and CH_SPARSE_TABLE.
SLV_SCRIPT_INT64, ///< 296 PR#9415 SQInteger is 64bit but was saved as 32bit. SLV_SCRIPT_INT64, ///< 296 PR#9415 SQInteger is 64bit but was saved as 32bit.
SLV_LINKGRAPH_TRAVEL_TIME, ///< 297 PR#9457 v12 Store travel time in the linkgraph. SLV_LINKGRAPH_TRAVEL_TIME, ///< 297 PR#9457 v12.0-RC1 Store travel time in the linkgraph.
SLV_DOCK_DOCKINGTILES, ///< 298 PR#9578 v12.0 All tiles around docks may be docking tiles.
SL_MAX_VERSION, ///< Highest possible saveload version SL_MAX_VERSION, ///< Highest possible saveload version
}; };

View File

@ -2635,23 +2635,15 @@ void ClearDockingTilesCheckingNeighbours(TileIndex tile)
/** /**
* Check if a dock tile can be docked from the given direction. * Check if a dock tile can be docked from the given direction.
* @param t Tile index of dock. * @param t Tile index of dock.
* @param d DiagDirection adjacent to dock being tested. * @param d DiagDirection adjacent to dock being tested. (unused)
* @return True iff the dock can be docked from the given direction. * @return True iff the dock can be docked from the given direction.
*/ */
bool IsValidDockingDirectionForDock(TileIndex t, DiagDirection d) bool IsValidDockingDirectionForDock(TileIndex t, DiagDirection d)
{ {
assert(IsDockTile(t)); assert(IsDockTile(t));
/** Bitmap of valid directions for each dock tile part. */
static const uint8 _valid_docking_tile[] = {
0, 0, 0, 0, // No docking against the slope part.
1 << DIAGDIR_NE | 1 << DIAGDIR_SW, // Docking permitted at the end
1 << DIAGDIR_NW | 1 << DIAGDIR_SE, // of the flat piers.
};
StationGfx gfx = GetStationGfx(t); StationGfx gfx = GetStationGfx(t);
assert(gfx < lengthof(_valid_docking_tile)); return gfx >= GFX_DOCK_BASE_WATER_PART;
return HasBit(_valid_docking_tile[gfx], d);
} }
/** /**