Skip to content

refactor: Add override keyword to virtual function overrides in Libraries#2390

Open
bobtista wants to merge 5 commits intoTheSuperHackers:mainfrom
bobtista:bobtista/override-keyword-libraries
Open

refactor: Add override keyword to virtual function overrides in Libraries#2390
bobtista wants to merge 5 commits intoTheSuperHackers:mainfrom
bobtista:bobtista/override-keyword-libraries

Conversation

@bobtista
Copy link

@bobtista bobtista commented Mar 3, 2026

Summary

  • Add override keyword to virtual function overrides in Libraries (WWVegas: WW3D2, WWAudio, WWLib, WWMath, WWSaveLoad, etc.)
  • Changes across Core/Libraries, Generals/Libraries, and GeneralsMD/Libraries

Context

Part 2/6 of splitting #2101. Depends on #2389 merging first.

Notes

  • 156 files changed, purely mechanical override keyword additions
  • All lines retain the virtual keyword

@greptile-apps
Copy link

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR is Part 2/6 of splitting #2101, adding the override keyword to virtual function overrides across 156 header and source files in Core/Libraries, Generals/Libraries, and GeneralsMD/Libraries (WWVegas: WW3D2, WWAudio, WWLib, WWMath, WWSaveLoad, and profile). The changes are purely mechanical and improve code safety by making the compiler enforce that each decorated function actually overrides a base-class virtual — any mismatch would now be a compile error rather than a silent mismatch.

  • Scope: 156 files touched, all changes follow the same pattern of appending override (and in a few cases also adding the redundant but harmless virtual) to existing virtual overrides.
  • Correctness: All verified overrides reference base-class virtual declarations (e.g., RenderObjClass, ParameterClass, VectorClass, SceneClass, TextureMapperClass, etc.).
  • No behavioural change: The override specifier is a compile-time annotation only; it does not alter generated code or runtime behaviour.
  • Depends on: PR refactor: Add compatibility macros for override and final keywords and rename conflicting identifiers #2389 merging first.

Confidence Score: 5/5

  • This PR is safe to merge — purely additive compile-time annotations with no behavioural impact.
  • All 156 files contain only mechanical override additions to already-virtual overrides. The override specifier is enforced by the compiler, so any incorrect application would be caught as a compile error. No logic, runtime behaviour, or data layout is changed.
  • No files require special attention.

Important Files Changed

Filename Overview
Core/Libraries/Source/WWVegas/WW3D2/collect.h Adds override to all virtual function overrides in CollectionClass and CollectionLoaderClass; also correctly adds virtual + override to Update_Sub_Object_Transforms, which was implicitly virtual in the base class RenderObjClass.
Core/Libraries/Source/WWVegas/WW3D2/rendobj.h Adds override to ~RenderObjClass destructor and three PersistClass-derived virtual methods; changes are minimal and correct.
Core/Libraries/Source/WWVegas/WWSaveLoad/simpleparameter.h Adds virtual and override to operator==, Get_Type, and Copy_Value — all confirmed virtual in the ParameterClass base class.
Core/Libraries/Source/WWVegas/WWSaveLoad/parameter.h Adds override to many virtual method overrides across StringParameterClass, FilenameParameterClass and other parameter types; all correctly reference base class virtuals.
Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp Adds override to the ~ActiveCategoryStackClass destructor in an anonymous class; valid if the base has a virtual destructor.
Generals/Code/Libraries/Source/WWVegas/WW3D2/mapper.h Adds override to all mapper subclasses (ScaleTextureMapper, LinearOffsetTextureMapper, GridTextureMapper, RotateTextureMapper, etc.); consistently applied throughout the file.
Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.h Mechanical override additions to all MeshClass virtual overrides; no issues found.
Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.h Adds override to SceneClass and SimpleSceneClass virtual overrides; ~SceneClass inherits from RefCountClass which has a virtual destructor, so override on ~SceneClass is correct.
Core/Libraries/Source/profile/internal_result.h Adds override to WriteResults and Delete in ProfileResultFileCSV and ProfileResultFileDOT; straightforward and correct.
Core/Libraries/Source/WWVegas/WWLib/Vector.h Adds override to Resize, Clear, and ID in DynamicVectorClass; all are virtual in the VectorClass base.

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
    class RenderObjClass {
        +virtual Clone() const
        +virtual Class_ID() const
        +virtual Render()
        +virtual Cast_Ray()
        +virtual Scale()
        +virtual Update_Sub_Object_Transforms()
    }
    class CollectionClass {
        +virtual Clone() const override
        +virtual Class_ID() const override
        +virtual Render() override
        +virtual Cast_Ray() override
        +virtual Scale() override
        +virtual Update_Sub_Object_Transforms() override
    }
    class MeshClass {
        +virtual Clone() const override
        +virtual Class_ID() const override
        +virtual Render() override
        +virtual Cast_Ray() override
        +virtual Scale() override
    }
    class DistLODClass {
        +virtual Clone() const override
        +virtual Class_ID() const override
        +virtual Render() override
        +virtual Cast_Ray() override
        +virtual Scale() override
    }
    class ParameterClass {
        +virtual operator==()
        +virtual Get_Type() const
        +virtual Copy_Value()
    }
    class SimpleParmClass {
        +virtual operator==() override
        +virtual Get_Type() const override
        +virtual Copy_Value() override
    }
    class VectorClass {
        +virtual Resize()
        +virtual Clear()
        +virtual ID()
    }
    class DynamicVectorClass {
        +virtual Resize() override
        +virtual Clear() override
        +virtual ID() override
    }

    RenderObjClass <|-- CollectionClass
    RenderObjClass <|-- MeshClass
    RenderObjClass <|-- DistLODClass
    ParameterClass <|-- SimpleParmClass
    VectorClass <|-- DynamicVectorClass
Loading

Last reviewed commit: 5919d77

@xezon xezon added the Refactor Edits the code with insignificant behavior changes, is never user facing label Mar 10, 2026
@xezon
Copy link

xezon commented Mar 10, 2026

This also needs rebase

@bobtista
Copy link
Author

This also needs rebase

do you have the latest pulled locally? Github doesn't show a merge conflict for me

@xezon
Copy link

xezon commented Mar 10, 2026

But it still 4 commits present that are already in main branch. Something is not right.

@bobtista bobtista force-pushed the bobtista/override-keyword-libraries branch from a0fc760 to 06c9db7 Compare March 11, 2026 01:47
@bobtista
Copy link
Author

You're right - rebased, looks better now

virtual int Get_Sort_Level() const { return SortLevel; }
virtual void Set_Sort_Level(int level) { SortLevel = level; if(level != SORT_LEVEL_NONE) Disable_Sort();}
virtual int Get_Sort_Level() const override { return SortLevel; }
virtual void Set_Sort_Level(int level) override { SortLevel = level; if(level != SORT_LEVEL_NONE) Disable_Sort();}

Choose a reason for hiding this comment

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

spacing


virtual bool Load_Compressed_Mipmap ();
virtual bool Load_Compressed_Mipmap () override;
// virtual bool Load_Uncompressed_Mipmap();

Choose a reason for hiding this comment

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

Its commented out, but maybe play it safe and add override here is well.


virtual bool Load_Compressed_Mipmap ();
virtual bool Load_Compressed_Mipmap () override;
// virtual bool Load_Uncompressed_Mipmap();

Choose a reason for hiding this comment

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

Its commented out, but maybe play it safe and add override here is well.

@xezon xezon changed the title refactor(Libraries): Add override keyword to virtual function overrides refactor: Add override keyword to virtual function overrides in Libraries Mar 17, 2026
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.

3 participants