Update to 1.9.0-beta3

--HG--
branch : openttd
This commit is contained in:
Pavel Stupnikov
2019-02-25 16:08:46 +03:00
parent 68febec2a3
commit 7c38d218f1
145 changed files with 2398 additions and 1326 deletions
+15 -3
View File
@@ -510,9 +510,21 @@ static Track ChooseShipTrack(Ship *v, TileIndex tile, DiagDirection enterdir, Tr
return track;
}
static inline TrackBits GetAvailShipTracks(TileIndex tile, DiagDirection dir)
/**
* Get the available water tracks on a tile for a ship entering a tile.
* @param tile The tile about to enter.
* @param dir The entry direction.
* @param trackdir The trackdir the ship has on the old tile.
* @return The available trackbits on the next tile.
*/
static inline TrackBits GetAvailShipTracks(TileIndex tile, DiagDirection dir, Trackdir trackdir)
{
return GetTileShipTrackStatus(tile) & DiagdirReachesTracks(dir);
TrackBits tracks = GetTileShipTrackStatus(tile) & DiagdirReachesTracks(dir);
/* Do not remove 90 degree turns for OPF, as it isn't able to find paths taking it into account. */
if (_settings_game.pf.forbid_90_deg && _settings_game.pf.pathfinder_for_ships != VPF_OPF) tracks &= ~TrackCrossesTracks(TrackdirToTrack(trackdir));
return tracks;
}
static const byte _ship_subcoord[4][6][3] = {
@@ -699,7 +711,7 @@ static void ShipController(Ship *v)
DiagDirection diagdir = DiagdirBetweenTiles(gp.old_tile, gp.new_tile);
assert(diagdir != INVALID_DIAGDIR);
tracks = GetAvailShipTracks(gp.new_tile, diagdir);
tracks = GetAvailShipTracks(gp.new_tile, diagdir, v->GetVehicleTrackdir());
if (tracks == TRACK_BIT_NONE) goto reverse_direction;
/* Choose a direction, and continue if we find one */