Skip to content

refactor: Add override keyword to virtual function overrides in Core code (2)#2603

Open
Caball009 wants to merge 10 commits intoTheSuperHackers:mainfrom
Caball009:override_keyword_core
Open

refactor: Add override keyword to virtual function overrides in Core code (2)#2603
Caball009 wants to merge 10 commits intoTheSuperHackers:mainfrom
Caball009:override_keyword_core

Conversation

@Caball009
Copy link
Copy Markdown

@Caball009 Caball009 commented Apr 15, 2026

This PR adds the keyword override to 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

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 15, 2026

Greptile Summary

This PR continues the override refactor from #2101, adding the override specifier to virtual function overrides across 68 files in Core. Beyond pure keyword additions, the PR also removes redundant pure-virtual re-declarations of init()/reset()/update() from several intermediate interface classes (already mandated by SubsystemInterface), aligns CardinalSpline1DClass::Add_Key to match its base-class signature, makes amIHost() const-correct, and fixes TextureClass to explicitly inherit from W3DMPO — resolving a latent inconsistency since the class already used the W3DMPO_GLUE macro.

Confidence Score: 5/5

Safe to merge; all changes are mechanically correct and no P0/P1 issues were found.

All override additions were verified against their respective base-class declarations. Redundant pure-virtual removals are safe because SubsystemInterface still mandates them and all concrete subclasses already provide implementations. The W3DMPO_GLUE macro change is consistent with every user inheriting W3DMPO. The only finding is a trivial style inconsistency.

Core/Tools/ParticleEditor/VelocityTypePanels.h — minor style inconsistency on VelocityPanelHemisphere::performUpdate.

Important Files Changed

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 xezon changed the title refactor: Add override keyword to virtual function overrides in Core code refactor: Add override keyword to virtual function overrides in Core code (2) Apr 16, 2026
Copy link
Copy Markdown

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if this was removed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this change behavior? Meaning a different function is called now?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a bug to me, but without noticeable issues:

Code

Bool GameInfo::amIHost() const
{
DEBUG_ASSERTCRASH(m_inGame, ("Looking for game slot while not in game"));
if (!m_inGame)
return false;
return getConstSlot(0)->isPlayer(m_localIP);
}

Bool GameSlot::isPlayer( UnsignedInt ip ) const
{
return (m_state == SLOT_PLAYER && m_IP == ip);
}

Bool LANGameInfo::amIHost()
{
DEBUG_ASSERTCRASH(m_inGame, ("Looking for game slot while not in game"));
if (!m_inGame)
return false;
return getLANSlot(0)->isLocalPlayer();
}

Bool LANGameSlot::isLocalPlayer() const
{
return isHuman() && TheLAN && TheLAN->GetLocalIP() == getIP();
}

virtual RenderObjClass * Clone() const override;
virtual int Class_ID() const override;
virtual void Render(RenderInfoClass & rinfo) = 0;
virtual void Render(RenderInfoClass & rinfo) override = 0;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if this is omitted?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Core/Tools/W3DView/ViewerAssetMgr.h Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it does not belong here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, but the code will fail in Generals because of it until #2604 is merged.

@xezon
Copy link
Copy Markdown

xezon commented Apr 17, 2026

Needs rebase

Comment thread Core/Tools/ParticleEditor/ParticleTypePanels.h Outdated
@Caball009 Caball009 force-pushed the override_keyword_core branch from e39b56f to 3db25c4 Compare May 2, 2026 22:22
@Caball009
Copy link
Copy Markdown
Author

Needs rebase

Rebased, but not sure if it went without a hitch.

@xezon
Copy link
Copy Markdown

xezon commented May 4, 2026

Rebase again.

@Caball009 Caball009 force-pushed the override_keyword_core branch from 10d71ec to 5e6f6bb Compare May 4, 2026 20:18
Comment thread Generals/Code/GameEngine/Include/Common/Module.h
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 4, 2026

Want your agent to iterate on Greptile's feedback? Try greploops.

@Caball009
Copy link
Copy Markdown
Author

Rebase again.

Should be good now.

@Caball009
Copy link
Copy Markdown
Author

I think I missed one or two cases in Gen / ZH. Should I just put them in this PR?

@xezon
Copy link
Copy Markdown

xezon commented May 5, 2026

I think I missed one or two cases in Gen / ZH. Should I just put them in this PR?

Yes you can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Edits the code with insignificant behavior changes, is never user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants