(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts

This commit is contained in:
tron
2005-01-16 11:24:58 +00:00
parent d2643dc483
commit ae796740aa
33 changed files with 239 additions and 217 deletions

View File

@@ -604,7 +604,7 @@ static void EffectTick_0(Vehicle *v)
BeginVehicleMove(v);
tile = TILE_FROM_XY(v->x_pos, v->y_pos);
if (!IS_TILETYPE(tile, MP_INDUSTRY)) {
if (!IsTileType(tile, MP_INDUSTRY)) {
EndVehicleMove(v);
DeleteVehicle(v);
return;
@@ -1074,7 +1074,7 @@ again:
SndPlayVehicleFx(SND_31_EXTRACT, v);
tile = TILE_FROM_XY(v->x_pos, v->y_pos);
if (IS_TILETYPE(tile, MP_INDUSTRY) &&
if (IsTileType(tile, MP_INDUSTRY) &&
_map5[tile]==0xA2) {
AddAnimatedTile(tile);
}
@@ -1642,13 +1642,13 @@ byte GetDirectionTowards(Vehicle *v, int x, int y)
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);
uint32 result = _tile_type_procs[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;
VehicleLeaveTileProc *proc = _tile_type_procs[TileType(old_tile)]->vehicle_leave_tile_proc;
if (proc != NULL)
proc(v, old_tile, x, y);
}