summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-04 11:52:19 +0000
committerrubidium <rubidium@openttd.org>2011-11-04 11:52:19 +0000
commit2a2c102b0b173d6ebcfb90291eb56e82c4e935a7 (patch)
treeeea14ef6e9fcafd4cb4fb4a1a4aec8cbf1f928b7
parent459c9523e8acdf314ce697460f4768eec228daac (diff)
downloadopenttd-2a2c102b0b173d6ebcfb90291eb56e82c4e935a7.tar.xz
(svn r23108) -Codechange: more uint -> int / byte -> int conversions for Z related variables
-rw-r--r--src/aircraft_cmd.cpp12
-rw-r--r--src/disaster_cmd.cpp10
-rw-r--r--src/elrail.cpp4
-rw-r--r--src/ground_vehicle.hpp2
-rw-r--r--src/industry_cmd.cpp2
-rw-r--r--src/newgrf_canal.cpp2
-rw-r--r--src/rail_cmd.cpp10
-rw-r--r--src/road_cmd.cpp2
-rw-r--r--src/sound.cpp2
-rw-r--r--src/station_cmd.cpp4
-rw-r--r--src/town_cmd.cpp10
-rw-r--r--src/train_cmd.cpp4
-rw-r--r--src/tree_cmd.cpp2
-rw-r--r--src/tunnelbridge_cmd.cpp6
-rw-r--r--src/vehicle.cpp4
-rw-r--r--src/viewport.cpp12
-rw-r--r--src/water_cmd.cpp4
17 files changed, 46 insertions, 46 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index ed18682da..e259bcbc3 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -38,10 +38,10 @@
#include "table/strings.h"
-static const uint ROTOR_Z_OFFSET = 5; ///< Z Offset between helicopter- and rotorsprite.
+static const int ROTOR_Z_OFFSET = 5; ///< Z Offset between helicopter- and rotorsprite.
-static const uint PLANE_HOLDING_ALTITUDE = 150; ///< Altitude of planes in holding pattern (= lowest flight altitude).
-static const uint HELI_FLIGHT_ALTITUDE = 184; ///< Normal flight altitude of helicopters.
+static const int PLANE_HOLDING_ALTITUDE = 150; ///< Altitude of planes in holding pattern (= lowest flight altitude).
+static const int HELI_FLIGHT_ALTITUDE = 184; ///< Normal flight altitude of helicopters.
void Aircraft::UpdateDeltaXY(Direction direction)
@@ -930,7 +930,7 @@ static bool AircraftController(Aircraft *v)
if (amd.flag & (AMED_TAKEOFF | AMED_SLOWTURN | AMED_LAND)) v->tile = 0;
/* Adjust Z for land or takeoff? */
- uint z = v->z_pos;
+ int z = v->z_pos;
if (amd.flag & AMED_TAKEOFF) {
z = min(z + 2, GetAircraftFlyingAltitude(v));
@@ -950,7 +950,7 @@ static bool AircraftController(Aircraft *v)
continue;
}
- uint curz = GetSlopePixelZ(x + amd.x, y + amd.y) + 1;
+ int curz = GetSlopePixelZ(x + amd.x, y + amd.y) + 1;
/* We're not flying below our destination, right? */
assert(curz <= z);
@@ -966,7 +966,7 @@ static bool AircraftController(Aircraft *v)
/* We've landed. Decrease speed when we're reaching end of runway. */
if (amd.flag & AMED_BRAKE) {
- uint curz = GetSlopePixelZ(x, y) + 1;
+ int curz = GetSlopePixelZ(x, y) + 1;
if (z > curz) {
z--;
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index 821075ce3..3f3925527 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -133,7 +133,7 @@ static void DisasterVehicleUpdateImage(DisasterVehicle *v)
* Initialize a disaster vehicle. These vehicles are of type VEH_DISASTER, are unclickable
* and owned by nobody
*/
-static void InitializeDisasterVehicle(DisasterVehicle *v, int x, int y, byte z, Direction direction, byte subtype)
+static void InitializeDisasterVehicle(DisasterVehicle *v, int x, int y, int z, Direction direction, byte subtype)
{
v->x_pos = x;
v->y_pos = y;
@@ -152,7 +152,7 @@ static void InitializeDisasterVehicle(DisasterVehicle *v, int x, int y, byte z,
MarkSingleVehicleDirty(v);
}
-static void SetDisasterVehiclePos(DisasterVehicle *v, int x, int y, byte z)
+static void SetDisasterVehiclePos(DisasterVehicle *v, int x, int y, int z)
{
v->x_pos = x;
v->y_pos = y;
@@ -249,7 +249,7 @@ static bool DisasterTick_Zeppeliner(DisasterVehicle *v)
int x = v->x_pos;
int y = v->y_pos;
- byte z = GetSlopePixelZ(x, y);
+ int z = GetSlopePixelZ(x, y);
if (z < v->z_pos) z = v->z_pos - 1;
SetDisasterVehiclePos(v, x, y, z);
@@ -344,7 +344,7 @@ static bool DisasterTick_Ufo(DisasterVehicle *v)
v->direction = GetDirectionTowards(v, u->x_pos, u->y_pos);
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
- byte z = v->z_pos;
+ int z = v->z_pos;
if (dist <= TILE_SIZE && z > u->z_pos) z--;
SetDisasterVehiclePos(v, gp.x, gp.y, z);
@@ -509,7 +509,7 @@ static bool DisasterTick_Big_Ufo(DisasterVehicle *v)
return false;
}
- byte z = GetSlopePixelZ(v->x_pos, v->y_pos);
+ int z = GetSlopePixelZ(v->x_pos, v->y_pos);
if (z < v->z_pos) {
SetDisasterVehiclePos(v, v->x_pos, v->y_pos, v->z_pos - 1);
return true;
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 4232b190a..3734b919b 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -209,7 +209,7 @@ static void AdjustTileh(TileIndex tile, Slope *tileh)
* @param PCPpos The PCP of the tile.
* @return The Z position of the PCP.
*/
-static byte GetPCPElevation(TileIndex tile, DiagDirection PCPpos)
+static int GetPCPElevation(TileIndex tile, DiagDirection PCPpos)
{
/* The elevation of the "pylon"-sprite should be the elevation at the PCP.
* PCPs are always on a tile edge.
@@ -225,7 +225,7 @@ static byte GetPCPElevation(TileIndex tile, DiagDirection PCPpos)
* Also note that the result of GetSlopePixelZ() is very special on bridge-ramps.
*/
- byte z = GetSlopePixelZ(TileX(tile) * TILE_SIZE + min(x_pcp_offsets[PCPpos], TILE_SIZE - 1), TileY(tile) * TILE_SIZE + min(y_pcp_offsets[PCPpos], TILE_SIZE - 1));
+ int z = GetSlopePixelZ(TileX(tile) * TILE_SIZE + min(x_pcp_offsets[PCPpos], TILE_SIZE - 1), TileY(tile) * TILE_SIZE + min(y_pcp_offsets[PCPpos], TILE_SIZE - 1));
return (z + 2) & ~3; // this means z = (z + TILE_HEIGHT / 4) / (TILE_HEIGHT / 2) * (TILE_HEIGHT / 2);
}
diff --git a/src/ground_vehicle.hpp b/src/ground_vehicle.hpp
index 600082e21..7bf93f5c9 100644
--- a/src/ground_vehicle.hpp
+++ b/src/ground_vehicle.hpp
@@ -143,7 +143,7 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
* 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. */
- byte 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) | HALF_TILE_SIZE, (this->y_pos & ~TILE_UNIT_MASK) | HALF_TILE_SIZE);
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/industry_cmd.cpp b/src/industry_cmd.cpp
index 7ebca2368..5309135f1 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -698,7 +698,7 @@ static void CreateChimneySmoke(TileIndex tile)
{
uint x = TileX(tile) * TILE_SIZE;
uint y = TileY(tile) * TILE_SIZE;
- uint z = GetTileMaxPixelZ(tile);
+ int z = GetTileMaxPixelZ(tile);
CreateEffectVehicle(x + 15, y + 14, z + 59, EV_CHIMNEY_SMOKE);
}
diff --git a/src/newgrf_canal.cpp b/src/newgrf_canal.cpp
index 9bbf8fbb6..418b51755 100644
--- a/src/newgrf_canal.cpp
+++ b/src/newgrf_canal.cpp
@@ -48,7 +48,7 @@ static uint32 CanalGetVariable(const ResolverObject *object, byte variable, byte
switch (variable) {
/* Height of tile */
case 0x80: {
- uint z = GetTileZ(tile);
+ int z = GetTileZ(tile);
/* Return consistent height within locks */
if (IsTileType(tile, MP_WATER) && IsLock(tile) && GetLockPart(tile) == LOCK_PART_UPPER) z--;
return z;
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index efbb1ad73..936f413e5 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -1774,7 +1774,7 @@ static void DrawTrackFence_NE_SW(const TileInfo *ti, SpriteID base_image)
*/
static void DrawTrackFence_NS_1(const TileInfo *ti, SpriteID base_image)
{
- uint z = ti->z + GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_W);
+ int z = ti->z + GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_W);
AddSortableSpriteToDraw(base_image + RFO_FLAT_VERT, _drawtile_track_palette,
ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 4, z);
}
@@ -1784,7 +1784,7 @@ static void DrawTrackFence_NS_1(const TileInfo *ti, SpriteID base_image)
*/
static void DrawTrackFence_NS_2(const TileInfo *ti, SpriteID base_image)
{
- uint z = ti->z + GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_E);
+ int z = ti->z + GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_E);
AddSortableSpriteToDraw(base_image + RFO_FLAT_VERT, _drawtile_track_palette,
ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 4, z);
}
@@ -1794,7 +1794,7 @@ static void DrawTrackFence_NS_2(const TileInfo *ti, SpriteID base_image)
*/
static void DrawTrackFence_WE_1(const TileInfo *ti, SpriteID base_image)
{
- uint z = ti->z + GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_N);
+ int z = ti->z + GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_N);
AddSortableSpriteToDraw(base_image + RFO_FLAT_HORZ, _drawtile_track_palette,
ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 4, z);
}
@@ -1804,7 +1804,7 @@ static void DrawTrackFence_WE_1(const TileInfo *ti, SpriteID base_image)
*/
static void DrawTrackFence_WE_2(const TileInfo *ti, SpriteID base_image)
{
- uint z = ti->z + GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_S);
+ int z = ti->z + GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_S);
AddSortableSpriteToDraw(base_image + RFO_FLAT_HORZ, _drawtile_track_palette,
ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 4, z);
}
@@ -2787,7 +2787,7 @@ static VehicleEnterTileStatus VehicleEnter_Track(Vehicle *u, TileIndex tile, int
* @param tileh_new New TileSlope.
* @param rail_bits Trackbits.
*/
-static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_old, Slope tileh_old, uint z_new, Slope tileh_new, TrackBits rail_bits)
+static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, int z_old, Slope tileh_old, int z_new, Slope tileh_new, TrackBits rail_bits)
{
if (!_settings_game.construction.build_on_slopes || !AutoslopeEnabled()) return_cmd_error(STR_ERROR_MUST_REMOVE_RAILROAD_TRACK);
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 2a6eb3bea..bf779590a 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -1112,7 +1112,7 @@ static void DrawRoadDetail(SpriteID img, const TileInfo *ti, int dx, int dy, int
{
int x = ti->x | dx;
int y = ti->y | dy;
- byte z = ti->z;
+ int z = ti->z;
if (ti->tileh != SLOPE_FLAT) z = GetSlopePixelZ(x, y);
AddSortableSpriteToDraw(img, PAL_NONE, x, y, 2, 2, h, z);
}
diff --git a/src/sound.cpp b/src/sound.cpp
index f5016739c..932ec8f5b 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -255,7 +255,7 @@ void SndPlayTileFx(SoundID sound, TileIndex tile)
/* emits sound from center of the tile */
int x = min(MapMaxX() - 1, TileX(tile)) * TILE_SIZE + TILE_SIZE / 2;
int y = min(MapMaxY() - 1, TileY(tile)) * TILE_SIZE - TILE_SIZE / 2;
- uint z = (y < 0 ? 0 : GetSlopePixelZ(x, y));
+ int z = (y < 0 ? 0 : GetSlopePixelZ(x, y));
Point pt = RemapCoords(x, y, z);
y += 2 * TILE_SIZE;
Point pt2 = RemapCoords(x, y, GetSlopePixelZ(x, y));
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index de018f491..00152246c 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -306,8 +306,8 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n
}
/* check elevation compared to town */
- uint z = GetTileZ(tile);
- uint z2 = GetTileZ(t->xy);
+ int z = GetTileZ(tile);
+ int z2 = GetTileZ(t->xy);
if (z < z2) {
if (HasBit(free_names, M(STR_SV_STNAME_VALLEY))) return STR_SV_STNAME_VALLEY;
} else if (z > z2) {
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 8323e9e63..9fde9163a 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1930,7 +1930,7 @@ static inline bool CanBuildHouseHere(TileIndex tile, TownID town, bool noslope)
* @return true iff house can be built here
* @see CanBuildHouseHere()
*/
-static inline bool CheckBuildHouseSameZ(TileIndex tile, TownID town, uint z, bool noslope)
+static inline bool CheckBuildHouseSameZ(TileIndex tile, TownID town, int z, bool noslope)
{
if (!CanBuildHouseHere(tile, town, noslope)) return false;
@@ -1950,7 +1950,7 @@ static inline bool CheckBuildHouseSameZ(TileIndex tile, TownID town, uint z, boo
* @return true iff house can be built
* @see CheckBuildHouseSameZ()
*/
-static bool CheckFree2x2Area(TileIndex tile, TownID town, uint z, bool noslope)
+static bool CheckFree2x2Area(TileIndex tile, TownID town, int z, bool noslope)
{
/* we need to check this tile too because we can be at different tile now */
if (!CheckBuildHouseSameZ(tile, town, z, noslope)) return false;
@@ -2039,7 +2039,7 @@ static inline bool TownLayoutAllows2x2HouseHere(Town *t, TileIndex tile)
* @param noslope are slopes forbidden?
* @param second diagdir from first tile to second tile
*/
-static bool CheckTownBuild2House(TileIndex *tile, Town *t, uint maxz, bool noslope, DiagDirection second)
+static bool CheckTownBuild2House(TileIndex *tile, Town *t, int maxz, bool noslope, DiagDirection second)
{
/* 'tile' is already checked in BuildTownHouse() - CanBuildHouseHere() and slope test */
@@ -2064,7 +2064,7 @@ static bool CheckTownBuild2House(TileIndex *tile, Town *t, uint maxz, bool noslo
* @param maxz all tiles should have the same height
* @param noslope are slopes forbidden?
*/
-static bool CheckTownBuild2x2House(TileIndex *tile, Town *t, uint maxz, bool noslope)
+static bool CheckTownBuild2x2House(TileIndex *tile, Town *t, int maxz, bool noslope)
{
TileIndex tile2 = *tile;
@@ -2139,7 +2139,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
houses[num++] = (HouseID)i;
}
- uint maxz = GetTileMaxZ(tile);
+ int maxz = GetTileMaxZ(tile);
TileIndex baseTile = tile;
while (probability_max > 0) {
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 19ebffb9c..576bd9a15 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2696,7 +2696,7 @@ static const RailtypeSlowdownParams _railtype_slowdown[] = {
};
/** Modify the speed of the vehicle due to a change in altitude */
-static inline void AffectSpeedByZChange(Train *v, byte old_z)
+static inline void AffectSpeedByZChange(Train *v, int old_z)
{
if (old_z == v->z_pos || _settings_game.vehicle.train_acceleration_model != AM_ORIGINAL) return;
@@ -3160,7 +3160,7 @@ static void TrainController(Train *v, Vehicle *nomove)
v->y_pos = gp.y;
/* update the Z position of the vehicle */
- byte old_z = v->UpdateInclination(gp.new_tile != gp.old_tile, false);
+ int old_z = v->UpdateInclination(gp.new_tile != gp.old_tile, false);
if (prev == NULL) {
/* This is the first vehicle in the train */
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index 852823c3e..5acf8affb 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -493,7 +493,7 @@ static void DrawTile_Trees(TileInfo *ti)
}
/* draw them in a sorted way */
- byte z = ti->z + GetSlopeMaxPixelZ(ti->tileh) / 2;
+ int z = ti->z + GetSlopeMaxPixelZ(ti->tileh) / 2;
for (; trees > 0; trees--) {
uint min = te[0].x + te[0].y;
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 8edfdc810..067b8f219 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -1144,7 +1144,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
if (HasBit(rts, ROADTYPE_TRAM)) {
uint offset = tunnelbridge_direction;
- uint z = ti->z;
+ int z = ti->z;
if (ti->tileh != SLOPE_FLAT) {
offset = (offset + 1) & 1;
z += TILE_HEIGHT;
@@ -1278,7 +1278,7 @@ void DrawBridgeMiddle(const TileInfo *ti)
int x = ti->x;
int y = ti->y;
uint bridge_z = GetBridgePixelHeight(rampsouth);
- uint z = bridge_z - BRIDGE_Z_START;
+ int z = bridge_z - BRIDGE_Z_START;
/* Add a bounding box that separates the bridge from things below it. */
AddSortableSpriteToDraw(SPR_EMPTY_BOUNDING_BOX, PAL_NONE, x, y, 16, 16, 1, bridge_z - TILE_HEIGHT + BB_Z_SEPARATOR);
@@ -1457,7 +1457,7 @@ static void TileLoop_TunnelBridge(TileIndex tile)
/* As long as we do not have a snow density, we want to use the density
* from the entry endge. For tunnels this is the lowest point for bridges the highest point.
* (Independent of foundations) */
- uint z = IsBridge(tile) ? GetTileMaxZ(tile) : GetTileZ(tile);
+ int z = IsBridge(tile) ? GetTileMaxZ(tile) : GetTileZ(tile);
if (snow_or_desert != (z > GetSnowLine())) {
SetTunnelBridgeSnowOrDesert(tile, !snow_or_desert);
MarkTileDirtyByTile(tile);
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index b4a9e9e17..2ace7f018 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -415,7 +415,7 @@ bool HasVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
*/
static Vehicle *EnsureNoVehicleProcZ(Vehicle *v, void *data)
{
- byte z = *(byte*)data;
+ int z = *(int*)data;
if (v->type == VEH_DISASTER || (v->type == VEH_AIRCRAFT && v->subtype == AIR_SHADOW)) return NULL;
if (v->z_pos > z) return NULL;
@@ -430,7 +430,7 @@ static Vehicle *EnsureNoVehicleProcZ(Vehicle *v, void *data)
*/
CommandCost EnsureNoVehicleOnGround(TileIndex tile)
{
- byte z = GetTileMaxPixelZ(tile);
+ int z = GetTileMaxPixelZ(tile);
/* Value v is not safe in MP games, however, it is used to generate a local
* error message only (which may be different for different machines).
diff --git a/src/viewport.cpp b/src/viewport.cpp
index a587a872e..58fa27606 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -369,7 +369,7 @@ static Point TranslateXYToTileCoord(const ViewPort *vp, int x, int y)
{
Point pt;
int a, b;
- uint z;
+ int z;
if ( (uint)(x -= vp->left) >= (uint)vp->width ||
(uint)(y -= vp->top) >= (uint)vp->height) {
@@ -400,12 +400,12 @@ static Point TranslateXYToTileCoord(const ViewPort *vp, int x, int y)
int min_coord = _settings_game.construction.freeform_edges ? TILE_SIZE : 0;
- for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(a + (int)max(z, 4u) - 4, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + (int)max(z, 4u) - 4, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2;
- for (uint malus = 3; malus > 0; malus--) z = GetSlopePixelZ(Clamp(a + (int)max(z, malus) - (int)malus, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + (int)max(z, malus) - (int)malus, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2;
- for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(a + (int)z, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + (int)z, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2;
+ for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(a + max(z, 4) - 4, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + max(z, 4) - 4, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2;
+ for (int malus = 3; malus > 0; malus--) z = GetSlopePixelZ(Clamp(a + max(z, malus) - malus, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + max(z, malus) - malus, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2;
+ for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(a + z, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + z, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2;
- pt.x = Clamp(a + (int)z, min_coord, MapMaxX() * TILE_SIZE - 1);
- pt.y = Clamp(b + (int)z, min_coord, MapMaxY() * TILE_SIZE - 1);
+ pt.x = Clamp(a + z, min_coord, MapMaxX() * TILE_SIZE - 1);
+ pt.y = Clamp(b + z, min_coord, MapMaxY() * TILE_SIZE - 1);
return pt;
}
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index e5e159b56..7d213cf29 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -875,7 +875,7 @@ static Vehicle *FloodVehicleProc(Vehicle *v, void *data)
case VEH_TRAIN:
case VEH_ROAD: {
- byte z = *(byte*)data;
+ int z = *(int*)data;
if (v->z_pos > z) break;
FloodVehicle(v->First());
break;
@@ -892,7 +892,7 @@ static Vehicle *FloodVehicleProc(Vehicle *v, void *data)
*/
static void FloodVehicles(TileIndex tile)
{
- byte z = 0;
+ int z = 0;
if (IsAirportTile(tile)) {
const Station *st = Station::GetByTile(tile);