(svn r10906) [NewGRF_ports] -Codechange: remove oilrig FTA/FSM stuff from the code as that is already exported to a newgrf. NewGRF_ports
authorrubidium
Wed, 15 Aug 2007 09:42:16 +0000
branchNewGRF_ports
changeset 6823 afccaf7e9674
parent 6822 5ac6f657d6fc
child 6824 6324369ce26e
(svn r10906) [NewGRF_ports] -Codechange: remove oilrig FTA/FSM stuff from the code as that is already exported to a newgrf.
src/airport.cpp
src/airport_movement.h
src/newgrf_engine.cpp
--- a/src/airport.cpp	Tue Aug 14 23:42:01 2007 +0000
+++ b/src/airport.cpp	Wed Aug 15 09:42:16 2007 +0000
@@ -22,8 +22,6 @@
 //#define DEBUG_AIRPORT false
 
 AirportFTAClass *DummyAirport;
-static AirportFTAClass *Oilrig;
-
 
 void InitializeAirports()
 {
@@ -40,26 +38,11 @@
 		0,
 		0
 	);
-
-	Oilrig = new AirportFTAClass(
-		_airport_moving_data_oilrig,
-		NULL,
-		_airport_helipad_heliport_oilrig,
-		_airport_entries_heliport_oilrig,
-		AirportFTAClass::HELICOPTERS,
-		_airport_fta_heliport_oilrig,
-		NULL,
-		0,
-		1, 1,
-		54,
-		3
-	);
 }
 
 void UnInitializeAirports()
 {
 	delete DummyAirport;
-	delete Oilrig;
 }
 
 
--- a/src/airport_movement.h	Tue Aug 14 23:42:01 2007 +0000
+++ b/src/airport_movement.h	Wed Aug 15 09:42:16 2007 +0000
@@ -17,19 +17,6 @@
 	{   96,    0, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN,     {DIR_N}, 0, 0 },
 };
 
-// Oilrig
-static AirportMovingData _airport_moving_data_oilrig[9] = {
-	{   31,    9, 0, AMED_EXACTPOS,                   {DIR_NE}, 0, 0 }, // 0 - At oilrig terminal
-	{   28,    9, 0, AMED_HELI_RAISE,                 {DIR_N}, 0, 0 }, // 1 - Take off (play sound)
-	{   23,    9, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N}, 0, 0 }, // 2 - In position above landing spot helicopter
-	{   23,    9, 0, AMED_HELI_LOWER,                 {DIR_N}, 0, 0 }, // 3 - Land
-	{   28,    9, 0, 0,                               {DIR_N}, 0, 0 }, // 4 - Goto terminal on ground
-	{  -31,   69, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N}, 0, 0 }, // 5 - circle #1 (north-east)
-	{  -31,  -49, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N}, 0, 0 }, // 6 - circle #2 (north-west)
-	{   69,  -49, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N}, 0, 0 }, // 7 - circle #3 (south-west)
-	{   69,    9, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N}, 0, 0 }, // 8 - circle #4 (south)
-};
-
 ///////////////////////////////////////////////////////////////////////
 /////**********Movement Machine on Airports*********************///////
 static byte _airport_entries_dummy[] = {0, 1, 2, 3};
@@ -41,21 +28,4 @@
 	{ MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE
 };
 
-// heliports, oilrigs don't have depots
-static byte _airport_helipad_heliport_oilrig[] = { 1, 1 };
-static byte _airport_entries_heliport_oilrig[] = { 7, 7, 7, 7 };
-static AirportFTAbuildup _airport_fta_heliport_oilrig[] = {
-	{ 0, HELIPAD1, HELIPAD1_block, 1 },
-	{ 1, HELITAKEOFF, NOTHING_block, 0 }, // takeoff
-	{ 2, 255, AIRPORT_BUSY_block, 0 }, { 2, HELILANDING, 0, 3 }, { 2, HELITAKEOFF, 0, 1 },
-	{ 3, HELILANDING, AIRPORT_BUSY_block, 4 },
-	{ 4, HELIENDLANDING, AIRPORT_BUSY_block, 4 }, { 4, HELIPAD1, HELIPAD1_block, 0 }, { 4, HELITAKEOFF, 0, 2 },
-	// In Air
-	{ 5, 0, NOTHING_block, 6 },
-	{ 6, 0, NOTHING_block, 7 },
-	{ 7, 0, NOTHING_block, 8 },
-	{ 8, FLYING, NOTHING_block, 5 }, { 8, HELILANDING, HELIPAD1_block, 2 }, // landing
-	{ MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE
-};
-
 #endif /* AIRPORT_MOVEMENT_H */
--- a/src/newgrf_engine.cpp	Tue Aug 14 23:42:01 2007 +0000
+++ b/src/newgrf_engine.cpp	Wed Aug 15 09:42:16 2007 +0000
@@ -592,20 +592,14 @@
 				uint16 altitude = v->z_pos - w->z_pos; // Aircraft height - shadow height
 				byte airporttype;
 
-				switch (GetStation(v->u.air.targetairport)->airport_type) {
-					/* Note, Helidepot and Helistation are treated as small airports
-					 * as they are at ground level. */
-					case AT_HELIDEPOT:
-					case AT_HELISTATION:
-					case AT_COMMUTER:
-					case AT_SMALL:         airporttype = ATP_TTDP_SMALL; break;
-					case AT_METROPOLITAN:
-					case AT_INTERNATIONAL:
-					case AT_INTERCON:
-					case AT_LARGE:         airporttype = ATP_TTDP_LARGE; break;
-					case AT_HELIPORT:      airporttype = ATP_TTDP_HELIPORT; break;
-					case AT_OILRIG:        airporttype = ATP_TTDP_OILRIG; break;
-					default:               airporttype = ATP_TTDP_LARGE; break;
+				const FSMportsSpec *fps = GetStation(v->u.air.targetairport)->fsmportsspeclist[1].spec;
+
+				if (fps->flags & (AirportFTAClass::AIRPLANES | AirportFTAClass::SEAPLANES)) {
+					airporttype = (fps->flags & AirportFTAClass::SHORT_STRIP) ? ATP_TTDP_SMALL : ATP_TTDP_LARGE;
+				} else if (fps == GetCustomFSMportsSpecByGrf(0x4450414F, 3)) {
+					airporttype = ATP_TTDP_OILRIG;
+				} else {
+					airporttype = ATP_TTDP_HELIPORT;
 				}
 
 				return (altitude << 8) | airporttype;