refactor: Add override keyword to virtual function overrides in Core code (2)#2603
refactor: Add override keyword to virtual function overrides in Core code (2)#2603Caball009 wants to merge 7 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Core/Libraries/Source/WWVegas/WW3D2/texture.h | Adds W3DMPO as a base class to TextureClass — necessary companion to the glueEnforcer() override fix in always.h; all W3DMPO_GLUE users that chain through TextureClass now resolve correctly. |
| Core/Libraries/Source/WWVegas/WWLib/always.h | Adds override to glueEnforcer() in W3DMPO_GLUE macro; requires all users of the macro to derive from W3DMPO — coordinated with texture.h change. |
| Core/Libraries/Source/WWVegas/WWAudio/FilteredSound.h | Adds const + override to Get_Class_ID(); fixes a real dispatch bug — non-const version was hiding, not overriding, the base-class const virtual. |
| Core/Libraries/Source/WWVegas/WWAudio/Sound3D.h | Adds const + override to Get_DropOff_Radius(); fixes same hiding-vs-override bug as FilteredSound.h. |
| Core/Libraries/Source/WWVegas/WWMath/cardinalspline.h | Adds unsigned int extra=0 parameter to Add_Key to match HermiteSpline1DClass signature, enabling correct override; implementation updated accordingly. |
| Core/GameEngine/Include/GameNetwork/LANGameInfo.h | amIHost() gets const + override to match GameInfo base; implementation correctly switches to getConstLANSlot(). |
| Core/GameEngine/Include/Common/LocalFileSystem.h | Removes redundant pure-virtual redeclarations of init/reset/update (already required by SubsystemInterface); matching empty implementations removed from .cpp. |
| Generals/Code/GameEngine/Include/Common/Module.h | Adds getAsW3DTreeDrawModuleData() virtual with nullptr default and forward declaration of W3DTreeDrawModuleData, consistent with existing getAsW3DModelDrawModuleData() pattern. |
| Core/GameEngine/Include/Common/ArchiveFileSystem.h | Removes redundant init/reset/update pure-virtual redeclarations; adds override to postProcessLoad() which re-declares it as pure virtual (overriding SubsystemInterface's non-pure default). |
| Core/GameEngine/Include/Common/GameMemory.h | Adds override to destructor and getObjectMemoryPool() in MEMORY_POOL_GLUE macros; straightforward correctness fix. |
| Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h | Adds override to several methods including private setUserControlled; all changes are mechanically correct. |
Class Diagram
%%{init: {'theme': 'neutral'}}%%
classDiagram
class W3DMPO {
+virtual ~W3DMPO()
#virtual glueEnforcer() const = 0
}
class TextureBaseClass {
+RefCountClass
}
class TextureClass {
W3DMPO_GLUE(TextureClass)
#virtual glueEnforcer() const override
}
class TerrainTextureClass {
W3DMPO_GLUE(TerrainTextureClass)
}
class W3DTreeTextureClass {
W3DMPO_GLUE(W3DTreeTextureClass)
}
W3DMPO <|-- TextureClass : added in PR
TextureBaseClass <|-- TextureClass
TextureClass <|-- TerrainTextureClass
TextureClass <|-- W3DTreeTextureClass
note for TextureClass "Before PR: TextureClass only inherited from TextureBaseClass, causing W3DMPO_GLUE override to fail"
Reviews (2): Last reviewed commit: "Fixed compilation error." | Re-trigger Greptile
xezon
left a comment
There was a problem hiding this comment.
It looks like there are a few actual fixes for bugged overrides.
| virtual void update() = 0; | ||
| virtual void reset() = 0; | ||
| virtual void postProcessLoad() = 0; | ||
| virtual void postProcessLoad() override = 0; |
There was a problem hiding this comment.
Nothing. It's just to acknowledge that the base class also has this exact function, but it's not pure virtual. If that were removed that would lead to a compilation error here, which seems desirable.
| } | ||
|
|
||
| Bool LANGameInfo::amIHost() | ||
| Bool LANGameInfo::amIHost() const |
There was a problem hiding this comment.
Does this change behavior? Meaning a different function is called now?
| virtual RenderObjClass * Clone() const override; | ||
| virtual int Class_ID() const override; | ||
| virtual void Render(RenderInfoClass & rinfo) = 0; | ||
| virtual void Render(RenderInfoClass & rinfo) override = 0; |
There was a problem hiding this comment.
Nothing. It's just to acknowledge that the base class also has this exact function, but it's not pure virtual. If that were removed that would lead to a compilation error here, which seems desirable.
There was a problem hiding this comment.
This looks like it does not belong here.
|
Needs rebase |
This PR adds the keyword
overrideto a number of virtual functions in the Core code that were missed in the previous round of refactoring.Check out the commits as they separate different types of changes.
Related PRs:
#2604
#2605