summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-08-11 22:07:08 +0000
committerdarkvater <darkvater@openttd.org>2004-08-11 22:07:08 +0000
commitf42201496093f04220e58b1c4cd4d69531839de4 (patch)
treebbd3f2f0084e8bba00dd232cb07236b5bebd9d6a /vehicle.c
parent6679afc48a1bec985b6687dee105730b89682224 (diff)
downloadopenttd-f42201496093f04220e58b1c4cd4d69531839de4.tar.xz
(svn r23) -Some omments on the code (blathijs)
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/vehicle.c b/vehicle.c
index 4f5611ce2..667a336bc 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1458,11 +1458,18 @@ byte GetDirectionTowards(Vehicle *v, int x, int y)
return (dir+((dirdiff&7)<5?1:-1)) & 7;
}
+/* Return value has bit 0x2 set, when the vehicle enters a station. Then,
+ * result << 8 contains the id of the station entered. If the return value has
+ * bit 0x8 set, the vehicle could not and did not enter the tile. Are there
+ * other bits that can be set? */
uint32 VehicleEnterTile(Vehicle *v, uint tile, int x, int y)
{
uint old_tile = v->tile;
uint32 result = _tile_type_procs[GET_TILETYPE(tile)]->vehicle_enter_tile_proc(v, tile, x, y);
+ /* When vehicle_enter_tile_proc returns 8, that apparently means that
+ * we cannot enter the tile at all. In that case, don't call
+ * leave_tile. */
if (!(result & 8) && old_tile != tile) {
VehicleLeaveTileProc *proc = _tile_type_procs[GET_TILETYPE(old_tile)]->vehicle_leave_tile_proc;
if (proc != NULL)