Skip to content

Commit e18c47f

Browse files
authored
refactor: Add override keyword to virtual function overrides in GameEngine (TheSuperHackers#2391)
1 parent c52fb6a commit e18c47f

397 files changed

Lines changed: 2731 additions & 2731 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ class AIUpdateModuleData : public UpdateModuleData
199199
#endif
200200

201201
AIUpdateModuleData();
202-
virtual ~AIUpdateModuleData();
202+
virtual ~AIUpdateModuleData() override;
203203

204-
virtual Bool isAiModuleData() const { return true; }
204+
virtual Bool isAiModuleData() const override { return true; }
205205

206206
const LocomotorTemplateVector* findLocomotorTemplateVector(LocomotorSetType t) const;
207207
static void buildFieldParse(MultiIniFieldParse& p);
@@ -291,10 +291,10 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface
291291
AIUpdateInterface( Thing *thing, const ModuleData* moduleData );
292292
// virtual destructor prototype provided by memory pool declaration
293293

294-
virtual AIUpdateInterface* getAIUpdateInterface() { return this; }
294+
virtual AIUpdateInterface* getAIUpdateInterface() override { return this; }
295295

296296
// Disabled conditions to process (AI will still process held status)
297-
virtual DisabledMaskType getDisabledTypesToProcess() const { return MAKE_DISABLED_MASK( DISABLED_HELD ); }
297+
virtual DisabledMaskType getDisabledTypesToProcess() const override { return MAKE_DISABLED_MASK( DISABLED_HELD ); }
298298

299299
// Some very specific, complex behaviors are used by more than one AIUpdate. Here are their interfaces.
300300
virtual DozerAIInterface* getDozerAIInterface() {return nullptr;}
@@ -337,10 +337,10 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface
337337
//Definition of busy -- when explicitly in the busy state. Moving or attacking is not considered busy!
338338
virtual Bool isBusy() const;
339339

340-
virtual void onObjectCreated();
340+
virtual void onObjectCreated() override;
341341
virtual void doQuickExit( std::vector<Coord3D>* path ); ///< get out of this Object
342342

343-
virtual void aiDoCommand(const AICommandParms* parms);
343+
virtual void aiDoCommand(const AICommandParms* parms) override;
344344

345345
virtual const Coord3D *getGuardLocation() const { return &m_locationToGuard; }
346346
virtual ObjectID getGuardObject() const { return m_objectToGuard; }
@@ -511,7 +511,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface
511511
Bool hasHigherPathPriority(AIUpdateInterface *otherAI) const;
512512
void setFinalPosition(const Coord3D *pos) { m_finalPosition = *pos; m_doFinalPosition = false;}
513513

514-
virtual UpdateSleepTime update(); ///< update this object's AI
514+
virtual UpdateSleepTime update() override; ///< update this object's AI
515515

516516
/// if we are attacking "fromID", stop that and attack "toID" instead
517517
void transferAttack(ObjectID fromID, ObjectID toID);
@@ -589,7 +589,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface
589589
interesting oscillations can occur in some situations, with friction being applied
590590
either before or after the locomotive force, making for huge stuttery messes. (srj)
591591
*/
592-
virtual SleepyUpdatePhase getUpdatePhase() const { return PHASE_INITIAL; }
592+
virtual SleepyUpdatePhase getUpdatePhase() const override { return PHASE_INITIAL; }
593593

594594
void setGoalPositionClipped(const Coord3D* in, CommandSourceType cmdSource);
595595

Generals/Code/GameEngine/Include/GameLogic/Module/ActiveBody.h

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -68,46 +68,46 @@ class ActiveBody : public BodyModule
6868
ActiveBody( Thing *thing, const ModuleData* moduleData );
6969
// virtual destructor prototype provided by memory pool declaration
7070

71-
virtual void onDelete();
71+
virtual void onDelete() override;
7272

73-
virtual void attemptDamage( DamageInfo *damageInfo ); ///< try to damage this object
74-
virtual Real estimateDamage( DamageInfoInput& damageInfo ) const;
75-
virtual void attemptHealing( DamageInfo *damageInfo ); ///< try to heal this object
76-
virtual Real getHealth() const; ///< get current health
77-
virtual BodyDamageType getDamageState() const;
78-
virtual void setDamageState( BodyDamageType newState ); ///< control damage state directly. Will adjust hitpoints.
79-
virtual void setAflame( Bool setting );///< This is a major change like a damage state.
73+
virtual void attemptDamage( DamageInfo *damageInfo ) override; ///< try to damage this object
74+
virtual Real estimateDamage( DamageInfoInput& damageInfo ) const override;
75+
virtual void attemptHealing( DamageInfo *damageInfo ) override; ///< try to heal this object
76+
virtual Real getHealth() const override; ///< get current health
77+
virtual BodyDamageType getDamageState() const override;
78+
virtual void setDamageState( BodyDamageType newState ) override; ///< control damage state directly. Will adjust hitpoints.
79+
virtual void setAflame( Bool setting ) override;///< This is a major change like a damage state.
8080

81-
virtual const DamageInfo *getLastDamageInfo() const { return &m_lastDamageInfo; } ///< return info on last damage dealt to this object
82-
virtual UnsignedInt getLastDamageTimestamp() const { return m_lastDamageTimestamp; } ///< return frame of last damage dealt
83-
virtual UnsignedInt getLastHealingTimestamp() const { return m_lastHealingTimestamp; } ///< return frame of last damage dealt
84-
virtual ObjectID getClearableLastAttacker() const { return (m_lastDamageCleared ? INVALID_ID : m_lastDamageInfo.in.m_sourceID); }
85-
virtual void clearLastAttacker() { m_lastDamageCleared = true; }
81+
virtual const DamageInfo *getLastDamageInfo() const override { return &m_lastDamageInfo; } ///< return info on last damage dealt to this object
82+
virtual UnsignedInt getLastDamageTimestamp() const override { return m_lastDamageTimestamp; } ///< return frame of last damage dealt
83+
virtual UnsignedInt getLastHealingTimestamp() const override { return m_lastHealingTimestamp; } ///< return frame of last damage dealt
84+
virtual ObjectID getClearableLastAttacker() const override { return (m_lastDamageCleared ? INVALID_ID : m_lastDamageInfo.in.m_sourceID); }
85+
virtual void clearLastAttacker() override { m_lastDamageCleared = true; }
8686

87-
void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback = TRUE );
87+
virtual void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback = TRUE ) override;
8888

