Skip to content

[Necrosource AI] Mini-map doesn't show when map size is over 682 walkable hexes#1358

Open
necrosource-bot[bot] wants to merge 1 commit into
masterfrom
necro/fix-issue-11061
Open

[Necrosource AI] Mini-map doesn't show when map size is over 682 walkable hexes#1358
necrosource-bot[bot] wants to merge 1 commit into
masterfrom
necro/fix-issue-11061

Conversation

@necrosource-bot
Copy link
Copy Markdown

Automated Fix

Issue: Mini-map doesn't show when map size is over 682 walkable hexes

QA Review

APPROVE: The fix correctly addresses the root cause — the hardcoded scale = 24 caused intermediate texture dimensions to exceed SDL's 16384px GPU limit for maps ≥ 683 hexes.

Math verification:

  • Width: map.w() * scale * 3/4 ≤ max_wscale ≤ max_w * 4 / (map.w() * 3)
  • Height: map.h() * scale ≤ max_hscale ≤ max_h / map.h()
  • Both use integer division which floors (conservative/safe) ✓

Edge cases handled:

  • map.w() > 0 && map.h() > 0 guard prevents division by zero ✓
  • Null renderer guard ✓
  • SDL_GetRendererInfo return value checked and max_texture_width/height > 0 validated ✓
  • std::max(1, ...) prevents zero-size texture ✓
  • Doesn't hardcode 16384 — queries actual GPU limit ✓
  • Falls through gracefully if renderer info unavailable (scale unchanged) ✓

No regressions expected:

  • The clamped scale is the same local variable used downstream, so all dimension calculations in the function automatically use the reduced value
  • The tactical minimap (scale=4) already worked; this fix applies the same logic consistently, though clamping only triggers for extreme map sizes in that mode
  • Output minimap widget dimensions are unaffected (correct per design)

Minor concern (non-blocking): std::min({...}) with an initializer list requires <algorithm>, but this is almost certainly already included in a rendering-heavy file like minimap.cpp.


This PR was generated by the Necrosource AI agent team.

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.

0 participants