Skip to content

Commit 64b5eaa

Browse files
authored
refactor: Add override keyword to virtual function overrides in Tools and set compile option -Wsuggest-override (TheSuperHackers#2394)
1 parent df31c7e commit 64b5eaa

File tree

202 files changed

+1213
-1211
lines changed

Some content is hidden

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

202 files changed

+1213
-1211
lines changed

Core/GameEngine/Include/GameClient/ParticleSys.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -840,14 +840,14 @@ class ParticleSystemManager : public SubsystemInterface,
840840
class ParticleSystemManagerDummy : public ParticleSystemManager
841841
{
842842
public:
843-
Int getOnScreenParticleCount() override { return 0; }
844-
void doParticles(RenderInfoClass &rinfo) override {}
845-
void queueParticleRender() override {}
843+
virtual Int getOnScreenParticleCount() override { return 0; }
844+
virtual void doParticles(RenderInfoClass &rinfo) override {}
845+
virtual void queueParticleRender() override {}
846846

847847
protected:
848-
void crc( Xfer *xfer ) override {}
849-
void xfer( Xfer *xfer ) override {}
850-
void loadPostProcess() override {}
848+
virtual void crc( Xfer *xfer ) override {}
849+
virtual void xfer( Xfer *xfer ) override {}
850+
virtual void loadPostProcess() override {}
851851
};
852852

853853
/// The particle system manager singleton

Generals/Code/Tools/GUIEdit/Include/GUIEditDisplay.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -64,68 +64,68 @@ class GUIEditDisplay : public Display
6464
public:
6565

6666
GUIEditDisplay( void );
67-
virtual ~GUIEditDisplay( void );
67+
virtual ~GUIEditDisplay( void ) override;
6868

69-
virtual void draw( void ) { };
69+
virtual void draw( void ) override { };
7070

7171
/// draw a line on the display in pixel coordinates with the specified color
7272
virtual void drawLine( Int startX, Int startY, Int endX, Int endY,
73-
Real lineWidth, UnsignedInt lineColor );
73+
Real lineWidth, UnsignedInt lineColor ) override;
7474
virtual void drawLine( Int startX, Int startY, Int endX, Int endY,
75-
Real lineWidth, UnsignedInt lineColor1, UnsignedInt lineColor2 ) { }
75+
Real lineWidth, UnsignedInt lineColor1, UnsignedInt lineColor2 ) override { }
7676
/// draw a rect border on the display in pixel coordinates with the specified color
7777
virtual void drawOpenRect( Int startX, Int startY, Int width, Int height,
78-
Real lineWidth, UnsignedInt lineColor );
78+
Real lineWidth, UnsignedInt lineColor ) override;
7979
/// draw a filled rect on the display in pixel coords with the specified color
8080
virtual void drawFillRect( Int startX, Int startY, Int width, Int height,
81-
UnsignedInt color );
81+
UnsignedInt color ) override;
8282

8383
/// Draw a percentage of a rectangle, much like a clock
84-
virtual void drawRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) { }
85-
virtual void drawRemainingRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) { }
84+
virtual void drawRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) override { }
85+
virtual void drawRemainingRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) override { }
8686

8787
/// draw an image fit within the screen coordinates
8888
virtual void drawImage( const Image *image, Int startX, Int startY,
89-
Int endX, Int endY, Color color = 0xFFFFFFFF, DrawImageMode mode=DRAW_IMAGE_ALPHA);
89+
Int endX, Int endY, Color color = 0xFFFFFFFF, DrawImageMode mode=DRAW_IMAGE_ALPHA) override;
9090
/// image clipping support
91-
virtual void setClipRegion( IRegion2D *region );
92-
virtual Bool isClippingEnabled( void );
93-
virtual void enableClipping( Bool onoff );
91+
virtual void setClipRegion( IRegion2D *region ) override;
92+
virtual Bool isClippingEnabled( void ) override;
93+
virtual void enableClipping( Bool onoff ) override;
9494

9595
// These are stub functions to allow compilation:
9696

9797
/// Create a video buffer that can be used for this display
98-
virtual VideoBuffer* createVideoBuffer( void ) { return nullptr; }
98+
virtual VideoBuffer* createVideoBuffer( void ) override { return nullptr; }
9999

100100
/// draw a video buffer fit within the screen coordinates
101-
virtual void drawScaledVideoBuffer( VideoBuffer *buffer, VideoStreamInterface *stream ) { }
101+
virtual void drawScaledVideoBuffer( VideoBuffer *buffer, VideoStreamInterface *stream ) override { }
102102
virtual void drawVideoBuffer( VideoBuffer *buffer, Int startX, Int startY,
103-
Int endX, Int endY ) { }
104-
virtual void takeScreenShot(void){ }
105-
virtual void toggleMovieCapture(void) {}
103+
Int endX, Int endY ) override { }
104+
virtual void takeScreenShot(void) override { }
105+
virtual void toggleMovieCapture(void) override {}
106106

