From 5add39d560aa28e95a7a4f84036ef5b1dd2e2e6b Mon Sep 17 00:00:00 2001 From: alberth Date: Fri, 21 Sep 2012 20:31:06 +0000 Subject: [PATCH] (svn r24540) -Codechange: Remove the not-so-useful HALF_TILE_SIZE constant. --- src/ground_vehicle.hpp | 2 +- src/saveload/afterload.cpp | 4 ++-- src/tile_type.h | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ground_vehicle.hpp b/src/ground_vehicle.hpp index 65c8562950..80a88b705f 100644 --- a/src/ground_vehicle.hpp +++ b/src/ground_vehicle.hpp @@ -145,7 +145,7 @@ struct GroundVehicle : public SpecializedVehicle { * direction it is sloped, we get the 'z' at the center of * the tile (middle_z) and the edge of the tile (old_z), * which we then can compare. */ - int middle_z = GetSlopePixelZ((this->x_pos & ~TILE_UNIT_MASK) | HALF_TILE_SIZE, (this->y_pos & ~TILE_UNIT_MASK) | HALF_TILE_SIZE); + int middle_z = GetSlopePixelZ((this->x_pos & ~TILE_UNIT_MASK) | (TILE_SIZE / 2), (this->y_pos & ~TILE_UNIT_MASK) | (TILE_SIZE / 2)); if (middle_z != this->z_pos) { SetBit(this->gv_flags, (middle_z > this->z_pos) ? GVF_GOINGUP_BIT : GVF_GOINGDOWN_BIT); diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index f83979bd48..8a87dcc404 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -458,8 +458,8 @@ static uint FixVehicleInclination(Vehicle *v, Direction dir) byte entry_z = GetSlopePixelZ(entry_x, entry_y); /* Compute middle of the tile. */ - int middle_x = (v->x_pos & ~TILE_UNIT_MASK) + HALF_TILE_SIZE; - int middle_y = (v->y_pos & ~TILE_UNIT_MASK) + HALF_TILE_SIZE; + int middle_x = (v->x_pos & ~TILE_UNIT_MASK) + TILE_SIZE / 2; + int middle_y = (v->y_pos & ~TILE_UNIT_MASK) + TILE_SIZE / 2; byte middle_z = GetSlopePixelZ(middle_x, middle_y); /* middle_z == entry_z, no height change. */ diff --git a/src/tile_type.h b/src/tile_type.h index b43b0e6b5b..8a476e9802 100644 --- a/src/tile_type.h +++ b/src/tile_type.h @@ -13,7 +13,6 @@ #define TILE_TYPE_H static const uint TILE_SIZE = 16; ///< Tiles are 16x16 "units" in size -static const uint HALF_TILE_SIZE = TILE_SIZE / 2; ///< Half of tile size, to get centre of a tile. static const uint TILE_UNIT_MASK = TILE_SIZE - 1; ///< For masking in/out the inner-tile units. static const uint TILE_PIXELS = 32; ///< a tile is 32x32 pixels static const uint TILE_HEIGHT = 8; ///< The standard height-difference between tiles on two levels is 8 (z-diff 8)