Skip to content

Commit 283d9e8

Browse files
committed
refactor(Generals): rename OVERRIDE template class to OverridePtr to avoid macro conflict
1 parent aa6a7e9 commit 283d9e8

9 files changed

Lines changed: 29 additions & 29 deletions

File tree

Generals/Code/GameEngine/Include/Common/Overridable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "Common/GameMemory.h"
3232

3333
/*
34-
In order for something to live in an OVERRIDE<> object, it must be derived from Overridable
34+
In order for something to live in an OverridePtr<> object, it must be derived from Overridable
3535
(publicly).
3636
3737
This is useful for things like templates, where we want to override the template and make sure

Generals/Code/GameEngine/Include/Common/Override.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,31 @@
3131
#include "Common/Overridable.h"
3232

3333
/*
34-
An OVERRIDE is a replacement for a pointer of its contained type, ie, rather than containing
35-
a LocomotorTemplate*, you would contain an OVERRIDE<LocomotorTemplate>.
34+
An OverridePtr is a replacement for a pointer of its contained type, ie, rather than containing
35+
a LocomotorTemplate*, you would contain an OverridePtr<LocomotorTemplate>.
3636
37-
OVERRIDE pretends in all ways (dereference via *, -> and casting to type*) to be a type*, so
37+
OverridePtr pretends in all ways (dereference via *, -> and casting to type*) to be a type*, so
3838
there should be very little code that needs to be rewritten to work with these.
3939
4040
In order to make something overridable, these are the steps:
4141
1) Make the desired class derive from Overridable.
42-
2) Make the container class contain an instance of OVERRIDE<Type>
42+
2) Make the container class contain an instance of OverridePtr<Type>
4343
3) Make the newOverride function (wherever an override is new'd) request the overridables lastOverride,
4444
to ensure that no leaks are created.
4545
4646
See LocomotorTemplate for an example.
4747
*/
4848

49-
template <class T> class OVERRIDE
49+
template <class T> class OverridePtr
5050
{
5151
public:
52-
// Provide useful constructores to go from a T* to an OVERRIDE<T>
53-
OVERRIDE(const T *overridable = nullptr);
52+
// Provide useful constructores to go from a T* to an OverridePtr<T>
53+
OverridePtr(const T *overridable = nullptr);
5454
// Copy constructor
55-
OVERRIDE(OVERRIDE<T> &overridable);
56-
// Operator= for copying from another OVERRIDE and T*
57-
__inline OVERRIDE &operator=( const OVERRIDE<T>& override );
58-
__inline OVERRIDE &operator=( const T* overridable );
55+
OverridePtr(OverridePtr<T> &overridable);
56+
// Operator= for copying from another OverridePtr and T*
57+
__inline OverridePtr &operator=( const OverridePtr<T>& other );
58+
__inline OverridePtr &operator=( const T* overridable );
5959

6060
// these are the methods which we can use to access data in a pointer. (Dereference*, ->, and cast
6161
// to T*). They are all overloaded to recurse to the lowest override and use that.
@@ -67,44 +67,44 @@ template <class T> class OVERRIDE
6767
__inline const T *getNonOverloadedPointer( void ) const;
6868

6969
private:
70-
// Because OVERRIDE is meant to live on the object and not in the store, it currently contains
70+
// Because OverridePtr is meant to live on the object and not in the store, it currently contains
7171
// a constant pointer. We could change this if it seems weird.
7272
const T *m_overridable;
7373
};
7474

7575
//-------------------------------------------------------------------------------------------------
7676
template <class T>
77-
OVERRIDE<T>::OVERRIDE(const T *overridable)
77+
OverridePtr<T>::OverridePtr(const T *overridable)
7878
{
7979
m_overridable = overridable;
8080
}
8181

8282
//-------------------------------------------------------------------------------------------------
8383
template <class T>
84-
OVERRIDE<T>::OVERRIDE(OVERRIDE<T> &overridable)
84+
OverridePtr<T>::OverridePtr(OverridePtr<T> &overridable)
8585
{
8686
m_overridable = overridable.m_overridable;
8787
}
8888

8989
//-------------------------------------------------------------------------------------------------
9090
template <class T>
91-
OVERRIDE<T> &OVERRIDE<T>::operator=( const OVERRIDE<T>& override )
91+
OverridePtr<T> &OverridePtr<T>::operator=( const OverridePtr<T>& other )
9292
{
93-
m_overridable = override.m_overridable;
93+
m_overridable = other.m_overridable;
9494
return *this;
9595
}
9696

9797
//-------------------------------------------------------------------------------------------------
9898
template <class T>
99-
OVERRIDE<T> &OVERRIDE<T>::operator=(const T* overridable)
99+
OverridePtr<T> &OverridePtr<T>::operator=(const T* overridable)
100100
{
101101
m_overridable = overridable;
102102
return *this;
103103
}
104104

