Skip to content

Commit 090f82d

Browse files
committed
Add override and final keyword
1 parent cc5c4f2 commit 090f82d

File tree

143 files changed

+1280
-1264
lines changed

Some content is hidden

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

143 files changed

+1280
-1264
lines changed

include/ArcObstacle.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "BzMaterial.h"
3030

3131

32-
class ArcObstacle : public Obstacle
32+
class ArcObstacle final : public Obstacle
3333
{
3434
public:
3535

@@ -53,39 +53,39 @@ class ArcObstacle : public Obstacle
5353
int physics, bool bounce, bool drive, bool shoot, bool ricochet);
5454
~ArcObstacle();
5555

56-
Obstacle* copyWithTransform(const MeshTransform&) const;
56+
Obstacle* copyWithTransform(const MeshTransform&) const override;
5757

5858
MeshObstacle* makeMesh();
5959

60-
const char* getType() const;
60+
const char* getType() const override;
6161
static const char* getClassName(); // const
62-
bool isValid() const;
63-
bool isFlatTop() const;
62+
bool isValid() const override;
63+
bool isFlatTop() const override;
6464

65-
float intersect(const Ray&) const;
66-
void getNormal(const float* p, float* n) const;
67-
void get3DNormal(const float* p, float* n) const;
65+
float intersect(const Ray&) const override;
66+
void getNormal(const float* p, float* n) const override;
67+
void get3DNormal(const float* p, float* n) const override;
6868

69-
bool inCylinder(const float* p, float radius, float height) const;
69+
bool inCylinder(const float* p, float radius, float height) const override;
7070
bool inBox(const float* p, float angle,
71-
float halfWidth, float halfBreadth, float height) const;
71+
float halfWidth, float halfBreadth, float height) const override;
7272
bool inMovingBox(const float* oldP, float oldAngle,
7373
const float *newP, float newAngle,
74-
float halfWidth, float halfBreadth, float height) const;
74+
float halfWidth, float halfBreadth, float height) const override;
7575
bool isCrossing(const float* p, float angle,
7676
float halfWidth, float halfBreadth, float height,
77-
float* plane) const;
77+
float* plane) const override;
7878

7979
bool getHitNormal(const float* pos1, float azimuth1,
8080
const float* pos2, float azimuth2,
8181
float halfWidth, float halfBreadth,
82-
float height, float* normal) const;
82+
float height, float* normal) const override;
8383

84-
int packSize() const;
85-
void *pack(void*) const;
86-
const void *unpack(const void*);
84+
int packSize() const override;
85+
void *pack(void*) const override;
86+
const void *unpack(const void*) override;
8787

88-
void print(std::ostream& out, const std::string& indent) const;
88+
void print(std::ostream& out, const std::string& indent) const override;
8989

9090
private:
9191
void finalize();

include/BSPSceneDatabase.h

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,38 @@
1717
#ifndef BZF_BSP_SCENE_DATABASE_H
1818
#define BZF_BSP_SCENE_DATABASE_H
1919

20-
// common goes first
21-
#include "common.h"
20+
// Inherits from
21+
#include "SceneDatabase.h"
2222

2323
// system headers
2424
#include <vector>
2525

2626
// common implementation headers
2727
#include "bzfgl.h"
28-
#include "SceneDatabase.h"
2928

3029

