diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h index 8def59d5eb..287364994b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h @@ -140,6 +140,7 @@ class ParkingPlaceBehavior : public UpdateModule, virtual Bool reserveSpace(ObjectID id, Real parkingOffset, PPInfo* info); virtual void releaseSpace(ObjectID id); virtual Bool reserveRunway(ObjectID id, Bool forLanding); + Bool deferUnsequencedRunwayReservationForTakeoff(UnsignedInt spaceIndex, Bool forLanding); virtual void releaseRunway(ObjectID id); virtual void calcPPInfo( ObjectID id, PPInfo *info ); virtual Int getRunwayCount() const { return m_runways.size(); } @@ -158,15 +159,16 @@ class ParkingPlaceBehavior : public UpdateModule, struct ParkingPlaceInfo { - Coord3D m_hangarStart; - Real m_hangarStartOrient; - Coord3D m_location; - Coord3D m_prep; - Real m_orientation; - Int m_runway; - ExitDoorType m_door; - ObjectID m_objectInSpace; - Bool m_reservedForExit; + Coord3D m_hangarStart; + Real m_hangarStartOrient; + Coord3D m_location; + Coord3D m_prep; + Real m_orientation; + Int m_runway; + ExitDoorType m_door; + ObjectID m_objectInSpace; + Bool m_reservedForExit; + Bool m_deferredRunwayReservationForTakeoff; ParkingPlaceInfo() { @@ -179,6 +181,7 @@ class ParkingPlaceBehavior : public UpdateModule, m_door = DOOR_NONE_AVAILABLE; m_objectInSpace = INVALID_ID; m_reservedForExit = false; + m_deferredRunwayReservationForTakeoff = false; } }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index 9c74e34e46..f33e680e62 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -159,6 +159,7 @@ void ParkingPlaceBehavior::purgeDead() { it->m_objectInSpace = INVALID_ID; it->m_reservedForExit = false; + it->m_deferredRunwayReservationForTakeoff = false; if (pu) pu->setHoldDoorOpen(it->m_door, false); } @@ -468,6 +469,26 @@ void ParkingPlaceBehavior::transferRunwayReservationToNextInLineForTakeoff(Objec } } +//------------------------------------------------------------------------------------------------- +Bool ParkingPlaceBehavior::deferUnsequencedRunwayReservationForTakeoff(UnsignedInt spaceIndex, Bool forLanding) +{ + if (spaceIndex == 2 || spaceIndex == 3) + { + Bool& deferred = m_spaces[spaceIndex].m_deferredRunwayReservationForTakeoff; + if (forLanding) + { + deferred = false; + } + else if (!deferred) + { + deferred = true; + return true; + } + } + + return false; +} + //------------------------------------------------------------------------------------------------- Bool ParkingPlaceBehavior::reserveRunway(ObjectID id, Bool forLanding) { @@ -475,11 +496,16 @@ Bool ParkingPlaceBehavior::reserveRunway(ObjectID id, Bool forLanding) purgeDead(); Int runway = -1; - for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) + for (UnsignedInt i = 0; i < m_spaces.size(); ++i) { - if (it->m_objectInSpace == id) + if (m_spaces[i].m_objectInSpace == id) { - runway = it->m_runway; +#if !RETAIL_COMPATIBLE_CRC + if (deferUnsequencedRunwayReservationForTakeoff(i, forLanding)) + return false; +#endif + + runway = m_spaces[i].m_runway; break; } }