refactor(GameEngine): Add override keyword to virtual function overrides#2392
Open
bobtista wants to merge 7 commits intoTheSuperHackers:mainfrom
Open
refactor(GameEngine): Add override keyword to virtual function overrides#2392bobtista wants to merge 7 commits intoTheSuperHackers:mainfrom
bobtista wants to merge 7 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Include/GameLogic/ScriptActions.h | Promotes previously non-virtual methods (executeAction, closeWindows, doEnableOrDisableObjectDifficultyBonuses, ~ScriptActions) to virtual override — a legitimate polymorphism bug fix on top of the mechanical refactor. |
| GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h | Same promotions to virtual override as the Generals counterpart — correct fixes for previously missing virtual dispatch on executeAction, closeWindows, and doEnableOrDisableObjectDifficultyBonuses. |
| Generals/Code/GameEngine/Include/GameLogic/ScriptConditions.h | evaluateCondition, evaluateTeamIsContained, and evaluateSkirmishCommandButtonIsReady are correctly promoted to virtual override — all are declared pure virtual in ScriptConditionsInterface. |
| GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptConditions.h | Same correct virtual override promotions as the Generals counterpart for evaluateCondition, evaluateTeamIsContained, and evaluateSkirmishCommandButtonIsReady. |
| Core/GameEngine/Source/GameNetwork/Network.cpp | All method declarations (sendChat, sendDisconnectChat, etc.) correctly gain override — verified against the pure-virtual signatures in NetworkInterface. |
| Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp | override added to all VictoryConditions implementations; minor style inconsistency where some previously non-virtual methods (hasAchievedVictory, hasBeenDefeated, hasSinglePlayerBeenDefeated) gain the virtual keyword while others (init, reset, update) only get override — harmless but inconsistent with the PR's stated goal of retaining virtual. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp | Same override additions with the same minor style inconsistency as the Generals version; all changes are logically correct. |
| Core/GameEngine/Source/GameNetwork/GameSpy/GSConfig.cpp | Mechanical override additions; getPointsForRank gains the virtual keyword while other previously non-virtual methods (getPingServers, getNumPingRepetitions, etc.) do not — same style inconsistency pattern as VictoryConditions, harmless. |
| Core/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp | Thread_Function() correctly gains virtual override — confirmed as pure virtual in ThreadClass (WWLib/thread.h). |
| Core/GameEngine/Include/GameNetwork/LANAPI.h | All 90 LANAPI method declarations correctly gain override; all verified as pure virtual in LANAPIInterface. |
| Core/GameEngine/Include/GameNetwork/GameSpy/PeerDefsImplementation.h | All 196 changed lines correctly add override to GameSpyInfo method declarations; purely mechanical. |
| Core/GameEngine/Include/GameClient/GameWindowTransitions.h | 190 line changes across many Transition subclasses — all purely mechanical override additions with no signature changes. |
| GeneralsMD/Code/GameEngine/Include/GameLogic/AIGuardRetaliate.h | GeneralsMD-only file; shouldExit, onEnter, update, onExit, crc, xfer, loadPostProcess all correctly gain override across several AI state classes. |
| Core/GameEngine/Source/GameClient/FXList.cpp | All doFXPos and doFXObj overrides correctly marked with override; purely mechanical with no signature alterations. |
Class Diagram
%%{init: {'theme': 'neutral'}}%%
classDiagram
class SubsystemInterface {
+virtual ~SubsystemInterface()
+virtual init() = 0
+virtual reset() = 0
+virtual update() = 0
}
class ScriptActionsInterface {
+virtual ~ScriptActionsInterface() override
+virtual executeAction() = 0
+virtual closeWindows() = 0
+virtual doEnableOrDisableObjectDifficultyBonuses() = 0
}
class ScriptActions {
+virtual ~ScriptActions() override
+virtual executeAction() override
+virtual closeWindows() override
+virtual doEnableOrDisableObjectDifficultyBonuses() override
}
class ScriptConditionsInterface {
+virtual ~ScriptConditionsInterface() override
+virtual evaluateCondition() = 0
+virtual evaluateTeamIsContained() = 0
+virtual evaluateSkirmishCommandButtonIsReady() = 0
}
class ScriptConditions {
+virtual ~ScriptConditions() override
+virtual evaluateCondition() override
+virtual evaluateTeamIsContained() override
+virtual evaluateSkirmishCommandButtonIsReady() override
}
class VictoryConditionsInterface {
+virtual init() = 0
+virtual reset() = 0
+virtual hasAchievedVictory() = 0
+virtual hasBeenDefeated() = 0
+virtual getEndFrame() = 0
}
class VictoryConditions {
+init() override
+reset() override
+virtual hasAchievedVictory() override
+virtual hasBeenDefeated() override
+virtual getEndFrame() override
}
class NetworkInterface {
+virtual init() = 0
+virtual sendChat() = 0
+virtual sendDisconnectChat() = 0
+virtual isStalling() = 0
+virtual quitGame() = 0
}
class Network {
+init() override
+virtual sendChat() override
+virtual sendDisconnectChat() override
+virtual isStalling() override
+virtual quitGame() override
}
SubsystemInterface <|-- ScriptActionsInterface
ScriptActionsInterface <|-- ScriptActions
SubsystemInterface <|-- ScriptConditionsInterface
ScriptConditionsInterface <|-- ScriptConditions
SubsystemInterface <|-- VictoryConditionsInterface
VictoryConditionsInterface <|-- VictoryConditions
SubsystemInterface <|-- NetworkInterface
NetworkInterface <|-- Network
Last reviewed commit: 949b25a
3b4cf3d to
d8471a3
Compare
Skyaero42
reviewed
Mar 12, 2026
| virtual void crc( Xfer *xfer ){}; | ||
| virtual void xfer( Xfer *xfer ){XferVersion cv = 1; XferVersion v = cv; xfer->xferVersion( &v, cv );} | ||
| virtual void loadPostProcess(){}; | ||
| virtual void crc( Xfer *xfer ) override{}; |
…des in GameEngine
f2574b2 to
949b25a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
overridekeyword to virtual function overrides in GameEngine (excluding GameLogic/Module)Context
Part 4/6 of splitting #2101. Depends on #2389 merging first.
Notes
overridekeyword additionsvirtualkeyword from enum entries in Scripts.hvirtualkeyword