Skip to content

Commit

Permalink
Change: Allow all tiles around docks to be docking tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
glx22 committed Sep 26, 2021
1 parent 14ad424 commit 147a39e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/saveload/afterload.cpp
Expand Up @@ -3106,14 +3106,14 @@ bool AfterLoadGame()
}
}

if (IsSavegameVersionBeforeOrAt(SLV_ENDING_YEAR)) {
/* Update station docking tiles. Was only needed for pre-SLV_MULTITLE_DOCKS
* savegames, but a bug in docking tiles touched all savegames between
* SLV_MULTITILE_DOCKS and SLV_ENDING_YEAR. */
if (IsSavegameVersionBeforeOrAt(SLV_LINKGRAPH_TRAVEL_TIME)) {
/* All tiles around docks may be docking tiles. */
for (Station *st : Station::Iterate()) {
if (st->ship_station.tile != INVALID_TILE) UpdateStationDockingTiles(st);
}
}

if (IsSavegameVersionBeforeOrAt(SLV_ENDING_YEAR)) {
/* Reset roadtype/streetcartype info for non-road bridges. */
for (TileIndex t = 0; t < map_size; t++) {
if (IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) != TRANSPORT_ROAD) {
Expand Down
12 changes: 2 additions & 10 deletions src/station_cmd.cpp
Expand Up @@ -2635,23 +2635,15 @@ void ClearDockingTilesCheckingNeighbours(TileIndex tile)
/**
* Check if a dock tile can be docked from the given direction.
* @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.
*/
bool IsValidDockingDirectionForDock(TileIndex t, DiagDirection d)
{
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);
assert(gfx < lengthof(_valid_docking_tile));
return HasBit(_valid_docking_tile[gfx], d);
return gfx >= GFX_DOCK_BASE_WATER_PART;
}

/**
Expand Down

0 comments on commit 147a39e

Please sign in to comment.