File tree Expand file tree Collapse file tree 4 files changed +33
-27
lines changed
GeneralsMD/Code/GameEngine
Source/GameLogic/Object/Update/AIUpdate
Source/GameLogic/Object/Update/AIUpdate Expand file tree Collapse file tree 4 files changed +33
-27
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ class JetAIUpdate : public AIUpdateInterface
133133 virtual Bool getTreatAsAircraftForLocoDistToGoal () const ;
134134 virtual Bool shouldDeferCommand (const AICommandType commandType) const ; // /< returns whether the specified command type should be deferred
135135 virtual Bool commandRequiresTakeoff (const AICommandParms* parms) const ; // /< returns whether the specified command requires takeoff
136+ virtual Bool isGuardCommand (const AICommandType commandType) const ; // /< returns whether the specified command type is a guard command
136137 Bool isParkedAt (const Object* obj) const ;
137138
138139private:
Original file line number Diff line number Diff line change @@ -2334,19 +2334,7 @@ void JetAIUpdate::aiDoCommand(const AICommandParms* parms)
23342334 return ;
23352335 }
23362336
2337- switch (parms->m_cmd )
2338- {
2339- case AICMD_GUARD_POSITION:
2340- case AICMD_GUARD_OBJECT:
2341- case AICMD_GUARD_AREA:
2342- case AICMD_HUNT:
2343- setFlag (ALLOW_INTERRUPT_AND_RESUME_OF_CUR_STATE_FOR_RELOAD, true );
2344- break ;
2345- default :
2346- setFlag (ALLOW_INTERRUPT_AND_RESUME_OF_CUR_STATE_FOR_RELOAD, false );
2347- break ;
2348- }
2349-
2337+ setFlag (ALLOW_INTERRUPT_AND_RESUME_OF_CUR_STATE_FOR_RELOAD, isGuardCommand (parms->m_cmd ));
23502338 setFlag (HAS_PENDING_COMMAND, false );
23512339 AIUpdateInterface::aiDoCommand (parms);
23522340}
@@ -2389,6 +2377,20 @@ Bool JetAIUpdate::commandRequiresTakeoff(const AICommandParms* parms) const
23892377 }
23902378}
23912379
2380+ Bool JetAIUpdate::isGuardCommand (const AICommandType commandType) const
2381+ {
2382+ switch (commandType)
2383+ {
2384+ case AICMD_GUARD_AREA:
2385+ case AICMD_GUARD_OBJECT:
2386+ case AICMD_GUARD_POSITION:
2387+ case AICMD_HUNT:
2388+ return true ;
2389+ default :
2390+ return false ;
2391+ }
2392+ }
2393+
23922394// -------------------------------------------------------------------------------------------------
23932395void JetAIUpdate::friend_setAllowAirLoco (Bool allowAirLoco)
23942396{
Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ class JetAIUpdate : public AIUpdateInterface
142142 virtual Bool getTreatAsAircraftForLocoDistToGoal () const ;
143143 virtual Bool shouldDeferCommand (const AICommandType commandType) const ; // /< returns whether the specified command type should be deferred
144144 virtual Bool commandRequiresTakeoff (const AICommandParms* parms) const ; // /< returns whether the specified command requires takeoff
145+ virtual Bool isGuardCommand (const AICommandType commandType) const ; // /< returns whether the specified command type is a guard command
145146 Bool isParkedAt (const Object* obj) const ;
146147
147148private:
Original file line number Diff line number Diff line change @@ -2569,20 +2569,7 @@ void JetAIUpdate::aiDoCommand(const AICommandParms* parms)
25692569 return ;
25702570 }
25712571
2572- switch (parms->m_cmd )
2573- {
2574- case AICMD_GUARD_POSITION:
2575- case AICMD_GUARD_OBJECT:
2576- case AICMD_GUARD_AREA:
2577- case AICMD_HUNT:
2578- case AICMD_GUARD_RETALIATE:
2579- setFlag (ALLOW_INTERRUPT_AND_RESUME_OF_CUR_STATE_FOR_RELOAD, true );
2580- break ;
2581- default :
2582- setFlag (ALLOW_INTERRUPT_AND_RESUME_OF_CUR_STATE_FOR_RELOAD, false );
2583- break ;
2584- }
2585-
2572+ setFlag (ALLOW_INTERRUPT_AND_RESUME_OF_CUR_STATE_FOR_RELOAD, isGuardCommand (parms->m_cmd ));
25862573 setFlag (HAS_PENDING_COMMAND, false );
25872574 AIUpdateInterface::aiDoCommand (parms);
25882575}
@@ -2625,6 +2612,21 @@ Bool JetAIUpdate::commandRequiresTakeoff(const AICommandParms* parms) const
26252612 }
26262613}
26272614
2615+ Bool JetAIUpdate::isGuardCommand (const AICommandType commandType) const
2616+ {
2617+ switch (commandType)
2618+ {
2619+ case AICMD_GUARD_AREA:
2620+ case AICMD_GUARD_OBJECT:
2621+ case AICMD_GUARD_POSITION:
2622+ case AICMD_GUARD_RETALIATE:
2623+ case AICMD_HUNT:
2624+ return true ;
2625+ default :
2626+ return false ;
2627+ }
2628+ }
2629+
26282630// -------------------------------------------------------------------------------------------------
26292631void JetAIUpdate::friend_setAllowAirLoco (Bool allowAirLoco)
26302632{
You can’t perform that action at this time.
0 commit comments