89-
virtual void setArmorSetFlag(ArmorSetType ast) { m_curArmorSetFlags.set(ast, 1); }
90-
virtual void clearArmorSetFlag(ArmorSetType ast) { m_curArmorSetFlags.set(ast, 0); }
89+
virtual void setArmorSetFlag(ArmorSetType ast) override { m_curArmorSetFlags.set(ast, 1); }
90+
virtual void clearArmorSetFlag(ArmorSetType ast) override { m_curArmorSetFlags.set(ast, 0); }
9191

92-
virtual void setInitialHealth(Int initialPercent); ///< Sets the initial load health %.
93-
virtual void setMaxHealth( Real maxHealth, MaxHealthChangeType healthChangeType = SAME_CURRENTHEALTH ); ///< Sets the initial max health
92+
virtual void setInitialHealth(Int initialPercent) override; ///< Sets the initial load health %.
93+
virtual void setMaxHealth( Real maxHealth, MaxHealthChangeType healthChangeType = SAME_CURRENTHEALTH ) override; ///< Sets the initial max health
9494

95-
virtual Bool getFrontCrushed() const { return m_frontCrushed; }
96-
virtual Bool getBackCrushed() const { return m_backCrushed; }
95+
virtual Bool getFrontCrushed() const override { return m_frontCrushed; }
96+
virtual Bool getBackCrushed() const override { return m_backCrushed; }
9797

98-
virtual void setFrontCrushed(Bool v) { m_frontCrushed = v; }
99-
virtual void setBackCrushed(Bool v) { m_backCrushed = v; }
98+
virtual void setFrontCrushed(Bool v) override { m_frontCrushed = v; }
99+
virtual void setBackCrushed(Bool v) override { m_backCrushed = v; }
100100

