(svn r4790) Remove slope magic from EnsureNoVehicleZ() and rename it to EnsureNoVehicleOnGround() to make more clear what it does

This commit is contained in:
tron
2006-05-09 09:56:09 +00:00
parent 2a337ab009
commit 1be0d9926e
6 changed files with 9 additions and 28 deletions

View File

@@ -131,30 +131,19 @@ static void *EnsureNoVehicleProcZ(Vehicle *v, void *data)
const TileInfo *ti = data;
if (v->tile != ti->tile || v->type == VEH_Disaster) return NULL;
if (!IS_INT_INSIDE(ti->z - v->z_pos, 0, TILE_HEIGHT + 1)) return NULL;
if (v->z_pos > ti->z) return NULL;
VehicleInTheWayErrMsg(v);
return v;
}
static inline uint Correct_Z(Slope tileh)
{
// needs z correction for slope-type graphics that have the NORTHERN tile lowered
return CorrectZ(tileh) ? TILE_HEIGHT : 0;
}
uint GetCorrectTileHeight(TileIndex tile)
{
return Correct_Z(GetTileSlope(tile, NULL));
}
bool EnsureNoVehicleZ(TileIndex tile, byte z)
bool EnsureNoVehicleOnGround(TileIndex tile)
{
TileInfo ti;
ti.tile = tile;
ti.z = z + GetCorrectTileHeight(tile);
ti.z = GetTileMaxZ(tile);
return VehicleFromPos(tile, &ti, EnsureNoVehicleProcZ) == NULL;
}