From cd369308aaea64057a5bcd09a4d2156f8974d04d Mon Sep 17 00:00:00 2001 From: Darkvater Date: Tue, 22 Feb 2005 19:38:44 +0000 Subject: (svn r1905) - Fix: [ 1118810 ] openttd: ship_cmd.c:642 ... Assertion failed. Mapwrap fixed in ship_cmd.c (was implicitely ok before biggermaps). - CodeChange: rename all vehicle controllers to ...Controller for their similar behaviour --- aircraft_cmd.c | 10 ++++------ roadveh_cmd.c | 4 ++-- ship_cmd.c | 3 +-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/aircraft_cmd.c b/aircraft_cmd.c index f9641782f..526acc6c5 100644 --- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -821,7 +821,7 @@ static byte GetAircraftFlyingAltitude(const Vehicle *v) return maxz; } -static bool Aircraft_5(Vehicle *v) +static bool AircraftController(Vehicle *v) { Station *st; const AirportMovingData *amd; @@ -876,7 +876,7 @@ static bool Aircraft_5(Vehicle *v) if (amd->flag & AMED_HELI_LOWER) { if (UpdateAircraftSpeed(v)) { if (st->airport_tile == 0) { - // FIXME - Aircraft_5 -> if station no longer exists, do not land + // FIXME - AircraftController -> if station no longer exists, do not land // helicopter will circle until sign disappears, then go to next order // * what to do when it is the only order left, right now it just stays in 1 place v->u.air.state = FLYING; @@ -988,8 +988,6 @@ static bool Aircraft_5(Vehicle *v) if (amd->flag & AMED_LAND) { if (st->airport_tile == 0) { - //FIXME -- FIXED - Aircraft_5 -> if station no longer exists, do not land - // * what to do when it is the only order left, right now it just stays in 1 place? v->u.air.state = FLYING; AircraftNextAirportPos_and_Order(v); // get aircraft back on running altitude @@ -1725,7 +1723,7 @@ static void AirportClearBlock(Vehicle *v, const AirportFTAClass *Airport) static void AirportGoToNextPosition(Vehicle *v, const AirportFTAClass *Airport) { // if aircraft is not in position, wait until it is - if (!Aircraft_5(v)) {return;} + if (!AircraftController(v)) {return;} AirportClearBlock(v, Airport); AirportMove(v, Airport); // move aircraft to next position @@ -2099,7 +2097,7 @@ void UpdateAirplanesOnNewStation(Station *st) v->u.air.pos = v->u.air.previous_pos = ap->entry_point; v->u.air.state = FLYING; // landing plane needs to be reset to flying height (only if in pause mode upgrade, - // in normal mode, plane is reset in Aircraft_5. It doesn't hurt for FLYING + // in normal mode, plane is reset in AircraftController. It doesn't hurt for FLYING GetNewVehiclePos(v, &gp); // set new position x,y,z SetAircraftPosition(v, gp.x, gp.y, GetAircraftFlyingAltitude(v)); diff --git a/roadveh_cmd.c b/roadveh_cmd.c index 25270fc5e..eca9c65b7 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -1214,7 +1214,7 @@ static inline void ClearSlot(Vehicle *v, RoadStop *rs) rs->slot[v->u.road.slotindex] = INVALID_SLOT; } -static void RoadVehEventHandler(Vehicle *v) +static void RoadVehController(Vehicle *v) { GetNewVehiclePosResult gp; byte new_dir, old_dir; @@ -1592,7 +1592,7 @@ static void AgeRoadVehCargo(Vehicle *v) void RoadVeh_Tick(Vehicle *v) { AgeRoadVehCargo(v); - RoadVehEventHandler(v); + RoadVehController(v); } static void CheckIfRoadVehNeedsService(Vehicle *v) diff --git a/ship_cmd.c b/ship_cmd.c index 537059ffd..e5a186089 100644 --- a/ship_cmd.c +++ b/ship_cmd.c @@ -691,7 +691,6 @@ static const byte _ship_subcoord[4][6][3] = { } }; - static void ShipController(Vehicle *v) { GetNewVehiclePosResult gp; @@ -779,7 +778,7 @@ static void ShipController(Vehicle *v) } } else { // new tile - if (TileX(gp.new_tile) == MapMaxX() || TileY(gp.new_tile) == MapMaxY()) + if (TileX(gp.new_tile) >= MapMaxX() || TileY(gp.new_tile) >= MapMaxY()) goto reverse_direction; dir = ShipGetNewDirectionFromTiles(gp.new_tile, gp.old_tile); -- cgit v1.2.3-70-g09d2