summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-01-21 16:51:56 +0000
committersmatz <smatz@openttd.org>2011-01-21 16:51:56 +0000
commite860075a16daf1194d5c7a859450dafb1da05490 (patch)
tree593b73743cebbbb83290b7636e7b77a2ee0a21dc
parent2a2363e819612a7c01f1a02210043e426775eb4d (diff)
downloadopenttd-e860075a16daf1194d5c7a859450dafb1da05490.tar.xz
(svn r21882) -Codechange: make use of the fact that vehicle's Z position can change only if it has GVF_GOINGUP_BIT or GVF_GOINGDOWN_BIT set
-rw-r--r--src/ground_vehicle.hpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/ground_vehicle.hpp b/src/ground_vehicle.hpp
index 7e2894f5b..4fa9eb4fa 100644
--- a/src/ground_vehicle.hpp
+++ b/src/ground_vehicle.hpp
@@ -151,12 +151,8 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
*/
FORCEINLINE void UpdateZPosition()
{
- /* Flat tile, tile with two opposing corners raised and tile with 3 corners
- * raised can never have sloped track ... */
- static const uint32 never_sloped = 1 << SLOPE_FLAT | 1 << SLOPE_EW | 1 << SLOPE_NS | 1 << SLOPE_NWS | 1 << SLOPE_WSE | 1 << SLOPE_SEN | 1 << SLOPE_ENW;
- /* ... unless it's a bridge head. */
- if (IsTileType(this->tile, MP_TUNNELBRIDGE) || // the following check would be true for tunnels anyway
- (T::From(this)->TileMayHaveSlopedTrack() && !HasBit(never_sloped, GetTileSlope(this->tile, NULL)))) {
+ /* Vehicle's Z position can change only if it has GVF_GOINGUP_BIT or GVF_GOINGDOWN_BIT set */
+ if (HasBit(this->gv_flags, GVF_GOINGUP_BIT) || HasBit(this->gv_flags, GVF_GOINGDOWN_BIT)) {
this->z_pos = GetSlopeZ(this->x_pos, this->y_pos);
} else {
/* Verify that assumption. */