Skip to content

Radius overlay#1946

Draft
morganchristiansson wants to merge 9 commits into
Return-To-The-Roots:masterfrom
morganchristiansson:radius-overlay
Draft

Radius overlay#1946
morganchristiansson wants to merge 9 commits into
Return-To-The-Roots:masterfrom
morganchristiansson:radius-overlay

Conversation

@morganchristiansson

@morganchristiansson morganchristiansson commented Jun 15, 2026

Copy link
Copy Markdown

Add tooltip and overlay for building ranges

image image image image

@Flamefire Flamefire left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good idea, makes it a bit S4-like.

@Spikeone Should this be an addon too?

Comment thread libs/s25main/gameData/BuildingConsts.h Outdated
Comment thread libs/s25main/gameData/BuildingConsts.h Outdated
Comment thread libs/s25main/ingameWindows/iwAction.h Outdated
Comment thread libs/s25main/world/GameWorldView.cpp Outdated
Comment thread libs/s25main/world/GameWorldView.cpp Outdated
Comment thread libs/s25main/world/GameWorldView.cpp Outdated
Comment on lines +768 to +780
// Draw at all 9 toroidal copies (canonical ± 1 map dimension).
// Using all copies guarantees the ring is continuous across the seam
// regardless of viewport position — the renderer clips off-screen pixels.
for(int dw : {-w, 0, w})
{
for(int dh : {-h, 0, h})
{
const MapPoint copyPt = MakeMapPoint(Position(basePt.x + dw, basePt.y + dh), mapSize);
const auto alt = world.GetNode(copyPt).altitude;
const DrawPoint scr = GetNodePos(copyPt) - DrawPoint(0, HEIGHT_FACTOR * alt) - offset;
Window::DrawRectangle(Rect(scr - DrawPoint(2, 2), Extent(5, 5)), BORDER_COLOR);
}
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Noone commented on this yet.
The drawn radius was being clipped where map repeats and this is a workaround. Did not find any cleaner way advise appreciated.

Image

@@ -132,16 +132,14 @@ void nofHunter::HandleDerivedEvent(unsigned /*id*/)
void nofHunter::TryStartHunting()
{
// Find animals in a square around building (actually should be circle, but animals are moving anyway)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Uhm hunters look for animals in a SQUARE?

Should fix to be circle? Kinda out of scope but can include or do separate PR. Cause right now the range outline doesn't match what game uses.

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.

2 participants