-
-
Notifications
You must be signed in to change notification settings - Fork 146
Rework the extension system into a mirror class hierarchy #2291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ZivDero
merged 50 commits into
Phobos-developers:develop
from
ZivDero:inherited-extensions-2
Jul 18, 2026
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
881e5ce
Extract non-template AbstractClassExtension base
ZivDero f9a962c
Move single-extension classes to the unified 0x18 slot
ZivDero 5284f7d
Merge BuildingClass extension into the TechnoClass hierarchy
ZivDero 83bbf85
Merge BuildingTypeClass extension into the TechnoTypeClass hierarchy
ZivDero 26b5623
Add top-level ClassExtension names for the Techno/Building hierarchy
ZivDero 42addd1
Consolidate trigger extensions on the 0x18 slot and drop redundant se…
ZivDero ff991fc
Add top-level ClassExtension names for the remaining extensions
ZivDero d654490
Add intermediate extension bases and reparent Techno/TechnoType onto …
ZivDero 16f1ef4
Instantiate concrete Unit/Infantry/Aircraft leaves instead of the Tec…
ZivDero 9a59cbe
Fix leaf extension ctor hooks to run after the base ctor chain
ZivDero 739ed0e
Rename extension root class to AbstractExt
ZivDero 1314db4
Reparent remaining extensions onto the game mirror hierarchy
ZivDero 1432241
Replace pointer invalidation broadcast with typed detach listener reg…
ZivDero 98fa43d
Centralize extension save/load through per-container streams and post…
ZivDero 8c1273e
Flatten extension data classes onto the mirror hierarchy and adopt Fe…
ZivDero ca85550
Update project structure documentation for the new extension system
ZivDero f635444
Track extensions in one container per concrete leaf class
ZivDero d5fd64e
Destroy extensions from concrete leaf destructor hooks
ZivDero e5b82d5
Expose slot-read Fetch on every hierarchy level and unify the slot co…
ZivDero b266495
Hook the twin type destructor bodies the vtables point at
ZivDero bf483a4
Enable /MP
ZivDero 3d7e46e
Allocate the building extension before the in-constructor Init call
ZivDero 5df72cf
Replace the building TypeExtData shadow member with a typed accessor
ZivDero 4b9685b
Resolve extension data classes in the container instead of per-class …
ZivDero b7ad2d4
Remove extensions late in the leaf destructor bodies before the base …
ZivDero a99acc1
Size the destructor hooks to cover whole instructions
ZivDero 66fa4f1
Cover the standalone type destructor tails via the alignment padding
ZivDero d0ba272
Add the missing ParticleTypeClass destructor hook
ZivDero 4d3ec3c
Clean up extension system comments
ZivDero 3c4511c
Handle in-place cell reconstruction and the static working cell
ZivDero 04a1c92
Tolerate cells absent from the savegame on save and load
ZivDero 8036a68
Rebuild cell extension slots after SetMapDimensions copies cells around
ZivDero e1fde19
Clear the extension slot when an object is loaded from a savegame
ZivDero c1fa685
Persist cell extensions inline with their cells
ZivDero f6c12cc
Polish comments and documentation for the extension rework
ZivDero 471967f
Add changelog and credits entries
ZivDero 830f6ae
Move changelog entries to the end of the lists
ZivDero 1bdefa3
Merge remote-tracking branch 'origin/develop' into inherited-extensio…
ZivDero be1438b
Merge branch 'develop' into inherited-extensions-2
ZivDero d1f2524
Add typed checked Fetch/TryFetch accessors, deprecate container lookups
ZivDero 802bf9e
Route all extension lookups through Fetch/TryFetch, shim TechnoExt/Te…
ZivDero 48af0a3
Document the extension lookup API
ZivDero cfb95b8
Move container hooks to the end of extension Body.cpp files
ZivDero f4d1695
Standardize container sections in the new leaf extension files
ZivDero c1ce7a0
Merge remote-tracking branch 'origin/develop' into inherited-extensio…
ZivDero 57d93d3
Remove old TODO
ZivDero e691df7
Add deprecated ExtData self-aliases for source compatibility
ZivDero 4d5aeee
Use TryFetch where extension lookups are null-checked
ZivDero 1753d26
Make pointer invalidation handlers drop references even without the e…
ZivDero 9c3ffc6
Stack the ParticleTypeClass destructor hook on Ares' address to avoid…
ZivDero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #pragma once | ||
|
|
||
| #include <AbstractTypeClass.h> | ||
| #include <Utilities/Container.h> | ||
|
|
||
| // Empty intermediate base mirroring AbstractTypeClass in the extension hierarchy. | ||
| class AbstractTypeExt : public AbstractExt | ||
| { | ||
| public: | ||
| explicit AbstractTypeExt(AbstractTypeClass* const OwnerObject) : AbstractExt(OwnerObject) | ||
| { } | ||
|
|
||
| AbstractTypeClass* OwnerObject() const | ||
| { | ||
| return static_cast<AbstractTypeClass*>(this->GetAttachedObject()); | ||
| } | ||
|
|
||
| static AbstractTypeExt* Fetch(const AbstractTypeClass* pThis) | ||
| { | ||
| return AbstractExt::Fetch<AbstractTypeExt>(pThis); | ||
| } | ||
|
|
||
| static AbstractTypeExt* TryFetch(const AbstractTypeClass* pThis) | ||
| { | ||
| return AbstractExt::TryFetch<AbstractTypeExt>(pThis); | ||
| } | ||
| }; |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,45 @@ | ||
| #pragma once | ||
| #include <Ext/Techno/Body.h> | ||
| #include <Ext/Foot/Body.h> | ||
| #include <AircraftClass.h> | ||
|
|
||
| // TODO: Implement proper extended AircraftClass. | ||
|
|
||
| class AircraftExt | ||
| // Concrete leaf extension for AircraftClass (empty; techno data lives in TechnoExt). | ||
| class AircraftExt final : public FootExt | ||
| { | ||
| public: | ||
| using base_type = AircraftClass; | ||
|
|
||
| static constexpr DWORD Canary = 0xA1A2A3A4; | ||
|
|
||
| explicit AircraftExt(AircraftClass* const OwnerObject) : FootExt(OwnerObject) | ||
| { } | ||
|
|
||
| AircraftClass* OwnerObject() const | ||
| { | ||
| return static_cast<AircraftClass*>(this->GetAttachedObject()); | ||
| } | ||
|
|
||
| static void FireWeapon(AircraftClass* pThis, AbstractClass* pTarget); | ||
| static bool PlaceReinforcementAircraft(AircraftClass* pThis, CoordStruct edgeCoords); | ||
| static CellStruct PickEdgeCellForPlane(AircraftTypeClass* pPlaneType, CellStruct destCell, Edge edge, bool isOnRetreat = false); | ||
| static DirType GetLandingDir(AircraftClass* pThis, BuildingClass* pDock = nullptr); | ||
|
|
||
| class ExtContainer final : public Container<AircraftExt> | ||
| { | ||
| public: | ||
| ExtContainer(); | ||
| ~ExtContainer(); | ||
| }; | ||
|
|
||
| static ExtContainer ExtMap; | ||
|
|
||
| static AircraftExt* Fetch(const AircraftClass* pThis) | ||
| { | ||
| return AbstractExt::Fetch<AircraftExt>(pThis); | ||
| } | ||
|
|
||
| static AircraftExt* TryFetch(const AircraftClass* pThis) | ||
| { | ||
| return AbstractExt::TryFetch<AircraftExt>(pThis); | ||
| } | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.