Rework the extension system into a mirror class hierarchy#2291
Conversation
…the game hierarchy
Agree with that. |
# Conflicts: # docs/Whats-New.md # src/Ext/Bullet/Body.h # src/Ext/Bullet/Hooks.DetonateLogics.cpp # src/Ext/WeaponType/Body.h
…chnoTypeExt ExtMap
|
My agent and I have reviewed all the changes. I believe the following issues require attention:
|
|
…ns-2 # Conflicts: # docs/Whats-New.md # src/Ext/Techno/Body.h # src/Ext/TechnoType/Body.h # src/Ext/TechnoType/Hooks.Teleport.cpp
|
Removing the ExtData will blow up most of the current branches 💀 |
You overestiamte; It should only affect extension header files mostly (for when new fields/methods are added). Most Code already uses |
Yeah but many branches make new fields 🙃 |
|
Fine. Migration may not be a big problem since we have agent. Maybe I can make another skill to help agent resolve conflicts correctly. |
|
we've done some intensive FFA test with it, no crash or visible error has occured so far. Is there anything that should be tested specifically? |
I was just doing some final tests and discovered that loading a save from the client works, but loading from inside the game crashes (I was unable to test this previously due to ddraw breaking the menus). I'm looking into that, and once that's resolved, it should be good to go. |
|
Fixed; Should be good to go |


Reworks the extension system for
AbstractClass-derived classes to follow the game's own model, replacing the previous per-classExtData/ExtMapmachinery.Extension classes now form an inheritance hierarchy mirroring the game's class tree, rooted at
AbstractExt(BuildingExt:TechnoExt:RadioExt:MissionExt:ObjectExt:AbstractExt, same on the type side). Every game object carries exactly one extension of its most derived matching type, cached in the unusedAbstractClass+0x18field and fetched via typedFetch/TryFetchat any hierarchy level.One container per concrete leaf class tracks live extensions for bulk operations; extensions are allocated/destroyed by ctor/dtor hooks.
Savegame serialization is centralized: per-container streams written after Rules, owners remapped through the swizzle manager, inline slots relinked post-swizzle. The old ~80 per-class savegame hooks are gone.
Pointer invalidation broadcast is replaced by a typed
Detach::Listener<T>registry.Cells are the one exception: the game treats them as value objects with unstable identity (in-place reconstruction, wholesale copies in
SetMapDimensions, partial saves), so cell extensions are persisted inline within each cell's own savegame block, and dedicated hooks keep their slots consistent through map setup.