(svn r1905) - Fix: [ 1118810 ] openttd: ship_cmd.c:642 ... Assertion failed. Mapwrap fixed in ship_cmd.c (was implicitely ok before biggermaps).
authorDarkvater
Tue, 22 Feb 2005 19:38:44 +0000
changeset 1401 56d372a75b74
parent 1400 b8709b34afce
child 1402 05f6d79373ee
(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
roadveh_cmd.c
ship_cmd.c
--- a/aircraft_cmd.c	Tue Feb 22 18:28:20 2005 +0000
+++ b/aircraft_cmd.c	Tue Feb 22 19:38:44 2005 +0000
@@ -821,7 +821,7 @@
 	return maxz;
 }
 
-static bool Aircraft_5(Vehicle *v)
+static bool AircraftController(Vehicle *v)
 {
 	Station *st;
 	const AirportMovingData *amd;
@@ -876,7 +876,7 @@
 	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 @@
 
 	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 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 @@
 					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));
--- a/roadveh_cmd.c	Tue Feb 22 18:28:20 2005 +0000
+++ b/roadveh_cmd.c	Tue Feb 22 19:38:44 2005 +0000
@@ -1214,7 +1214,7 @@
 	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 @@
 void RoadVeh_Tick(Vehicle *v)
 {
 	AgeRoadVehCargo(v);
-	RoadVehEventHandler(v);
+	RoadVehController(v);
 }
 
 static void CheckIfRoadVehNeedsService(Vehicle *v)
--- a/ship_cmd.c	Tue Feb 22 18:28:20 2005 +0000
+++ b/ship_cmd.c	Tue Feb 22 19:38:44 2005 +0000
@@ -691,7 +691,6 @@
 	}
 };
 
-
 static void ShipController(Vehicle *v)
 {
 	GetNewVehiclePosResult gp;
@@ -779,7 +778,7 @@
 		}
 	} 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);