[Refactoring] Migrate UIEntity::grid from shared_ptr<UIGrid> to shared_ptr<GridData> #313
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
john/McRogueFace#313
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The Grid / GridView overhaul (#252) extracted
GridDataas the pure data layer.UIGridnow inherits from bothUIDrawableandGridData.UIGridViewholds astd::shared_ptr<GridData>and renders from it.UIGridPoint,GridChunk, andGridLayerwere all converted to holdGridData* parent_gridinstead ofUIGrid*.The one remaining holdout is Entity.
UIEntity::gridis stillstd::shared_ptr<UIGrid>:shared_ptr<UIGrid>also appears inUIEntityCollection.h,GridLayers.cpp,UIGridPoint.h, and a few call sites inUIEntity.cpp. These are the last places where entity logic is coupled to the rendering type instead of the data layer.Why migrate
GridDatarather thanUIGridmeans game logic works correctly in contexts where rendering isn't loaded.entity.gridmeans: is it the rendering-coupledmcrfpy.Gridor a pure data view?Entity.gridstate as DiscreteMap referencedepends on this data-layer plumbing existing cleanly.Scope
C++ changes
UIEntity::gridfromstd::shared_ptr<UIGrid>tostd::shared_ptr<GridData>entity->grid->getTexture(), etc.) to go throughGridDatamethods (most already exist onGridData; any UIGrid-only method needs to be hoisted or accessed via a different path)UIEntityCollection,GridLayers,UIGridPointreferencesPython API decisions
entity.gridstill returns themcrfpy.GridPython object. The C++GridData*has to be upcast toUIGridfor Python exposure. Requires that any GridData owned by a UIGrid can reach back to its UIGrid, OR that Python-side storage keeps both pointers.entity.gridreturns the UIGrid (as today) when one exists; a newentity.grid_datareturns a data-only handle. Explicit dual API.entity.gridstarts returning a newmcrfpy.GridDataPython type. Breaking change, but cleanest.Recommend Option A for 1.0 unless there's a game-dev reason to split.
Tests
Blocks / Related
Estimate
Medium. The type change is mechanical; the interesting work is the Python API decision and the corresponding update to docs / stubs.