summaryrefslogtreecommitdiff
path: root/ship_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-06 11:39:00 +0000
committertron <tron@openttd.org>2005-01-06 11:39:00 +0000
commitd3c685532015cce7ababdfa8deb45388fda2748f (patch)
treef875975dc056d7d3fea370018fa0bdf62837fd3e /ship_cmd.c
parent9a32e38633e7c2c0793404b3bd5897c1cd362c0d (diff)
downloadopenttd-d3c685532015cce7ababdfa8deb45388fda2748f.tar.xz
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
Diffstat (limited to 'ship_cmd.c')
-rw-r--r--ship_cmd.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/ship_cmd.c b/ship_cmd.c
index a7da76f95..52e710d64 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -190,15 +190,15 @@ static void PlayShipSound(Vehicle *v)
SndPlayVehicleFx(ShipVehInfo(v->engine_type)->sfx, v);
}
-static const TileIndexDiff _dock_offs[] = {
- TILE_XY(2, 0),
- TILE_XY(-2, 0),
- TILE_XY(0, 2),
- TILE_XY(2, 0),
- TILE_XY(0, -2),
- TILE_XY(0,0),
- TILE_XY(0,0),
- TILE_XY(0,0),
+static const TileIndexDiffC _dock_offs[] = {
+ { 2, 0},
+ {-2, 0},
+ { 0, 2},
+ { 2, 0},
+ { 0, -2},
+ { 0, 0},
+ { 0, 0},
+ { 0, 0}
};
static void ProcessShipOrder(Vehicle *v)
@@ -245,7 +245,7 @@ static void ProcessShipOrder(Vehicle *v)
st = DEREF_STATION(order.station);
if (st->dock_tile != 0) {
- v->dest_tile = TILE_ADD(st->dock_tile, _dock_offs[_map5[st->dock_tile]-0x4B]);
+ v->dest_tile = TILE_ADD(st->dock_tile, ToTileIndexDiff(_dock_offs[_map5[st->dock_tile]-0x4B]));
}
} else if (order.type == OT_GOTO_DEPOT) {
v->dest_tile = _depots[order.station].xy;
@@ -319,9 +319,9 @@ static void RecalcShipStuff(Vehicle *v)
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
}
-static const TileIndexDiff _ship_leave_depot_offs[] = {
- TILE_XY(-1,0),
- TILE_XY(0,-1),
+static const TileIndexDiffC _ship_leave_depot_offs[] = {
+ {-1, 0},
+ { 0, -1}
};
static void CheckShipLeaveDepot(Vehicle *v)
@@ -337,10 +337,10 @@ static void CheckShipLeaveDepot(Vehicle *v)
d = (_map5[tile]&2) ? 1 : 0;
// Check first side
- if (_ship_sometracks[d] & GetTileShipTrackStatus(TILE_ADD(tile,_ship_leave_depot_offs[d]))) {
+ if (_ship_sometracks[d] & GetTileShipTrackStatus(TILE_ADD(tile, ToTileIndexDiff(_ship_leave_depot_offs[d])))) {
m = (d==0) ? 0x101 : 0x207;
// Check second side
- } else if (_ship_sometracks[d+2] & GetTileShipTrackStatus(TILE_ADD(tile, -2*_ship_leave_depot_offs[d]))) {
+ } else if (_ship_sometracks[d+2] & GetTileShipTrackStatus(TILE_ADD(tile, -2 * ToTileIndexDiff(_ship_leave_depot_offs[d])))) {
m = (d==0) ? 0x105 : 0x203;
} else {
return;