Skip to content

Commit df75f5d

Browse files
committed
refactor(perf): change aiDoCommand to take non-const pointer for move semantics
1 parent 042fc81 commit df75f5d

24 files changed

+26
-27
lines changed

GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ class AICommandParmsStorage
449449
Path* m_path;
450450

451451
public:
452-
void store(const AICommandParms& parms);
452+
void store(AICommandParms& parms);
453453
void reconstitute(AICommandParms& parms) const;
454454
void doXfer(Xfer *xfer);
455455
AICommandType getCommandType() const { return m_cmd; }
@@ -466,7 +466,7 @@ class AICommandInterface
466466
{
467467
public:
468468

469-
virtual void aiDoCommand(const AICommandParms* parms) = 0;
469+
virtual void aiDoCommand(AICommandParms* parms) = 0;
470470

471471
inline void aiMoveToPosition( const Coord3D *pos, CommandSourceType cmdSource )
472472
{

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface
353353
virtual void onObjectCreated();
354354
virtual void doQuickExit( const std::vector<Coord3D>* path ); ///< get out of this Object
355355

356-
virtual void aiDoCommand(const AICommandParms* parms);
356+
virtual void aiDoCommand(AICommandParms* parms);
357357

358358
virtual const Coord3D *getGuardLocation( void ) const { return &m_locationToGuard; }
359359
virtual ObjectID getGuardObject( void ) const { return m_objectToGuard; }

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AssaultTransportAIUpdate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class AssaultTransportAIUpdate : public AIUpdateInterface, public AssaultTranspo
9090
AssaultTransportAIUpdate( Thing *thing, const ModuleData* moduleData );
9191
// virtual destructor prototype provided by memory pool declaration
9292

93-
virtual void aiDoCommand(const AICommandParms* parms);
93+
virtual void aiDoCommand(AICommandParms* parms);
9494
virtual Bool isIdle() const;
9595
virtual UpdateSleepTime update();
9696
virtual AssaultTransportAIInterface* getAssaultTransportAIInterface() { return this; }

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ChinookAIUpdate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class ChinookAIUpdate : public SupplyTruckAIUpdate
8686
// virtual destructor prototype provided by memory pool declaration
8787

8888
virtual UpdateSleepTime update();
89-
virtual void aiDoCommand(const AICommandParms* parms);
89+
virtual void aiDoCommand(AICommandParms* parms);
9090
virtual Bool chooseLocomotorSet(LocomotorSetType wst);
9191
// this is present solely for some transports to override, so that they can land before
9292
// allowing people to exit...

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeployStyleAIUpdate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class DeployStyleAIUpdate : public AIUpdateInterface
9898
DeployStyleAIUpdate( Thing *thing, const ModuleData* moduleData );
9999
// virtual destructor prototype provided by memory pool declaration
100100

101-
virtual void aiDoCommand(const AICommandParms* parms);
101+
virtual void aiDoCommand(AICommandParms* parms);
102102
virtual Bool isIdle() const;
103103
virtual UpdateSleepTime update();
104104

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class DozerAIUpdate : public AIUpdateInterface, public DozerAIInterface
266266
// the following methods must be overridden so that if a player issues a command the dozer
267267
// can exit the internal state machine and do whatever the player says
268268
//
269-
virtual void aiDoCommand(const AICommandParms* parms);
269+
virtual void aiDoCommand(AICommandParms* parms);
270270

271271

272272
protected:

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlightDeckBehavior.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class FlightDeckBehavior : public AIUpdateInterface,
148148
virtual Bool calcBestParkingAssignment( ObjectID id, Coord3D *pos, Int *oldIndex = NULL, Int *newIndex = NULL );
149149

150150
// AIUpdateInterface
151-
virtual void aiDoCommand(const AICommandParms* parms);
151+
virtual void aiDoCommand(AICommandParms* parms);
152152

153153
virtual const std::vector<Coord3D>* getTaxiLocations( ObjectID id ) const;
154154
virtual const std::vector<Coord3D>* getCreationLocations( ObjectID id ) const;

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class HackInternetAIUpdate : public AIUpdateInterface, public HackInternetAIInte
195195
HackInternetAIUpdate( Thing *thing, const ModuleData* moduleData );
196196
// virtual destructor prototype provided by memory pool declaration
197197

198-
virtual void aiDoCommand(const AICommandParms* parms);
198+
virtual void aiDoCommand(AICommandParms* parms);
199199

200200
Real getPackUnpackVariationFactor() const { return getHackInternetAIUpdateModuleData()->m_packUnpackVariationFactor; }
201201
UnsignedInt getUnpackTime() const;

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class JetAIUpdate : public AIUpdateInterface
8787
virtual JetAIUpdate* getJetAIUpdate() { return this; }
8888
virtual const JetAIUpdate* getJetAIUpdate() const { return this; }
8989

90-
virtual void aiDoCommand(const AICommandParms* parms);
90+
virtual void aiDoCommand(AICommandParms* parms);
9191
virtual Bool chooseLocomotorSet(LocomotorSetType wst);
9292
virtual void setLocomotorGoalNone();
9393
virtual Bool isIdle() const;

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/POWTruckAIUpdate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class POWTruckAIUpdate : public AIUpdateInterface,
105105
// the following methods must be overridden so that if a player issues a command the dozer
106106
// can exit the internal state machine and do whatever the player says
107107
//
108-
virtual void aiDoCommand( const AICommandParms *parms );
108+
virtual void aiDoCommand( AICommandParms *parms );
109109

110110
protected:
111111

0 commit comments

Comments
 (0)