summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJ0anJosep <juanjo.ng.83@gmail.com>2018-04-29 13:50:52 +0200
committerfrosch <github@elsenhans.name>2018-04-30 18:55:04 +0200
commit79a551a83ceda50b1b95d2a5519dbcbc6f700d2b (patch)
tree7723211f8f91fe6cc90630dbef27931ae437922f /src
parent944f785be8e0d994552d96e2990232cba094efdd (diff)
downloadopenttd-79a551a83ceda50b1b95d2a5519dbcbc6f700d2b.tar.xz
Codechange: Use TileAddBy(Diag)Dir when possible.
Diffstat (limited to 'src')
-rw-r--r--src/map.cpp2
-rw-r--r--src/pathfinder/follow_track.hpp3
-rw-r--r--src/pathfinder/yapf/yapf_ship.cpp2
-rw-r--r--src/roadveh_cmd.cpp2
-rw-r--r--src/station_gui.cpp2
-rw-r--r--src/water_cmd.cpp2
6 files changed, 6 insertions, 7 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 986aa1bbb..85590c3e8 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -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);
diff --git a/src/pathfinder/follow_track.hpp b/src/pathfinder/follow_track.hpp
index 9f19b029c..d9a70b7fc 100644
--- a/src/pathfinder/follow_track.hpp
+++ b/src/pathfinder/follow_track.hpp
@@ -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)) {
diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp
index e4b99462d..df6cd468c 100644
--- a/src/pathfinder/yapf/yapf_ship.cpp
+++ b/src/pathfinder/yapf/yapf_ship.cpp
@@ -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));
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 7adc532b6..fcabf477f 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -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) {
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index aa2017018..c1927bdcc 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -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;
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 07b6a9550..737257a82 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -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);