Codechange: pass "ground vehicle" to GetTileSlopeZ since for tunnel/bridges there are two states
Previously it checked the position in non-driving direction to "guess" whether a ground vehicle was using the function, so on tunnels/bridges it could either return the Z of the (virtual) ground compared to the Z of the path the vehicle would take.
This commit is contained in:
@@ -343,11 +343,22 @@ uint GetPartialPixelZ(int x, int y, Slope corners)
|
||||
return z;
|
||||
}
|
||||
|
||||
int GetSlopePixelZ(int x, int y)
|
||||
/**
|
||||
* Return world \c Z coordinate of a given point of a tile. Normally this is the
|
||||
* Z of the ground/foundation at the given location, but in some cases the
|
||||
* ground/foundation can differ from the Z coordinate that the (ground) vehicle
|
||||
* passing over it would take. For example when entering a tunnel or bridge.
|
||||
*
|
||||
* @param x World X coordinate in tile "units".
|
||||
* @param y World Y coordinate in tile "units".
|
||||
* @param ground_vehicle Whether to get the Z coordinate of the ground vehicle, or the ground.
|
||||
* @return World Z coordinate at tile ground (vehicle) level, including slopes and foundations.
|
||||
*/
|
||||
int GetSlopePixelZ(int x, int y, bool ground_vehicle)
|
||||
{
|
||||
TileIndex tile = TileVirtXY(x, y);
|
||||
|
||||
return _tile_type_procs[GetTileType(tile)]->get_slope_z_proc(tile, x, y);
|
||||
return _tile_type_procs[GetTileType(tile)]->get_slope_z_proc(tile, x, y, ground_vehicle);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -361,9 +372,9 @@ int GetSlopePixelZ(int x, int y)
|
||||
int GetSlopePixelZOutsideMap(int x, int y)
|
||||
{
|
||||
if (IsInsideBS(x, 0, Map::SizeX() * TILE_SIZE) && IsInsideBS(y, 0, Map::SizeY() * TILE_SIZE)) {
|
||||
return GetSlopePixelZ(x, y);
|
||||
return GetSlopePixelZ(x, y, false);
|
||||
} else {
|
||||
return _tile_type_procs[MP_VOID]->get_slope_z_proc(INVALID_TILE, x, y);
|
||||
return _tile_type_procs[MP_VOID]->get_slope_z_proc(INVALID_TILE, x, y, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user