107107
// methods that we need to stub
108-
virtual void setTimeOfDay( TimeOfDay tod ) {}
108+
virtual void setTimeOfDay( TimeOfDay tod ) override {}
109109
virtual void createLightPulse( const Coord3D *pos, const RGBColor *color, Real innerRadius, Real attenuationWidth,
110-
UnsignedInt increaseFrameTime, UnsignedInt decayFrameTime ) {}
111-
virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting) {}
112-
void setBorderShroudLevel(UnsignedByte level){}
113-
virtual void clearShroud() {}
114-
virtual void preloadModelAssets( AsciiString model ) {}
115-
virtual void preloadTextureAssets( AsciiString texture ) {}
116-
virtual void toggleLetterBox(void) {}
117-
virtual void enableLetterBox(Bool enable) {}
110+
UnsignedInt increaseFrameTime, UnsignedInt decayFrameTime ) override {}
111+
virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting) override {}
112+
virtual void setBorderShroudLevel(UnsignedByte level) override {}
113+
virtual void clearShroud() override {}
114+
virtual void preloadModelAssets( AsciiString model ) override {}
115+
virtual void preloadTextureAssets( AsciiString texture ) override {}
116+
virtual void toggleLetterBox(void) override {}
117+
virtual void enableLetterBox(Bool enable) override {}
118118
#if defined(RTS_DEBUG)
119119
virtual void dumpModelAssets(const char *path) {}
120120
#endif
121-
virtual void doSmartAssetPurgeAndPreload(const char* usageFileName) {}
121+
virtual void doSmartAssetPurgeAndPreload(const char* usageFileName) override {}
122122
#if defined(RTS_DEBUG)
123123
virtual void dumpAssetUsage(const char* mapname) {}
124124
#endif
125125

126-
virtual Real getAverageFPS(void) { return 0; }
127-
virtual Real getCurrentFPS(void) { return 0; }
128-
virtual Int getLastFrameDrawCalls( void ) { return 0; }
126+
virtual Real getAverageFPS(void) override { return 0; }
127+
virtual Real getCurrentFPS(void) override { return 0; }
128+
virtual Int getLastFrameDrawCalls( void ) override { return 0; }
129129

130130
protected:
131131

Generals/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ class GUIEditWindowManager : public W3DGameWindowManager
4646
public:
4747

4848
GUIEditWindowManager( void );
49-
virtual ~GUIEditWindowManager( void );
49+
virtual ~GUIEditWindowManager( void ) override;
5050

51-
virtual void init( void ); ///< initialize system
51+
virtual void init( void ) override; ///< initialize system
5252

53-
virtual Int winDestroy( GameWindow *window ); ///< destroy this window
53+
virtual Int winDestroy( GameWindow *window ) override; ///< destroy this window
5454
/// create a new window by setting up parameters and callbacks
5555
virtual GameWindow *winCreate( GameWindow *parent, UnsignedInt status,
5656
Int x, Int y, Int width, Int height,
5757
GameWinSystemFunc system,
58-
WinInstanceData *instData = nullptr );
58+
WinInstanceData *instData = nullptr ) override;
5959

6060
// **************************************************************************
6161
// GUIEdit specific methods *************************************************

Generals/Code/Tools/WorldBuilder/include/AutoEdgeOutTool.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ class AutoEdgeOutTool : public Tool
3333
{
3434
public:
3535
AutoEdgeOutTool(void);
36-
~AutoEdgeOutTool(void);
36+
virtual ~AutoEdgeOutTool(void) override;
3737

3838
public:
3939
/// Perform tool on mouse down.
40-
virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
41-
virtual void activate(); ///< Become the current tool.
40+
virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override;
41+
virtual void activate() override; ///< Become the current tool.
4242
};

Generals/Code/Tools/WorldBuilder/include/BaseBuildProps.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ class BaseBuildProps : public CDialog
4141
// ClassWizard generated virtual function overrides
4242
//{{AFX_VIRTUAL(BaseBuildProps)
4343
protected:
44-
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
44+
virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
4545
//}}AFX_VIRTUAL
4646

4747
// Implementation
4848
protected:
4949

5050
// Generated message map functions
5151
//{{AFX_MSG(BaseBuildProps)
52-
virtual BOOL OnInitDialog();
53-
virtual void OnOK();
52+
virtual BOOL OnInitDialog() override;
53+
virtual void OnOK() override;
5454
//}}AFX_MSG
5555
DECLARE_MESSAGE_MAP()
5656

Generals/Code/Tools/WorldBuilder/include/BlendEdgeTool.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ class BlendEdgeTool : public Tool
3636

3737
public:
3838
BlendEdgeTool(void);
39-
~BlendEdgeTool(void);
39+
virtual ~BlendEdgeTool(void) override;
4040

4141
public:
4242
/// Perform tool on mouse down.
43-
virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
44-
virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
43+
virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override;
44+
virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override;
4545

4646
};