101-
virtual Real getMaxHealth() const; ///< return max health
102-
virtual Real getInitialHealth() const; // return initial health
101+
virtual Real getMaxHealth() const override; ///< return max health
102+
virtual Real getInitialHealth() const override; // return initial health
103103

104-
virtual void setIndestructible( Bool indestructible );
105-
virtual Bool isIndestructible() const { return m_indestructible; }
104+
virtual void setIndestructible( Bool indestructible ) override;
105+
virtual Bool isIndestructible() const override { return m_indestructible; }
106106

107-
virtual void internalChangeHealth( Real delta ); ///< change health
107+
virtual void internalChangeHealth( Real delta ) override; ///< change health
108108

109-
virtual void evaluateVisualCondition();
110-
virtual void updateBodyParticleSystems();// made public for topple anf building collapse updates -ML
109+
virtual void evaluateVisualCondition() override;
110+
virtual void updateBodyParticleSystems() override;// made public for topple anf building collapse updates -ML
111111

112112
protected:
113113

Generals/Code/GameEngine/Include/GameLogic/Module/ActiveShroudUpgrade.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class ActiveShroudUpgrade : public UpgradeModule
6868

6969
protected:
7070

71-
virtual void upgradeImplementation(); ///< Here's the actual work of Upgrading
72-
virtual Bool isSubObjectsUpgrade() { return false; }
71+
virtual void upgradeImplementation() override; ///< Here's the actual work of Upgrading
72+
virtual Bool isSubObjectsUpgrade() override { return false; }
7373

7474
};

Generals/Code/GameEngine/Include/GameLogic/Module/ArmorUpgrade.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ class ArmorUpgrade : public UpgradeModule
7575
// virtual destructor prototype defined by MemoryPoolObject
7676

7777
protected:
78-
virtual void upgradeImplementation( ); ///< Here's the actual work of Upgrading
79-
virtual Bool isSubObjectsUpgrade() { return false; }
78+
virtual void upgradeImplementation( ) override; ///< Here's the actual work of Upgrading
79+
virtual Bool isSubObjectsUpgrade() override { return false; }
8080

8181
};
8282

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ 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);
94-
virtual Bool isIdle() const;
95-
virtual UpdateSleepTime update();
96-
virtual AssaultTransportAIInterface* getAssaultTransportAIInterface() { return this; }
97-
virtual const AssaultTransportAIInterface* getAssaultTransportAIInterface() const { return this; }
98-
virtual void beginAssault( const Object *designatedTarget ) const;
93+
virtual void aiDoCommand(const AICommandParms* parms) override;
94+
virtual Bool isIdle() const override;
95+
virtual UpdateSleepTime update() override;
96+
virtual AssaultTransportAIInterface* getAssaultTransportAIInterface() override { return this; }
97+
virtual const AssaultTransportAIInterface* getAssaultTransportAIInterface() const override { return this; }
98+
virtual void beginAssault( const Object *designatedTarget ) const override;
9999

100100
UpdateSleepTime calcSleepTime();
101101

Generals/Code/GameEngine/Include/GameLogic/Module/AssistedTargetingUpdate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class AssistedTargetingUpdate : public UpdateModule
6565
AssistedTargetingUpdate( Thing *thing, const ModuleData* moduleData );
6666
// virtual destructor prototype provided by memory pool declaration
6767

68-
virtual UpdateSleepTime update();
68+
virtual UpdateSleepTime update() override;
6969

7070
Bool isFreeToAssist() const;
7171
void assistAttack( const Object *requestingObject, Object *victimObject );

Generals/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class AutoDepositUpdate : public UpdateModule
110110
// virtual destructor prototype provided by memory pool declaration
111111

112112
void awardInitialCaptureBonus( Player *player ); // Test and award the initial capture bonus
113-
virtual UpdateSleepTime update();
113+
virtual UpdateSleepTime update() override;
114114

115115
protected:
116116

Generals/Code/GameEngine/Include/GameLogic/Module/AutoFindHealingUpdate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ class AutoFindHealingUpdate : public UpdateModule
6969
AutoFindHealingUpdate( Thing *thing, const ModuleData* moduleData );
7070
// virtual destructor prototype provided by memory pool declaration
7171

72-
virtual void onObjectCreated();
73-
virtual UpdateSleepTime update();
72+
virtual void onObjectCreated() override;
73+
virtual UpdateSleepTime update() override;
7474

