Chunnel: Adjust z position of vehicles in chunnels to go "under" the water.

This commit is contained in:
Jonathan G Rennison
2017-03-05 18:05:04 +00:00
parent 0690dbb8bf
commit ec9f0371e8
4 changed files with 81 additions and 4 deletions

View File

@@ -228,17 +228,21 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
assert(this->z_pos == GetSlopePixelZ(this->x_pos, this->y_pos));
}
void UpdateZPositionInWormhole();
/**
* Checks if the vehicle is in a slope and sets the required flags in that case.
* @param new_tile True if the vehicle reached a new tile.
* @param update_delta Indicates to also update the delta.
* @return Old height of the vehicle.
*/
inline int UpdateInclination(bool new_tile, bool update_delta)
inline int UpdateInclination(bool new_tile, bool update_delta, bool in_wormhole = false)
{
int old_z = this->z_pos;
if (new_tile) {
if (in_wormhole) {
this->UpdateZPositionInWormhole();
} else if (new_tile) {
this->UpdateZPositionAndInclination();
} else {
this->UpdateZPosition();