31-
class BSPSceneDatabase : public SceneDatabase
30+
class BSPSceneDatabase final : public SceneDatabase
3231
{
3332
public:
3433
BSPSceneDatabase();
3534
~BSPSceneDatabase();
3635

3736
// returns true if the node would have been deleted
38-
bool addStaticNode(SceneNode*, bool dontFree);
39-
void addDynamicNode(SceneNode*);
40-
void addDynamicSphere(SphereSceneNode*);
41-
void finalizeStatics();
42-
void removeDynamicNodes();
43-
void removeAllNodes();
44-
bool isOrdered();
45-
46-
void updateNodeStyles();
47-
void addLights(SceneRenderer& renderer);
48-
void addShadowNodes(SceneRenderer &renderer);
49-
void addRenderNodes(SceneRenderer& renderer);
50-
void renderRadarNodes(const ViewFrustum&);
51-
52-
void drawCuller();
37+
bool addStaticNode(SceneNode*, bool dontFree) override;
38+
void addDynamicNode(SceneNode*) override;
39+
void addDynamicSphere(SphereSceneNode*) override;
40+
void finalizeStatics() override;
41+
void removeDynamicNodes() override;
42+
void removeAllNodes() override;
43+
bool isOrdered() override;
44+
45+
void updateNodeStyles() override;
46+
void addLights(SceneRenderer& renderer) override;
47+
void addShadowNodes(SceneRenderer &renderer) override;
48+
void addRenderNodes(SceneRenderer& renderer) override;
49+
void renderRadarNodes(const ViewFrustum&) override;
50+
51+
void drawCuller() override;
5352

5453
private:
5554
class Node

include/BZDBLocal.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ class BZDBLocal
7171

7272
/******************************************************************************/
7373

74-
class BZDBbool : public BZDBLocal
74+
class BZDBbool final : public BZDBLocal
7575
{
7676
public:
7777
BZDBbool(const std::string& name, bool defVal, bool saveOnExit = true);
7878
~BZDBbool();
7979

80-
void addCallbacks();
81-
void removeCallbacks();
80+
void addCallbacks() override;
81+
void removeCallbacks() override;
8282

8383
inline operator bool() const
8484
{
@@ -99,16 +99,16 @@ class BZDBbool : public BZDBLocal
9999

100100
/******************************************************************************/
101101

102-
class BZDBint : public BZDBLocal
102+
class BZDBint final : public BZDBLocal
103103
{
104104
public:
105105
BZDBint(const std::string& name, int defVal,
106106
int min = INT_MIN, int max = INT_MAX,
107107
bool neverZero = false, bool saveOnExit = true);
108108
~BZDBint();
109109

110-
void addCallbacks();
111-
void removeCallbacks();
110+
void addCallbacks() override;
111+
void removeCallbacks() override;
112112

113113
inline operator int() const
114114
{
@@ -145,16 +145,16 @@ class BZDBint : public BZDBLocal
145145

146146
/******************************************************************************/
147147

148-
class BZDBfloat : public BZDBLocal
148+
class BZDBfloat final : public BZDBLocal
149149
{
150150
public:
151151
BZDBfloat(const std::string& name, float defVal,
152152
float min = -MAXFLOAT, float max = +MAXFLOAT,
153153
bool neverZero = false, bool saveOnExit = true);
154154
~BZDBfloat();
155155

156-
void addCallbacks();
157-
void removeCallbacks();
156+
void addCallbacks() override;
157+
void removeCallbacks() override;
158158

159159
inline operator float() const
160160
{
@@ -191,16 +191,16 @@ class BZDBfloat : public BZDBLocal
191191

192192
/******************************************************************************/
193193

194-
class BZDBcolor : public BZDBLocal
194+
class BZDBcolor final : public BZDBLocal
195195
{
196196
public:
197197
BZDBcolor(const std::string& name,
198198
float r, float g, float b, float a,
199199
bool neverAlpha = false, bool saveOnExit = true);
200200
~BZDBcolor();
201201

202-
void addCallbacks();
203-
void removeCallbacks();
202+
void addCallbacks() override;
203+
void removeCallbacks() override;
204204

205205
inline operator const float*() const
206206
{
@@ -227,15 +227,15 @@ class BZDBcolor : public BZDBLocal
227227

228228
/******************************************************************************/
229229

230-
class BZDBstring : public BZDBLocal
230+
class BZDBstring final : public BZDBLocal
231231
{
232232
public:
233233
BZDBstring(const std::string& name, const std::string& defVal,
234234
bool neverEmpty = false, bool saveOnExit = true);
235235
~BZDBstring();
236236

237-
void addCallbacks();
238-
void removeCallbacks();
237+
void addCallbacks() override;
238+
void removeCallbacks() override;
239239

240240
inline operator const std::string&() const
241241
{

include/BaseBuilding.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "BoxBuilding.h"
2121

22-
class BaseBuilding : public BoxBuilding
22+
class BaseBuilding final : public BoxBuilding
2323
{
2424

2525
friend class ObstacleModifier;
@@ -30,27 +30,27 @@ class BaseBuilding : public BoxBuilding
3030
const float *size, int _team, bool ricochet);
3131
~BaseBuilding();
3232

33-
Obstacle* copyWithTransform(const MeshTransform&) const;
33+
Obstacle* copyWithTransform(const MeshTransform&) const override;
3434

35-
const char* getType() const;
35+
const char* getType() const override;
3636
static const char* getClassName(); // const
3737

38-
bool inCylinder(const float* p, float radius, float height) const;
38+
bool inCylinder(const float* p, float radius, float height) const override;
3939
bool inMovingBox(const float* oldP, float oldAngle,
4040
const float *newP, float newAngle,
41-
float halfWidth, float halfBreadth, float height) const;
41+
float halfWidth, float halfBreadth, float height) const override;
4242
bool isCrossing(const float* p, float angle,
4343
float halfWidth, float halfBreadth, float height,
44-
float* plane) const;
44+
float* plane) const override;
4545

4646
int getTeam() const;
4747

48-
int packSize() const;
49-
void *pack(void*) const;
50-
const void *unpack(const void*);
48+
int packSize() const override;
49+
void *pack(void*) const override;
50+
const void *unpack(const void*) override;
5151

52-
void print(std::ostream& out, const std::string& indent) const;
53-
void printOBJ(std::ostream& out, const std::string& indent) const;
52+
void print(std::ostream& out, const std::string& indent) const override;
53+
void printOBJ(std::ostream& out, const std::string& indent) const override;
5454

5555
std::string userTextures[2];
5656

include/BaseSceneNodeGenerator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
#include "ObstacleSceneNodeGenerator.h"
1717
#include "BaseBuilding.h"
1818

19-
class BaseSceneNodeGenerator : public ObstacleSceneNodeGenerator
19+
class BaseSceneNodeGenerator final : public ObstacleSceneNodeGenerator
2020
{
2121
friend class SceneDatabaseBuilder;
2222
~BaseSceneNodeGenerator();
2323
public:
24-
WallSceneNode* getNextNode(float, float, bool);
24+
WallSceneNode* getNextNode(float, float, bool) override;
2525
protected:
2626
BaseSceneNodeGenerator(const BaseBuilding *);
2727
private:

include/BillboardSceneNode.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// Common headers
2424
#include "OpenGLLight.h"
2525

26-
class BillboardSceneNode : public SceneNode
26+
class BillboardSceneNode final : public SceneNode
2727
{
2828
public:
2929
BillboardSceneNode(const GLfloat pos[3]);
@@ -55,13 +55,13 @@ class BillboardSceneNode : public SceneNode
5555

5656
void move(const GLfloat pos[3]);
5757
void setAngle(GLfloat);
58-
void addLight(SceneRenderer&);
58+
void addLight(SceneRenderer&) override;
5959

60-
void notifyStyleChange();
61-
void addRenderNodes(SceneRenderer&);
60+
void notifyStyleChange() override;
61+
void addRenderNodes(SceneRenderer&) override;
6262

6363
protected:
64-
class BillboardRenderNode : public RenderNode
64+
class BillboardRenderNode final : public RenderNode
6565
{
6666
public:
6767
BillboardRenderNode(const BillboardSceneNode*);

include/BoltSceneNode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// Common headers
2424
#include "OpenGLLight.h"
2525

26-
class BoltSceneNode : public SceneNode
26+
class BoltSceneNode final : public SceneNode
2727
{
2828
public:
2929
BoltSceneNode(const GLfloat pos[3], const GLfloat vel[3], bool super);
@@ -59,7 +59,7 @@ class BoltSceneNode : public SceneNode
5959
protected:
6060
bool isSuper;
6161

62-
class BoltRenderNode : public RenderNode
62+
class BoltRenderNode final : public RenderNode
6363
{
6464
public:
6565
BoltRenderNode(const BoltSceneNode*);

0 commit comments

Comments
 (0)