Repository navigation
Handle all out-of-range radarcol indexes in RadarMap - #88
Merged
Merged
Conversation
Look up every radar color through one GetColor helper, which logs and falls back to the 0x4000 color, or to 0 when radarcol has no static entries at all. This covers: - Land tile ids past the end of radarcol, which were not checked at startup and threw. - radarcol files with 0x4000 entries or fewer, where the 0x4000 fallback was itself out of range. - Static ids of 0xC000 and above in UpdateRadar: `(ushort)(Id + 0x4000)` wrapped them onto land colors, so the radar showed a different color after an edit than at startup. The radar index is now an int. Co-Authored-By: Claude Opus 5.5 <[email protected]>
DavideRei
force-pushed
the
fix-radarmap-edge-cases
branch
from
November 23, 2026 08:38
f67d336 to
654d4e8
Compare
kaczy93
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Three more ways for
RadarMapto read past radarcol or pick the wrong color:_radarColors[landTile.Id]with no check, so a land id past the end of radarcol throws at startup.0x4000is itself out of range when radarcol has 0x4000 entries or fewer, so the fallback throws too.UpdateRadarcomputes(ushort)(topStaticTile.Id + 0x4000). Static ids of 0xC000 and above wrap onto land colors, so after an edit the radar shows a land color, while at startup the same tile gets its own color (or the fallback).Fix
GetColor(int radarId, x, y)helper used by the constructor andUpdate: out-of-range indexes are logged and get the0x4000color, or 0 if radarcol has no static colors.intfromUpdateRadartoRadarMap.Update, so it no longer wraps.The startup log line now gives the radarcol index (
No radar color for index 0x8000 at block 0,0) instead of "Invalid static tile", because a bad land id can also land there.Testing
ServerLandscape, thenUpdateRadar, compared before and after: land id past the end, radarcol of 0x3000 and 0x4000 entries, static 0xC000/0xFFFF with radarcol of 0x8000, 0x10000 and 0x14000 entries. No exceptions, startup and update now agree, valid ids keep their color.Shared.TestsandCentrED.Testspass.🤖 Generated with Claude Code