mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
(svn r9299) -Fix (FS#675,FS#660): Small micro-movements on airports (of <4 pixels) caused odd aircraft movements. On oilrigs, this caused a full crash as movement would take helicopter out of airport/station tile.
Corrected by maneuvering aircraft directly over these tiny movements, rather than relying on movement by changing facing.
This commit is contained in:
parent
408442d575
commit
f44cbfe1fe
@ -1063,6 +1063,23 @@ static bool AircraftController(Vehicle *v)
|
|||||||
if (v->load_unload_time_rem != 0) v->load_unload_time_rem--;
|
if (v->load_unload_time_rem != 0) v->load_unload_time_rem--;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
|
GetNewVehiclePosResult gp;
|
||||||
|
|
||||||
|
if (dist < 4) {
|
||||||
|
/* move vehicle one pixel towards target */
|
||||||
|
gp.x = (v->x_pos != (x + amd->x)) ?
|
||||||
|
v->x_pos + ((x + amd->x > v->x_pos) ? 1 : -1) :
|
||||||
|
v->x_pos;
|
||||||
|
gp.y = (v->y_pos != (y + amd->y)) ?
|
||||||
|
v->y_pos + ((y + amd->y > v->y_pos) ? 1 : -1) :
|
||||||
|
v->y_pos;
|
||||||
|
|
||||||
|
/* Oilrigs must keep v->tile as st->airport_tile, since the landing pad is in a non-airport tile */
|
||||||
|
gp.new_tile = (st->airport_type == AT_OILRIG) ? st->airport_tile : TileVirtXY(gp.x, gp.y);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
/* Turn. Do it slowly if in the air. */
|
/* Turn. Do it slowly if in the air. */
|
||||||
Direction newdir = GetDirectionTowards(v, x + amd->x, y + amd->y);
|
Direction newdir = GetDirectionTowards(v, x + amd->x, y + amd->y);
|
||||||
if (newdir != v->direction) {
|
if (newdir != v->direction) {
|
||||||
@ -1075,7 +1092,9 @@ static bool AircraftController(Vehicle *v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Move vehicle. */
|
/* Move vehicle. */
|
||||||
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
|
gp = GetNewVehiclePos(v);
|
||||||
|
}
|
||||||
|
|
||||||
v->tile = gp.new_tile;
|
v->tile = gp.new_tile;
|
||||||
/* If vehicle is in the air, use tile coordinate 0. */
|
/* If vehicle is in the air, use tile coordinate 0. */
|
||||||
// if (amd->flag & (AMED_TAKEOFF | AMED_SLOWTURN | AMED_LAND)) v->tile = 0;
|
// if (amd->flag & (AMED_TAKEOFF | AMED_SLOWTURN | AMED_LAND)) v->tile = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user