Skip to content

Run cursor action pre-draw logic before capturing the object under th…#324

Open
NayiemW wants to merge 1 commit into
CnCNet:masterfrom
the-real-antares:fix-range-indicator-during-placement
Open

Run cursor action pre-draw logic before capturing the object under th…#324
NayiemW wants to merge 1 commit into
CnCNet:masterfrom
the-real-antares:fix-range-indicator-during-placement

Conversation

@NayiemW

@NayiemW NayiemW commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Since the MapUI / MapView split, TechnoUnderCursor has been passed into MapView.Draw before the active cursor action’s PreMapDraw logic runs.

This breaks placement range indicators because building placement previews assign TechnoUnderCursor inside PreMapDraw. Since the renderer receives the previous value, it does not see the newly assigned object during that frame. The property is then reset during the next update cycle, so range indicators never appear while placing buildings such as pillboxes.

Previously, the relevant order was effectively:

PreMapDraw
→ read TechnoUnderCursor
→ draw map and range indicators
→ PostMapDraw

After the split, it became:

read and pass TechnoUnderCursor
→ PreMapDraw
→ draw map
→ PostMapDraw

This change moves the PreMapDraw invocation into MapUI.Draw, before TechnoUnderCursor is passed to the renderer. MapView.Draw no longer invokes it a second time.

The corrected order is therefore:

PreMapDraw
→ pass the updated TechnoUnderCursor to MapView
→ draw map and range indicators
→ PostMapDraw

PostMapDraw remains in its existing location, so the intended call order around map rendering is preserved while ensuring placement previews can display their range indicators.

…e cursor

Since the MapUI/MapView split, the object under the cursor has been passed to the renderer by value before the active cursor action's PreMapDraw ran, but placement previews assign the object-under-cursor property inside PreMapDraw. The property was then reset on the next update, so range indicators never showed while placing buildings such as pillboxes. Invoke PreMapDraw before passing the object to the renderer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant