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 missing W3DMPO base class to TextureClass, which already used W3DMPO_GLUE. Fixes latent inconsistency — all other W3DMPO_GLUE users correctly list W3DMPO as a base. |
| Core/Libraries/Source/WWVegas/WWLib/always.h | Adds override to glueEnforcer() in W3DMPO_GLUE macro. All users of the macro inherit from W3DMPO directly or transitively, so the override is valid. |
| Core/Libraries/Source/WWVegas/WWMath/cardinalspline.h | Aligns CardinalSpline1DClass::Add_Key signature with HermiteSpline1DClass base by adding the extra parameter and override specifier. |
| Core/GameEngine/Include/GameNetwork/LANGameInfo.h | amIHost() made const to match GameInfo base-class declaration; implementation updated to use getConstLANSlot for const correctness. |
| Core/GameEngine/Include/Common/ArchiveFileSystem.h | Removes redundant pure-virtual re-declarations of init/update/reset (already mandated by SubsystemInterface); adds override to postProcessLoad. |
| Core/GameEngine/Include/Common/LocalFileSystem.h | Removes redundant pure-virtual re-declarations of init/reset/update; concrete subclasses already provide their own overrides. |
| Core/Libraries/Source/WWVegas/WWAudio/FilteredSound.h | Adds const and override to Get_Class_ID(), matching SoundPseudo3DClass base signature. |
| Core/Tools/ParticleEditor/VelocityTypePanels.h | Adds override to panel virtual functions; VelocityPanelHemisphere::performUpdate inconsistently omits the virtual keyword present on all other panels. |
| Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h | Adds override to several W3DView virtual functions including isDoingScriptedCamera, stopDoingScriptedCamera, cameraModFreezeTime, isTimeFrozen, and private setUserControlled. |
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
Missing `virtual` keyword on `VelocityPanelHemisphere::performUpdate`. Every other panel in this file (e.g. `VelocityPanelOrtho`, `VelocityPanelSphere`, etc.) declares `virtual void performUpdate(...) override;`, but this one omits `virtual`. While C++ allows omitting `virtual` in derived classes, the inconsistency stands out against the surrounding pattern established by the refactor.
```suggestion
virtual void performUpdate( IN Bool toUI ) override;
```
Reviews (8): Last reviewed commit: "Revert "Removed Generals specific change..." | 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. |
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