105105
//-------------------------------------------------------------------------------------------------
106106
template <class T>
107-
const T *OVERRIDE<T>::operator->() const
107+
const T *OverridePtr<T>::operator->() const
108108
{
109109
if (!m_overridable)
110110
return nullptr;
@@ -113,7 +113,7 @@ const T *OVERRIDE<T>::operator->() const
113113

114114
//-------------------------------------------------------------------------------------------------
115115
template <class T>
116-
const T *OVERRIDE<T>::operator*() const
116+
const T *OverridePtr<T>::operator*() const
117117
{
118118
if (!m_overridable)
119119
return nullptr;
@@ -122,14 +122,14 @@ const T *OVERRIDE<T>::operator*() const
122122

123123
//-------------------------------------------------------------------------------------------------
124124
template <class T>
125-
const T *OVERRIDE<T>::getNonOverloadedPointer( void ) const
125+
const T *OverridePtr<T>::getNonOverloadedPointer( void ) const
126126
{
127127
return (T*) m_overridable;
128128
}
129129

130130
//-------------------------------------------------------------------------------------------------
131131
template <class T>
132-
OVERRIDE<T>::operator const T*( ) const
132+
OverridePtr<T>::operator const T*( ) const
133133
{
134134
return operator*();
135135
}

Generals/Code/GameEngine/Include/Common/Thing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class Thing : public MemoryPoolObject
160160
// note that it is declared 'const' -- the assumption being that
161161
// since ThingTemplates are shared between many, many Things, the Thing
162162
// should never be able to change it.
163-
OVERRIDE<ThingTemplate> m_template; ///< reference back to template database
163+
OverridePtr<ThingTemplate> m_template; ///< reference back to template database
164164
#if defined(RTS_DEBUG)
165165
AsciiString m_templateName;
166166
#endif

Generals/Code/GameEngine/Include/GameClient/ControlBar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class CommandButton : public Overridable
316316

317317
GUICommandType getCommandType() const { return m_command; }
318318
UnsignedInt getOptions() const { return m_options; }
319-
OVERRIDE<ThingTemplate> getThingTemplate() const { return m_thingTemplate; }
319+
OverridePtr<ThingTemplate> getThingTemplate() const { return m_thingTemplate; }
320320
const UpgradeTemplate* getUpgradeTemplate() const { return m_upgradeTemplate; }
321321
const SpecialPowerTemplate* getSpecialPowerTemplate() const { return m_specialPower; }
322322
RadiusCursorType getRadiusCursorType() const { return m_radiusCursor; }

Generals/Code/GameEngine/Include/GameLogic/CrateSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class CrateTemplate : public Overridable
7878

7979
};
8080

81-
typedef OVERRIDE<CrateTemplate> CrateTemplateOverride;
81+
typedef OverridePtr<CrateTemplate> CrateTemplateOverride;
8282

8383

8484
/**

Generals/Code/GameEngine/Include/GameLogic/Locomotor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class LocomotorTemplate : public Overridable
211211
Real m_wanderAboutPointRadius;
212212
};
213213

214-
typedef OVERRIDE<LocomotorTemplate> LocomotorTemplateOverride;
214+
typedef OverridePtr<LocomotorTemplate> LocomotorTemplateOverride;
215215

216216
// ---------------------------------------------------------
217217
class Locomotor : public MemoryPoolObject, public Snapshot

Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void INI::parseWaterTransparencyDefinition( INI *ini )
118118
// texture.
119119

120120
const WaterTransparencySetting* wtOriginal = TheWaterTransparency.getNonOverloadedPointer();
121-
OVERRIDE<WaterTransparencySetting> wtOverride = TheWaterTransparency;
121+
OverridePtr<WaterTransparencySetting> wtOverride = TheWaterTransparency;
122122

123123
if (wtOriginal == wtOverride)
124124
return;

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
W3DDebrisDraw::W3DDebrisDraw(Thing *thing, const ModuleData* moduleData) : DrawModule(thing, moduleData)
5454
{
5555
m_renderObject = nullptr;
56-
for (int i = 0; i < ANIM_ANIM_STATECOUNT; ++i)
56+
for (int i = 0; i < ANIM_STATECOUNT; ++i)
5757
m_anims[i] = nullptr;
5858
m_fxFinal = nullptr;
5959
m_state = ANIM_INITIAL;

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
W3DDebrisDraw::W3DDebrisDraw(Thing *thing, const ModuleData* moduleData) : DrawModule(thing, moduleData)
5454
{
5555
m_renderObject = nullptr;
56-
for (int i = 0; i < ANIM_ANIM_STATECOUNT; ++i)
56+
for (int i = 0; i < ANIM_STATECOUNT; ++i)
5757
m_anims[i] = nullptr;
5858
m_fxFinal = nullptr;
5959
m_state = ANIM_INITIAL;

0 commit comments

Comments
 (0)