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 10 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Core/Libraries/Source/WWVegas/WW3D2/texture.h | Adds W3DMPO as a base class of TextureClass — a structural fix required by the W3DMPO_GLUE macro whose glueEnforcer() now uses override in always.h; all other W3DMPO_GLUE users already had W3DMPO in their hierarchy, making TextureClass the sole exception. |
| Core/Libraries/Source/WWVegas/WWLib/always.h | Adds override to glueEnforcer() inside W3DMPO_GLUE macro; tightly coupled to the texture.h fix. |
| Core/Libraries/Source/WWVegas/WWMath/cardinalspline.h | Adds override and aligns Add_Key signature with the base HermiteSpline1DClass three-parameter version; correct. |
| Core/GameEngine/Include/Common/ArchiveFileSystem.h | Removes redundant init/update/reset re-declarations and adds override to postProcessLoad(). |
| Core/GameEngine/Include/GameNetwork/LANGameInfo.h | Promotes amIHost() to virtual const override, matching the GameInfo base; implementation switches to getConstLANSlot() correctly. |
| Generals/Code/GameEngine/Include/Common/DrawModule.h | Adds setAnimationFrame(int frame) = 0 as pure virtual to match GeneralsMD, enabling W3DModelDraw::setAnimationFrame override. |
| Core/Tools/ParticleEditor/VelocityTypePanels.h | Adds override to all panel methods; VelocityPanelHemisphere::performUpdate omits virtual keyword, minor inconsistency. |
| Core/GameEngine/Include/Common/GameMemory.h | Adds override to destructor and getObjectMemoryPool() in MEMORY_POOL_GLUE macros; correct. |
| Core/Libraries/Source/WWVegas/WWAudio/FilteredSound.h | Adds const and override to Get_Class_ID(), matching the const base-class declaration. |
| Core/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTreeDraw.h | Adds override to getAsW3DTreeDrawModuleData(); base declaration present in both Generals and GeneralsMD Module.h. |
Class Diagram
%%{init: {'theme': 'neutral'}}%%
classDiagram
class SubsystemInterface {
+virtual init() = 0
+virtual reset() = 0
+virtual update() = 0
+virtual postProcessLoad()
}
class ArchiveFileSystem {
+virtual postProcessLoad() override = 0
}
class W3DMPO {
+virtual glueEnforcer() const = 0
}
class TextureBaseClass
class TextureClass {
+W3DMPO_GLUE(TextureClass)
}
class GameInfo {
+virtual amIHost() const
}
class LANGameInfo {
+virtual amIHost() const override
}
class DrawModuleGenerals {
+virtual setAnimationFrame(int frame) = 0
}
class W3DModelDraw {
+virtual setAnimationFrame(int frame) override
}
SubsystemInterface <|-- ArchiveFileSystem
W3DMPO <|-- TextureClass
TextureBaseClass <|-- TextureClass
GameInfo <|-- LANGameInfo
DrawModuleGenerals <|-- W3DModelDraw
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
Core/Tools/ParticleEditor/VelocityTypePanels.h:94
All sibling panels in this file (and in EmissionTypePanels.h / ParticleTypePanels.h) use `virtual void performUpdate(...) override`, but `VelocityPanelHemisphere` has only `void performUpdate(...) override` — `virtual` was not added here. While `override` alone is sufficient for correctness (the function remains virtual), the inconsistency is likely an oversight in the refactor pass.
```suggestion
virtual void performUpdate( IN Bool toUI ) override;
```
Reviews (9): Last reviewed commit: "Added missing override keywords (third p..." | 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?
There was a problem hiding this comment.
Looks like a bug to me, but without noticeable issues:
Code
GeneralsGameCode/Core/GameEngine/Source/GameNetwork/GameInfo.cpp
Lines 500 to 507 in efabb08
GeneralsGameCode/Core/GameEngine/Source/GameNetwork/GameInfo.cpp
Lines 275 to 278 in efabb08
GeneralsGameCode/Core/GameEngine/Source/GameNetwork/LANGameInfo.cpp
Lines 164 to 171 in efabb08
GeneralsGameCode/Core/GameEngine/Source/GameNetwork/LANGameInfo.cpp
Lines 82 to 85 in efabb08
| 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.
There was a problem hiding this comment.
Removed, but the code will fail in Generals because of it until #2604 is merged.
|
Needs rebase |
e39b56f to
3db25c4
Compare
Rebased, but not sure if it went without a hitch. |
|
Rebase again. |
The code will fail in Generals because of it until addressed.
10d71ec to
5e6f6bb
Compare
This reverts commit d949582.
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
Should be good now. |
|
I think I missed one or two cases in Gen / ZH. Should I just put them in this PR? |
Yes you can. |
|
FYI I'm seeing this warning |
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