Skip to content

Commit 90bbaa7

Browse files
authored
refactor: Add override keyword to virtual function overrides in Zero Hour code (2) (#2605)
1 parent 24be3ed commit 90bbaa7

51 files changed

Lines changed: 119 additions & 211 deletions

Some content is hidden

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

GeneralsMD/Code/GameEngine/Include/Common/Module.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,20 @@ class ModuleData : public Snapshot
136136
#define MAKE_STANDARD_MODULE_MACRO( cls ) \
137137
public: \
138138
static Module* friend_newModuleInstance( Thing *thing, const ModuleData* moduleData ) { return newInstance( cls )( thing, moduleData ); } \
139-
virtual NameKeyType getModuleNameKey() const { static NameKeyType nk = NAMEKEY(#cls); return nk; } \
139+
virtual NameKeyType getModuleNameKey() const override { static NameKeyType nk = NAMEKEY(#cls); return nk; } \
140140
protected: \
141-
virtual void crc( Xfer *xfer ); \
142-
virtual void xfer( Xfer *xfer ); \
143-
virtual void loadPostProcess();
141+
virtual void crc( Xfer *xfer ) override; \
142+
virtual void xfer( Xfer *xfer ) override; \
143+
virtual void loadPostProcess() override;
144144

145145
// ------------------------------------------------------------------------------------------------
146146
// For the creation of abstract module classes
147147
// ------------------------------------------------------------------------------------------------
148148
#define MAKE_STANDARD_MODULE_MACRO_ABC( cls ) \
149149
protected: \
150-
virtual void crc( Xfer *xfer ); \
151-
virtual void xfer( Xfer *xfer ); \
152-
virtual void loadPostProcess();
150+
virtual void crc( Xfer *xfer ) override; \
151+
virtual void xfer( Xfer *xfer ) override; \
152+
virtual void loadPostProcess() override;
153153

154154
//-------------------------------------------------------------------------------------------------
155155
// only use this macro for an ABC. for a real class, use MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA.

GeneralsMD/Code/GameEngine/Include/Common/StateMachine.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,6 @@ class State : public MemoryPoolObject, public Snapshot
181181
inline void setName(AsciiString n) { m_name = n; }
182182
#endif
183183

184-
protected:
185-
// snapshot interface - pure virtual here.
186-
// Essentially all the member data gets set up on creation and shouldn't change.
187-
// So none of it needs to be saved, and it nicely forces all user states to
188-
// remember to implement crc, xfer & loadPostProcess. jba
189-
virtual void crc( Xfer *xfer )=0;
190-
virtual void xfer( Xfer *xfer )=0;
191-
virtual void loadPostProcess()=0;
192-
193184
private:
194185

195186
struct TransitionInfo

GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ friend class Drawable; // for selection/deselection transactions
470470
virtual void disregardDrawable( Drawable *draw ); ///< Drawable is being destroyed, clean up any UI elements associated with it
471471

472472
virtual void preDraw(); ///< Logic which needs to occur before the UI renders
473-
virtual void draw() = 0; ///< Render the in-game user interface
473+
virtual void draw() override = 0; ///< Render the in-game user interface
474474
virtual void postDraw(); ///< Logic which needs to occur after the UI renders
475475
virtual void postWindowDraw(); ///< Logic which needs to occur after the WindowManager has repainted the menus
476476

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class AIGuardRetaliateAttackAggressorState : public State
239239
virtual StateReturnType update() override;
240240
virtual void onExit( StateExitType status ) override;
241241
#ifdef STATE_MACHINE_DEBUG
242-
virtual AsciiString getName() const ;
242+
virtual AsciiString getName() const override;
243243
#endif
244244
protected:
245245
// snapshot interface

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class AIStateMachine : public StateMachine
163163
public: // overrides.
164164
virtual StateReturnType updateStateMachine() override; ///< run one step of the machine
165165
#ifdef STATE_MACHINE_DEBUG
166-
virtual AsciiString getCurrentStateName() const ;
166+
virtual AsciiString getCurrentStateName() const override;
167167
#endif
168168

169169
protected:
@@ -579,7 +579,7 @@ EMPTY_DTOR(AIPickUpCrateState)
579579
virtual void onExit( StateExitType status ) override;
580580
virtual StateReturnType update() override;
581581
#ifdef STATE_MACHINE_DEBUG
582-
virtual AsciiString getName() const ;
582+
virtual AsciiString getName() const override;
583583
#endif
584584

585585
protected:
@@ -690,7 +690,7 @@ class AIAttackFollowWaypointPathState : public AIFollowWaypointPathState
690690
virtual void onExit( StateExitType status ) override;
691691
virtual StateReturnType update() override;
692692
#ifdef STATE_MACHINE_DEBUG
693-
virtual AsciiString getName() const ;
693+
virtual AsciiString getName() const override;
694694
#endif
695695

696696
protected:
@@ -995,7 +995,7 @@ class AIAttackState : public State, public NotifyWeaponFiredInterface
995995
virtual Bool isAttackingObject() const override { return m_isAttackingObject; }
996996
virtual Bool isForceAttacking() const { return m_isForceAttacking; }
997997
#ifdef STATE_MACHINE_DEBUG
998-
virtual AsciiString getName() const ;
998+
virtual AsciiString getName() const override;
999999
#endif
10001000

10011001
protected:
@@ -1033,7 +1033,7 @@ class AIAttackSquadState : public State
10331033
virtual StateReturnType update() override;
10341034
Object *chooseVictim();
10351035
#ifdef STATE_MACHINE_DEBUG
1036-
virtual AsciiString getName() const ;
1036+
virtual AsciiString getName() const override;
10371037
#endif
10381038

10391039

@@ -1076,7 +1076,7 @@ class AIDockState : public State
10761076
virtual void onExit( StateExitType status ) override;
10771077
virtual StateReturnType update() override;
10781078
#ifdef STATE_MACHINE_DEBUG
1079-
virtual AsciiString getName() const ;
1079+
virtual AsciiString getName() const override;
10801080
#endif
10811081

10821082
protected:
@@ -1169,7 +1169,7 @@ class AIGuardState : public State
11691169
virtual void onExit( StateExitType status ) override;
11701170
virtual StateReturnType update() override;
11711171
#ifdef STATE_MACHINE_DEBUG
1172-
virtual AsciiString getName() const ;
1172+
virtual AsciiString getName() const override;
11731173
#endif
11741174
protected:
11751175
// snapshot interface
@@ -1196,7 +1196,7 @@ class AIGuardRetaliateState : public State
11961196
virtual void onExit( StateExitType status ) override;
11971197
virtual StateReturnType update() override;
11981198
#ifdef STATE_MACHINE_DEBUG
1199-
virtual AsciiString getName() const ;
1199+
virtual AsciiString getName() const override;
12001200
#endif
12011201
protected:
12021202
// snapshot interface
@@ -1226,7 +1226,7 @@ class AITunnelNetworkGuardState : public State
12261226
virtual void onExit( StateExitType status ) override;
12271227
virtual StateReturnType update() override;
12281228
#ifdef STATE_MACHINE_DEBUG
1229-
virtual AsciiString getName() const ;
1229+
virtual AsciiString getName() const override;
12301230
#endif
12311231
protected:
12321232
// snapshot interface
@@ -1256,7 +1256,7 @@ class AIHuntState : public State
12561256
virtual void onExit( StateExitType status ) override;
12571257
virtual StateReturnType update() override;
12581258
#ifdef STATE_MACHINE_DEBUG
1259-
virtual AsciiString getName() const ;
1259+
virtual AsciiString getName() const override;
12601260
#endif
12611261

12621262
protected:
@@ -1287,7 +1287,7 @@ class AIAttackAreaState : public State
12871287
virtual void onExit( StateExitType status ) override;
12881288
virtual StateReturnType update() override;
12891289
#ifdef STATE_MACHINE_DEBUG
1290-
virtual AsciiString getName() const ;
1290+
virtual AsciiString getName() const override;
12911291
#endif
12921292

12931293
protected:

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

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -217,30 +217,6 @@ class BodyModule : public BehaviorModule, public BodyModuleInterface
217217
// BehaviorModule
218218
virtual BodyModuleInterface* getBody() override { return this; }
219219

220-
/**
221-
Try to damage this Object. The module's Armor
222-
will be taken into account, so the actual damage done may vary
223-
considerably from what you requested. Also note that (if damage is done)
224-
the DamageFX will be invoked to provide a/v fx as appropriate.
225-
*/
226-
virtual void attemptDamage( DamageInfo *damageInfo ) = 0;
227-
228-
/**
229-
Instead of having negative damage count as healing, or allowing access to the private
230-
changeHealth Method, we will use this parallel to attemptDamage to do healing without hack.
231-
*/
232-
virtual void attemptHealing( DamageInfo *healingInfo ) = 0;
233-
234-
/**
235-
Estimate the (unclipped) damage that would be done to this object
236-
by the given damage (taking bonuses, armor, etc into account),
237-
but DO NOT alter the body in any way. (This is used by the AI system
238-
to choose weapons.)
239-
*/
240-
virtual Real estimateDamage( DamageInfoInput& damageInfo ) const = 0;
241-
242-
virtual Real getHealth() const = 0; ///< get current health
243-
244220
virtual Real getMaxHealth() const override {return 0.0f;} ///< return max health
245221
virtual Real getPreviousHealth() const override { return 0.0f; } ///< return previous health
246222

@@ -251,16 +227,6 @@ class BodyModule : public BehaviorModule, public BodyModuleInterface
251227

252228
virtual Real getInitialHealth() const override {return 0.0f;} // return initial health
253229

254-
virtual BodyDamageType getDamageState() const = 0;
255-
virtual void setDamageState( BodyDamageType newState ) = 0; ///< control damage state directly. Will adjust hitpoints.
256-
virtual void setAflame( Bool setting ) = 0;///< This is a major change like a damage state.
257-
258-
virtual void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback = FALSE ) = 0; ///< I just achieved this level right this moment
259-
260-
virtual void setArmorSetFlag(ArmorSetType ast) = 0;
261-
virtual void clearArmorSetFlag(ArmorSetType ast) = 0;
262-
virtual Bool testArmorSetFlag(ArmorSetType ast) = 0;
263-
264230
virtual const DamageInfo *getLastDamageInfo() const override { return nullptr; } ///< return info on last damage dealt to this object
265231
virtual UnsignedInt getLastDamageTimestamp() const override { return 0; } ///< return frame of last damage dealt
266232
virtual UnsignedInt getLastHealingTimestamp() const override { return 0; } ///< return frame of last healing dealt
@@ -283,15 +249,6 @@ class BodyModule : public BehaviorModule, public BodyModuleInterface
283249
virtual void applyDamageScalar( Real scalar ) override { m_damageScalar *= scalar; }
284250
virtual Real getDamageScalar() const override { return m_damageScalar; }
285251

286-
/**
287-
Change the module's health by the given delta. Note that
288-
the module's DamageFX and Armor are NOT taken into
289-
account, so you should think about what you're bypassing when you
290-
call this directly (especially when when decreasing health, since
291-
you probably want "attemptDamage" or "attemptHealing")
292-
*/
293-
virtual void internalChangeHealth( Real delta ) = 0;
294-
295252
virtual void evaluateVisualCondition() override { }
296253
virtual void updateBodyParticleSystems() override { };// made public for topple anf building collapse updates -ML
297254

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ class CollideModule : public BehaviorModule,
8585
// BehaviorModule
8686
virtual CollideModuleInterface* getCollide() override { return this; }
8787

88-
virtual void onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) = 0;
89-
9088
/// this is used for things like pilots, to determine if they can "enter" something
9189
virtual Bool wouldLikeToCollideWith(const Object* other) const override { return false; }
9290
virtual Bool isHijackedVehicleCrateCollide() const override { return false; }

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class CreateModule : public BehaviorModule, public CreateModuleInterface
7373
// BehaviorModule
7474
virtual CreateModuleInterface* getCreate() override { return this; }
7575

76-
virtual void onCreate() = 0; ///< This is called when you become a code Object
7776
virtual void onBuildComplete() override { m_needToRunOnBuildComplete = FALSE; } ///< This is called when you are a finished game object
7877
virtual Bool shouldDoOnBuildComplete() const override { return m_needToRunOnBuildComplete; }
7978

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,6 @@ class DamageModule : public BehaviorModule, public DamageModuleInterface
9797
// BehaviorModule
9898
virtual DamageModuleInterface* getDamage() override { return this; }
9999

100-
// damage module callbacks
101-
virtual void onDamage( DamageInfo *damageInfo ) = 0; ///< damage callback
102-
virtual void onHealing( DamageInfo *damageInfo ) = 0; ///< healing callback
103-
virtual void onBodyDamageStateChange( const DamageInfo* damageInfo,
104-
BodyDamageType oldState,
105-
BodyDamageType newState) = 0; ///< state change callback
106-
107100
protected:
108101

109102
};

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ class DestroyModule : public BehaviorModule, public DestroyModuleInterface
5858
// BehaviorModule
5959
virtual DestroyModuleInterface* getDestroy() override { return this; }
6060

61-
virtual void onDestroy() = 0;
62-
6361
protected:
6462

6563
};

0 commit comments

Comments
 (0)