(svn r11051) [NewGRF_ports] -Feature: Added SHORT TAKEOFF capability.
If current state is TAKEOFF, and aircraft is SHORT_STRIP capable, then it performs the TAKEOFF action and switches to SMALLSTARTTAKEOFF heading.
Translation is made of the aircraft heading, such that if the large version is encountered when the aircraft is looking for the SMALL version, it acts on the large version. This does NOT happen the other way around. A large aircraft will not react to a small aircraft state.
San Francisco updated to use SMALL takeoffs.
Binary file bin/data/realworldairports.grf has changed
--- a/src/aircraft_cmd.cpp Sun Sep 02 11:58:58 2007 +0000
+++ b/src/aircraft_cmd.cpp Thu Sep 06 19:42:48 2007 +0000
@@ -1771,12 +1771,12 @@
static void AircraftEventHandler_TakeOff(Vehicle *v, const AirportFTAClass *apc)
{
PlayAircraftSound(v); // play takeoffsound for airplanes
- v->u.air.state = STARTTAKEOFF;
+ v->u.air.state = (AircraftVehInfo(v->engine_type)->subtype & AIR_FAST) == 0 ? SMALLSTARTTAKEOFF : STARTTAKEOFF;
}
static void AircraftEventHandler_StartTakeOff(Vehicle *v, const AirportFTAClass *apc)
{
- v->u.air.state = ENDTAKEOFF;
+ v->u.air.state = (AircraftVehInfo(v->engine_type)->subtype & AIR_FAST) == 0 ? SMALLENDTAKEOFF : ENDTAKEOFF;
v->UpdateDeltaXY(INVALID_DIR);
}
@@ -1831,6 +1831,8 @@
//TODO: if current order = OT_GOTO_DEPOT, search for an explicit HANGAR order, and follow that. else LAND if possible
+ /*TODO: THIS CODE APPEARS TO BE UNRECONSTRUCTED ... UPDATE REQUIRED */
+
// {32,FLYING,NOTHING_block,37}, {32,LANDING,N,33}, {32,HELILANDING,N,41},
// if it is an airplane, look for LANDING, for helicopter HELILANDING
// it is possible to choose from multiple landing runways, so loop until a free one is found
@@ -1943,6 +1945,11 @@
case ENDTAKEOFF: return AircraftEventHandler_EndTakeOff;
case LANDING: return AircraftEventHandler_Landing;
case ENDLANDING: return AircraftEventHandler_EndLanding;
+ case SMALLTAKEOFF: return AircraftEventHandler_TakeOff;
+ case SMALLSTARTTAKEOFF: return AircraftEventHandler_StartTakeOff;
+ case SMALLENDTAKEOFF: return AircraftEventHandler_EndTakeOff;
+ case SMALLLANDING: return AircraftEventHandler_Landing;
+ case SMALLENDLANDING: return AircraftEventHandler_EndLanding;
case HELITAKEOFF: return AircraftEventHandler_HeliTakeOff;
case HELIENDTAKEOFF: return AircraftEventHandler_HeliEndTakeOff;
case HELILANDING: return AircraftEventHandler_HeliLanding;
@@ -1976,7 +1983,9 @@
AirportFTA *current = &apc->layout[v->u.air.pos];
/* we have arrived in an important state (eg terminal, hangar, etc.) */
- if (amd->state == v->u.air.state) {
+ if ((amd->state == v->u.air.state) ||
+ ((amd->state >= HANGAR && amd->state <= SMALLHANGAR) && // if position state is a normal aircraft state
+ (amd->state == ((AircraftVehInfo(v->engine_type)->subtype & AIR_FAST) == 0 ? v->u.air.state - 0x08 : v->u.air.state)))) { //offset SMALL aircraft down into normal range
byte prev_pos = v->u.air.pos; // location could be changed in state, so save it before-hand
byte prev_state = v->u.air.state;
MapStateToHandler(v->u.air.state)(v, apc);
--- a/src/airport.h Sun Sep 02 11:58:58 2007 +0000
+++ b/src/airport.h Thu Sep 06 19:42:48 2007 +0000
@@ -57,11 +57,16 @@
ENDTAKEOFF = 0x43,
LANDING = 0x44,
ENDLANDING = 0x45,
- SHORTTAKEOFF = 0x49, /* Only used in movement command choices. If used as the heading in the first command element, treated as TAKEOFF.
+ SMALLHANGAR = 0x48,
+ SMALLTAKEOFF = 0x49, /* Only used in movement command choices. If used as the heading in the first command element, treated as TAKEOFF.
* This is best placed on the TAKEOFF line at the start of the runway. The aircraft will make the acceleration noise,
* and then you give the instruction of where to go to for the SHORTTAKEOFF instruction sequence. eg.:
* { 40, TAKEOFF, RUNWAY_OUT_block, 0 }, { 40, SHORTTAKEOFF, RUNWAY_OUT_block2, 42 }, { 40, 0, RUNWAY_OUT_block2, 41 },
*/
+ SMALLSTARTTAKEOFF = 0x4A,
+ SMALLENDTAKEOFF = 0x4B,
+ SMALLLANDING = 0x4C,
+ SMALLENDLANDING = 0x4D,
HELITAKEOFF = 0x51,
HELIENDTAKEOFF = 0x53,
HELILANDING = 0x54,