(svn r10960) [NewGRF_ports] -Change: Remove delta_z from the FSMport class. Will need to replace code at places marked with TODO. NewGRF_ports
authorrichk
Tue, 21 Aug 2007 20:03:53 +0000
branchNewGRF_ports
changeset 6857 5012c47e576b
parent 6856 0e8e4ebf23ff
child 6858 c51e5f508759
(svn r10960) [NewGRF_ports] -Change: Remove delta_z from the FSMport class. Will need to replace code at places marked with TODO.
src/aircraft_cmd.cpp
src/fsmport.h
src/newgrf_engine.cpp
src/water_cmd.cpp
--- a/src/aircraft_cmd.cpp	Tue Aug 21 19:33:49 2007 +0000
+++ b/src/aircraft_cmd.cpp	Tue Aug 21 20:03:53 2007 +0000
@@ -1135,7 +1135,8 @@
 			v->tile = st->airport_tile;
 
 			/* Find altitude of landing position. */
-			int z = GetTileMaxZ(v->tile) + 1 + afc->delta_z;
+			//TODO: airport->delta_z no longer used. need to get actual height of individual tile of layout
+			int z = GetTileMaxZ(v->tile) + 1; // + afc->delta_z;
 
 			if (z == v->z_pos) {
 				Vehicle *u = v->next->next;
--- a/src/fsmport.h	Tue Aug 21 19:33:49 2007 +0000
+++ b/src/fsmport.h	Tue Aug 21 20:03:53 2007 +0000
@@ -34,7 +34,7 @@
 struct FSMPortClass {
 public:
 	FSMPortClass(FSMportsSpec *spec_) : moving_data(NULL), layout(NULL), num_positions(0), depots(NULL),
-			num_depots(0), size_x(0), size_y(0), delta_z(0), catchment(0), spec(spec_) {}
+			num_depots(0), size_x(0), size_y(0), catchment(0), spec(spec_) {}
 
 	~FSMPortClass();
 
@@ -53,7 +53,6 @@
 
 	byte size_x;
 	byte size_y;
-	byte delta_z;                         // Z adjustment for helicopter pads
 	byte catchment;
 
 	FSMportsSpec *spec;
--- a/src/newgrf_engine.cpp	Tue Aug 21 19:33:49 2007 +0000
+++ b/src/newgrf_engine.cpp	Tue Aug 21 20:03:53 2007 +0000
@@ -289,7 +289,9 @@
 			return AMS_TTDP_CLIMBING;
 
 		case HELITAKEOFF: // Helicopter is moving to take off position.
-			if (afc->delta_z == 0) {
+			//TODO: airport->delta_z no longer used. need to get actual height of individual tile in layout
+			//TODO: AMED_HELI_RAISE no longer used. decide based on height differences from v->zpos to target layout height
+			if (afc->MovingData(v->u.air.pos)->z == 0) {
 				return amdflag & AMED_HELI_RAISE ?
 					AMS_TTDP_HELI_TAKEOFF_AIRPORT : AMS_TTDP_TO_JUNCTION;
 			} else {
@@ -310,8 +312,10 @@
 		case HELILANDING:
 		case HELIENDLANDING: // Helicoptor is decending.
 			if (amdflag & AMED_HELI_LOWER) {
-				return afc->delta_z == 0 ?
-					AMS_TTDP_HELI_LAND_AIRPORT : AMS_TTDP_HELI_LAND_HELIPORT;
+				//TODO: airport->delta_z no longer used. need to get actual height of individual tile in layout
+				//return afc->delta_z == 0 ?
+				//	AMS_TTDP_HELI_LAND_AIRPORT : AMS_TTDP_HELI_LAND_HELIPORT;
+				return AMS_TTDP_HELI_LAND_AIRPORT;
 			} else {
 				return AMS_TTDP_FLIGHT_TO_TOWER;
 			}
--- a/src/water_cmd.cpp	Tue Aug 21 19:33:49 2007 +0000
+++ b/src/water_cmd.cpp	Tue Aug 21 20:03:53 2007 +0000
@@ -612,11 +612,14 @@
 	if (IsTileType(tile, MP_STATION) && IsAirport(tile)) {
 		const Station *st = GetStationByTile(tile);
 		const AirportFTAClass *airport = st->Airport();
+
+		//TODO: account for irregular shaped airports, and orientation
 		for (uint x = 0; x < airport->size_x; x++) {
 			for (uint y = 0; y < airport->size_y; y++) {
 				tile = TILE_ADDXY(st->airport_tile, x, y);
-				Vehicle *v = FindVehicleOnTileZ(tile, 1 + airport->delta_z);
-				if (v != NULL && (v->vehstatus & VS_CRASHED) == 0) return v;
+				//TODO: airport->delta_z no longer used. need to get actual height of individual tile in layout
+				//Vehicle *v = FindVehicleOnTileZ(tile, 1 + airport->delta_z);
+				//if (v != NULL && (v->vehstatus & VS_CRASHED) == 0) return v;
 			}
 		}
 
@@ -657,7 +660,8 @@
 				const Station *st = GetStationByTile(v->tile);
 				const AirportFTAClass *airport = st->Airport();
 
-				if (v->z_pos != airport->delta_z + 1) return;
+				//TODO: airport->delta_z no longer used. need to get actual height of individual tile in layout
+				//if (v->z_pos != airport->delta_z + 1) return;
 			}
 			Vehicle *u;