mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-09 15:53:36 +00:00
Codechange: Use TileAddBy(Diag)Dir when possible.
This commit is contained in:
parent
944f785be8
commit
79a551a83c
@ -269,7 +269,7 @@ bool CircularTileSearch(TileIndex *tile, uint size, TestTileOnSearchProc proc, v
|
||||
|
||||
/* If tile test is not successful, get one tile up,
|
||||
* ready for a test in first circle around center tile */
|
||||
*tile = TILE_ADD(*tile, TileOffsByDir(DIR_N));
|
||||
*tile = TileAddByDir(*tile, DIR_N);
|
||||
return CircularTileSearch(tile, size / 2, 1, 1, proc, user_data);
|
||||
} else {
|
||||
return CircularTileSearch(tile, size / 2, 0, 0, proc, user_data);
|
||||
|
@ -219,8 +219,7 @@ protected:
|
||||
}
|
||||
|
||||
/* normal or station tile, do one step */
|
||||
TileIndexDiff diff = TileOffsByDiagDir(m_exitdir);
|
||||
m_new_tile = TILE_ADD(m_old_tile, diff);
|
||||
m_new_tile = TileAddByDiagDir(m_old_tile, m_exitdir);
|
||||
|
||||
/* special handling for stations */
|
||||
if (IsRailTT() && HasStationTileRail(m_new_tile)) {
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
}
|
||||
|
||||
/* move back to the old tile/trackdir (where ship is coming from) */
|
||||
TileIndex src_tile = TILE_ADD(tile, TileOffsByDiagDir(ReverseDiagDir(enterdir)));
|
||||
TileIndex src_tile = TileAddByDiagDir(tile, ReverseDiagDir(enterdir));
|
||||
Trackdir trackdir = v->GetVehicleTrackdir();
|
||||
assert(IsValidTrackdir(trackdir));
|
||||
|
||||
|
@ -1449,7 +1449,7 @@ again:
|
||||
/* Vehicle has arrived at a bay in a road stop */
|
||||
|
||||
if (IsDriveThroughStopTile(v->tile)) {
|
||||
TileIndex next_tile = TILE_ADD(v->tile, TileOffsByDir(v->direction));
|
||||
TileIndex next_tile = TileAddByDir(v->tile, v->direction);
|
||||
|
||||
/* Check if next inline bay is free and has compatible road. */
|
||||
if (RoadStop::IsDriveThroughRoadStopContinuation(v->tile, next_tile) && (GetRoadTypes(next_tile) & v->compatible_roadtypes) != 0) {
|
||||
|
@ -2208,7 +2208,7 @@ static const T *FindStationsNearby(TileArea ta, bool distant_join)
|
||||
if (distant_join && min(ta.w, ta.h) >= _settings_game.station.station_spread) return NULL;
|
||||
uint max_dist = distant_join ? _settings_game.station.station_spread - min(ta.w, ta.h) : 1;
|
||||
|
||||
TileIndex tile = TILE_ADD(ctx.tile, TileOffsByDir(DIR_N));
|
||||
TileIndex tile = TileAddByDir(ctx.tile, DIR_N);
|
||||
CircularTileSearch(&tile, max_dist, ta.w, ta.h, AddNearbyStation<T>, &ctx);
|
||||
|
||||
return NULL;
|
||||
|
@ -1218,7 +1218,7 @@ void ConvertGroundTilesIntoWaterTiles()
|
||||
default:
|
||||
uint dir;
|
||||
FOR_EACH_SET_BIT(dir, _flood_from_dirs[slope & ~SLOPE_STEEP]) {
|
||||
TileIndex dest = TILE_ADD(tile, TileOffsByDir((Direction)dir));
|
||||
TileIndex dest = TileAddByDir(tile, (Direction)dir);
|
||||
Slope slope_dest = GetTileSlope(dest) & ~SLOPE_STEEP;
|
||||
if (slope_dest == SLOPE_FLAT || IsSlopeWithOneCornerRaised(slope_dest)) {
|
||||
MakeShore(tile);
|
||||
|
Loading…
Reference in New Issue
Block a user