Generals/Code/Tools/WorldBuilder/include/BlendMaterial.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ class BlendMaterial : public COptionsPanel
4545
// ClassWizard generated virtual function overrides
4646
//{{AFX_VIRTUAL(BlendMaterial)
4747
protected:
48-
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
49-
virtual void OnOK(){return;}; ///< Modeless dialogs don't OK, so eat this for modeless.
50-
virtual void OnCancel(){return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless.
51-
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
48+
virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
49+
virtual void OnOK() override {return;}; ///< Modeless dialogs don't OK, so eat this for modeless.
50+
virtual void OnCancel() override {return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless.
51+
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override;
5252
//}}AFX_VIRTUAL
5353

5454
// Implementation
5555
protected:
5656
enum {MIN_TILE_SIZE=2, MAX_TILE_SIZE = 100};
5757
// Generated message map functions
5858
//{{AFX_MSG(BlendMaterial)
59-
virtual BOOL OnInitDialog();
59+
virtual BOOL OnInitDialog() override;
6060
//}}AFX_MSG
6161
DECLARE_MESSAGE_MAP()
6262

Generals/Code/Tools/WorldBuilder/include/BorderTool.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ class BorderTool : public Tool
3232

3333
public:
3434
BorderTool();
35-
~BorderTool();
35+
virtual ~BorderTool() override;
3636

3737
Int getToolID(void) {return m_toolID;}
38-
virtual void setCursor(void);
38+
virtual void setCursor(void) override;
3939

40-
virtual void activate();
41-
virtual void deactivate();
40+
virtual void activate() override;
41+
virtual void deactivate() override;
4242

43-
virtual Bool followsTerrain(void) { return false; }
43+
virtual Bool followsTerrain(void) override { return false; }
4444

45-
virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
46-
virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
47-
virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
45+
virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override;
46+
virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override;
47+
virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override;
4848
};

Generals/Code/Tools/WorldBuilder/include/BrushTool.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class BrushTool : public Tool
4242

4343
public:
4444
BrushTool(void);
45-
~BrushTool(void);
45+
virtual ~BrushTool(void) override;
4646

4747
public:
4848
static Int getWidth(void) {return m_brushWidth;}; ///<Returns width.
@@ -53,11 +53,11 @@ class BrushTool : public Tool
5353
static void setHeight(Int height);
5454

5555
public:
56-
virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
57-
virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
58-
virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
59-
virtual WorldHeightMapEdit *getHeightMap(void) {return m_htMapEditCopy;};
60-
virtual void activate(); ///< Become the current tool.
61-
virtual Bool followsTerrain(void) {return false;};
56+
virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override;
57+
virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override;
58+
virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override;
59+
virtual WorldHeightMapEdit *getHeightMap(void) override {return m_htMapEditCopy;};
60+
virtual void activate() override; ///< Become the current tool.
61+
virtual Bool followsTerrain(void) override {return false;};
6262

6363
};

Generals/Code/Tools/WorldBuilder/include/BuildList.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class BuildList : public COptionsPanel, public PopupSliderOwner
3636
public:
3737
BuildList(CWnd* pParent = nullptr); ///< standard constructor
3838

39-
~BuildList(void); ///< standard destructor
39+
virtual ~BuildList(void) override; ///< standard destructor
4040
enum { NAME_MAX_LEN = 64 };
4141
// Dialog Data
4242
//{{AFX_DATA(BuildList)
@@ -49,17 +49,17 @@ class BuildList : public COptionsPanel, public PopupSliderOwner
4949
// ClassWizard generated virtual function overrides
5050
//{{AFX_VIRTUAL(BuildList)
5151
protected:
52-
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
53-
virtual void OnOK(){return;}; ///< Modeless dialogs don't OK, so eat this for modeless.
54-
virtual void OnCancel(){return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless.
52+
virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
53+
virtual void OnOK() override {return;}; ///< Modeless dialogs don't OK, so eat this for modeless.
54+
virtual void OnCancel() override {return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless.
5555
//}}AFX_VIRTUAL
5656

5757
// Implementation
5858
protected:
5959

6060
// Generated message map functions
6161
//{{AFX_MSG(BuildList)
62-
virtual BOOL OnInitDialog();
62+
virtual BOOL OnInitDialog() override;
6363
afx_msg void OnSelchangeSidesCombo();
6464
afx_msg void OnMoveUp();
6565
afx_msg void OnMoveDown();
@@ -97,9 +97,9 @@ class BuildList : public COptionsPanel, public PopupSliderOwner
9797
static void update(void) {if (m_staticThis) m_staticThis->loadSides();};
9898
static void setSelectedBuildList(BuildListInfo *pInfo);
9999

100-
virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial);
101-
virtual void PopSliderChanged(const long sliderID, long theVal);
102-
virtual void PopSliderFinished(const long sliderID, long theVal);
100+
virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial) override;
101+
virtual void PopSliderChanged(const long sliderID, long theVal) override;
102+
virtual void PopSliderFinished(const long sliderID, long theVal) override;
103103

104104
};
105105

0 commit comments

Comments
 (0)