diff options
author | tron <tron@openttd.org> | 2004-12-03 14:38:02 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2004-12-03 14:38:02 +0000 |
commit | 5149373467c17a545def174b1ff5b405460b15b4 (patch) | |
tree | 8c3e3725946b6eebf1621163014e7782cd3a2b2b | |
parent | c00258237e0fd63d23fb2015c78c070b72b2e9d9 (diff) | |
download | openttd-5149373467c17a545def174b1ff5b405460b15b4.tar.xz |
(svn r909) Small cleanup in vehicle.c, this should fix some warnings on 64bit machines
-rw-r--r-- | vehicle.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -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) |