Skip to content

Commit ffa98ad

Browse files
committed
bugfix: Make healed helicopters follow airfield rally point
Signed-off-by: tintinhamans <5984296+tintinhamans@users.noreply.github.com>
1 parent 39d8406 commit ffa98ad

File tree

4 files changed

+69
-1
lines changed

4 files changed

+69
-1
lines changed

Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,23 @@ UpdateSleepTime ChinookAIUpdate::update()
10311031
{
10321032
// we're completely healed, so take off again
10331033
pp->setHealee(getObject(), false);
1034+
1035+
// TheSuperHackers @bugfix arcticdolphin 08/02/2026 Move healed Chinook to rally point if present.
1036+
#if !RETAIL_COMPATIBLE_CRC
1037+
{
1038+
Object *airfield = TheGameLogic->findObjectByID( m_airfieldForHealing );
1039+
ExitInterface *exitInterface = airfield ? airfield->getObjectExitInterface() : nullptr;
1040+
const Coord3D *rp = exitInterface ? exitInterface->getRallyPoint() : nullptr;
1041+
if( rp )
1042+
{
1043+
AICommandParms parms( AICMD_MOVE_TO_POSITION, CMD_FROM_AI );
1044+
parms.m_pos = *rp;
1045+
m_pendingCommand.store( parms );
1046+
m_hasPendingCommand = true;
1047+
}
1048+
}
1049+
#endif
1050+
10341051
setMyState(TAKING_OFF, nullptr, nullptr, CMD_FROM_AI);
10351052
}
10361053
else

Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,6 +1775,23 @@ UpdateSleepTime JetAIUpdate::update()
17751775
friend_setAllowAirLoco(true);
17761776
getStateMachine()->clear();
17771777
setLastCommandSource( CMD_FROM_AI );
1778+
1779+
// TheSuperHackers @bugfix arcticdolphin 08/02/2026 Move healed helicopter to rally point if present.
1780+
#if !RETAIL_COMPATIBLE_CRC
1781+
{
1782+
Object *airfield = TheGameLogic->findObjectByID( jet->getProducerID() );
1783+
ExitInterface *exitInterface = airfield ? airfield->getObjectExitInterface() : nullptr;
1784+
const Coord3D *rp = exitInterface ? exitInterface->getRallyPoint() : nullptr;
1785+
if( rp )
1786+
{
1787+
AICommandParms parms( AICMD_MOVE_TO_POSITION, CMD_FROM_AI );
1788+
parms.m_pos = *rp;
1789+
m_mostRecentCommand.store( parms );
1790+
setFlag(HAS_PENDING_COMMAND, true);
1791+
}
1792+
}
1793+
#endif
1794+
17781795
getStateMachine()->setState( TAKING_OFF_AWAIT_CLEARANCE );
17791796
}
17801797
else

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,23 @@ UpdateSleepTime ChinookAIUpdate::update()
10931093
{
10941094
// we're completely healed, so take off again
10951095
pp->setHealee(getObject(), false);
1096+
1097+
// TheSuperHackers @bugfix arcticdolphin 08/02/2026 Move healed Chinook to rally point if present.
1098+
#if !RETAIL_COMPATIBLE_CRC
1099+
{
1100+
Object *airfield = TheGameLogic->findObjectByID( m_airfieldForHealing );
1101+
ExitInterface *exitInterface = airfield ? airfield->getObjectExitInterface() : nullptr;
1102+
const Coord3D *rp = exitInterface ? exitInterface->getRallyPoint() : nullptr;
1103+
if( rp )
1104+
{
1105+
AICommandParms parms( AICMD_MOVE_TO_POSITION, CMD_FROM_AI );
1106+
parms.m_pos = *rp;
1107+
m_pendingCommand.store( parms );
1108+
m_hasPendingCommand = true;
1109+
}
1110+
}
1111+
#endif
1112+
10961113
setMyState(TAKING_OFF, nullptr, nullptr, CMD_FROM_AI);
10971114
}
10981115
else

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState
13471347

13481348
if (ai->getCurrentStateID() != TAXI_TO_TAKEOFF)
13491349
continue;
1350-
1350+
13511351
return otherJet;
13521352
}
13531353
}
@@ -1997,6 +1997,23 @@ UpdateSleepTime JetAIUpdate::update()
19971997
friend_setAllowAirLoco(true);
19981998
getStateMachine()->clear();
19991999
setLastCommandSource( CMD_FROM_AI );
2000+
2001+
// TheSuperHackers @bugfix arcticdolphin 08/02/2026 Move healed helicopter to rally point if present.
2002+
#if !RETAIL_COMPATIBLE_CRC
2003+
{
2004+
Object *airfield = TheGameLogic->findObjectByID( jet->getProducerID() );
2005+
ExitInterface *exitInterface = airfield ? airfield->getObjectExitInterface() : nullptr;
2006+
const Coord3D *rp = exitInterface ? exitInterface->getRallyPoint() : nullptr;
2007+
if( rp )
2008+
{
2009+
AICommandParms parms( AICMD_MOVE_TO_POSITION, CMD_FROM_AI );
2010+
parms.m_pos = *rp;
2011+
m_mostRecentCommand.store( parms );
2012+
setFlag(HAS_PENDING_COMMAND, true);
2013+
}
2014+
}
2015+
#endif
2016+
20002017
getStateMachine()->setState( TAKING_OFF_AWAIT_CLEARANCE );
20012018
}
20022019
else

0 commit comments

Comments
 (0)