summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2004-12-03 14:38:02 +0000
committertron <tron@openttd.org>2004-12-03 14:38:02 +0000
commit5149373467c17a545def174b1ff5b405460b15b4 (patch)
tree8c3e3725946b6eebf1621163014e7782cd3a2b2b /vehicle.c
parentc00258237e0fd63d23fb2015c78c070b72b2e9d9 (diff)
downloadopenttd-5149373467c17a545def174b1ff5b405460b15b4.tar.xz
(svn r909) Small cleanup in vehicle.c, this should fix some warnings on 64bit machines
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/vehicle.c b/vehicle.c
index 8537e817f..69dc9f8d8 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -30,39 +30,42 @@ void VehicleInTheWayErrMsg(Vehicle *v)
static void *EnsureNoVehicleProc(Vehicle *v, void *data)
{
- if (v->tile != (TileIndex)(int)data || v->type == VEH_Disaster)
+ if (v->tile != *(const TileIndex*)data || v->type == VEH_Disaster)
return NULL;
VehicleInTheWayErrMsg(v);
- return (void*)1;
+ return v;
}
bool EnsureNoVehicle(TileIndex tile)
{
- return VehicleFromPos(tile, (void*)(int)tile, (VehicleFromPosProc*)EnsureNoVehicleProc) == NULL;
+ return VehicleFromPos(tile, &tile, EnsureNoVehicleProc) == NULL;
}
static void *EnsureNoVehicleProcZ(Vehicle *v, void *data)
{
- uint32 d = (uint32)data; // max mapsize 4,096*4,096 if shifted 8 bits for byte
- // with uint64 max mapsize is 2,6843,5456*2,6843,5456 :D
- if (v->tile != (TileIndex)(d >> (sizeof(byte)*8)) || v->z_pos != (byte)d || v->type == VEH_Disaster)
+ const TileInfo *ti = data;
+
+ if (v->tile != ti->tile || v->z_pos != ti->z || v->type == VEH_Disaster)
return NULL;
VehicleInTheWayErrMsg(v);
- return (void*)1;
+ return v;
}
bool EnsureNoVehicleZ(TileIndex tile, byte z)
{
TileInfo ti;
+
FindLandscapeHeightByTile(&ti, tile);
// needs z correction for slope-type graphics that have the NORTHERN tile lowered
// 1, 2, 3, 4, 5, 6 and 7
if (CORRECT_Z(ti.tileh))
z += 8;
- return VehicleFromPos(tile, (void*)((TileIndex)tile << (sizeof(byte)*8) | (byte)z), (VehicleFromPosProc*)EnsureNoVehicleProcZ) == NULL;
+ ti.z = z;
+
+ return VehicleFromPos(tile, &ti, EnsureNoVehicleProcZ) == NULL;
}
Vehicle *FindVehicleBetween(TileIndex from, TileIndex to, byte z)