summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-04-09 08:25:43 +0000
committertron <tron@openttd.org>2006-04-09 08:25:43 +0000
commitfade7a5997aacccb45a2e673e6b30620356cb260 (patch)
tree9e15c106258aa49c89bbd2d00fd9fc3a63559fd1
parent63e040966edabf1610cb46d0a830ddd46c98e6da (diff)
downloadopenttd-fade7a5997aacccb45a2e673e6b30620356cb260.tar.xz
(svn r4331) Replace some direction calculation magic with DiagDirection to make a bit more clear what's going on
-rw-r--r--station_cmd.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/station_cmd.c b/station_cmd.c
index 5398140f2..c37829b3b 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -2143,15 +2143,14 @@ static uint32 VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
if (!(_patches.new_nonstop && v->current_order.flags & OF_NON_STOP) &&
v->current_order.type != OT_LEAVESTATION &&
v->last_station_visited != station_id) {
- byte dir;
+ DiagDirection dir = DirToDiagDir(v->direction);
x &= 0xF;
y &= 0xF;
- dir = v->direction & 6;
- if (dir & 2) intswap(x,y);
+ if (DiagDirToAxis(dir) != AXIS_X) intswap(x, y);
if (y == 8) {
- if (dir != 2 && dir != 4) x = ~x & 0xF;
+ if (dir != DIAGDIR_SE && dir != DIAGDIR_SW) x = ~x & 0xF;
if (x == 12) return 2 | (station_id << 8); /* enter station */
if (x < 12) {
uint16 spd;