7575
Object* scanClosestTarget();
7676

Generals/Code/GameEngine/Include/GameLogic/Module/AutoHealBehavior.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,46 +117,46 @@ class AutoHealBehavior : public UpdateModule,
117117
static Int getInterfaceMask() { return UpdateModule::getInterfaceMask() | MODULEINTERFACE_UPGRADE | MODULEINTERFACE_DAMAGE; }
118118

119119
// BehaviorModule
120-
virtual UpgradeModuleInterface* getUpgrade() { return this; }
121-
virtual DamageModuleInterface* getDamage() { return this; }
120+
virtual UpgradeModuleInterface* getUpgrade() override { return this; }
121+
virtual DamageModuleInterface* getDamage() override { return this; }
122122

123123
// DamageModuleInterface
124-
virtual void onDamage( DamageInfo *damageInfo );
125-
virtual void onHealing( DamageInfo *damageInfo ) { }
126-
virtual void onBodyDamageStateChange(const DamageInfo* damageInfo, BodyDamageType oldState, BodyDamageType newState) { }
124+
virtual void onDamage( DamageInfo *damageInfo ) override;
125+
virtual void onHealing( DamageInfo *damageInfo ) override { }
126+
virtual void onBodyDamageStateChange(const DamageInfo* damageInfo, BodyDamageType oldState, BodyDamageType newState) override { }
127127

128128
// UpdateModuleInterface
129-
virtual UpdateSleepTime update();
130-
virtual DisabledMaskType getDisabledTypesToProcess() const { return MAKE_DISABLED_MASK( DISABLED_HELD ); }
129+
virtual UpdateSleepTime update() override;
130+
virtual DisabledMaskType getDisabledTypesToProcess() const override { return MAKE_DISABLED_MASK( DISABLED_HELD ); }
131131

132132
void stopHealing();
133133
void undoUpgrade(); ///<pretend like we have not been activated yet, so we can be reactivated later
134134

135135
protected:
136136

137-
virtual void upgradeImplementation()
137+
virtual void upgradeImplementation() override
138138
{
139139
setWakeFrame(getObject(), UPDATE_SLEEP_NONE);
140140
}
141141

142-
virtual void getUpgradeActivationMasks(UpgradeMaskType& activation, UpgradeMaskType& conflicting) const
142+
virtual void getUpgradeActivationMasks(UpgradeMaskType& activation, UpgradeMaskType& conflicting) const override
143143
{
144144
getAutoHealBehaviorModuleData()->m_upgradeMuxData.getUpgradeActivationMasks(activation, conflicting);
145145
}
146146

147-
virtual void performUpgradeFX()
147+
virtual void performUpgradeFX() override
148148
{
149149
getAutoHealBehaviorModuleData()->m_upgradeMuxData.performUpgradeFX(getObject());
150150
}
151151

152-
virtual Bool requiresAllActivationUpgrades() const
152+
virtual Bool requiresAllActivationUpgrades() const override
153153
{
154154
return getAutoHealBehaviorModuleData()->m_upgradeMuxData.m_requiresAllTriggers;
155155
}
156156

157157
Bool isUpgradeActive() const { return isAlreadyUpgraded(); }
158158

159-
virtual Bool isSubObjectsUpgrade() { return false; }
159+
virtual Bool isSubObjectsUpgrade() override { return false; }
160160

161161

162162
private:

Generals/Code/GameEngine/Include/GameLogic/Module/BaikonurLaunchPower.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ class BaikonurLaunchPower : public SpecialPowerModule
7676

7777
BaikonurLaunchPower( Thing *thing, const ModuleData *moduleData );
7878

79-
virtual void doSpecialPower( UnsignedInt commandOptions );
80-
virtual void doSpecialPowerAtLocation( const Coord3D *loc, Real angle, UnsignedInt commandOptions );
79+
virtual void doSpecialPower( UnsignedInt commandOptions ) override;
80+
virtual void doSpecialPowerAtLocation( const Coord3D *loc, Real angle, UnsignedInt commandOptions ) override;
8181

8282
protected:
8383

0 commit comments

Comments
 (0)