Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand All @@ -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()
{
Expand All @@ -179,6 +181,7 @@ class ParkingPlaceBehavior : public UpdateModule,
m_door = DOOR_NONE_AVAILABLE;
m_objectInSpace = INVALID_ID;
m_reservedForExit = false;
m_deferredRunwayReservationForTakeoff = false;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -468,18 +469,43 @@ void ParkingPlaceBehavior::transferRunwayReservationToNextInLineForTakeoff(Objec
}
}

//-------------------------------------------------------------------------------------------------
Bool ParkingPlaceBehavior::deferUnsequencedRunwayReservationForTakeoff(UnsignedInt spaceIndex, Bool forLanding)
{
if (m_spaces.size() > m_runways.size() && spaceIndex >= m_runways.size())
{
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)
{
buildInfo();
purgeDead();

Int runway = -1;
for (std::vector<ParkingPlaceInfo>::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;
}
}
Expand Down
Loading