summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-08-13 14:46:16 +0000
committerrubidium <rubidium@openttd.org>2006-08-13 14:46:16 +0000
commit4b030f190c93a46e760808faaf9cd719605b02f0 (patch)
treef984b902ff0500a34efc88030e94a2e4bbfe34ba
parente885129ab8e8bb0336a6791c8d1e062fffb3120a (diff)
downloadopenttd-4b030f190c93a46e760808faaf9cd719605b02f0.tar.xz
(svn r5883) -Fix [FS#272]: use the height of the edge of the map for shadows of aircrafts that are outside the map; similar to r5841, caused by r5794.
-rw-r--r--aircraft_cmd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 4493940ed..b883b51c8 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -764,7 +764,8 @@ static void HelicopterTickHandler(Vehicle *v)
static void SetAircraftPosition(Vehicle *v, int x, int y, int z)
{
Vehicle *u;
- int yt;
+ int safe_x;
+ int safe_y;
v->x_pos = x;
v->y_pos = y;
@@ -779,10 +780,13 @@ static void SetAircraftPosition(Vehicle *v, int x, int y, int z)
u = v->next;
- yt = y - ((v->z_pos-GetSlopeZ(x, y-1)) >> 3);
+ safe_x = clamp(x, 0, MapMaxX() * TILE_SIZE);
+ safe_y = clamp(y - 1, 0, MapMaxY() * TILE_SIZE);
u->x_pos = x;
- u->y_pos = yt;
- u->z_pos = GetSlopeZ(x,yt);
+ u->y_pos = y - ((v->z_pos-GetSlopeZ(safe_x, safe_y)) >> 3);;
+
+ safe_y = clamp(u->y_pos, 0, MapMaxY() * TILE_SIZE);
+ u->z_pos = GetSlopeZ(safe_x, safe_y);
u->cur_image = v->cur_image;
BeginVehicleMove(u);