Downgrade NumCellsInRadius overflow from Log.Error to Log.Warning#4645
Open
WhiteGiverMa wants to merge 1 commit into
Open
Downgrade NumCellsInRadius overflow from Log.Error to Log.Warning#4645WhiteGiverMa wants to merge 1 commit into
WhiteGiverMa wants to merge 1 commit into
Conversation
The 'Not enough squares' error triggers when another mod calls GenRadial.RadialCellsAround with a radius larger than CE's MAX_RADIUS (119). This is a benign compatibility issue — the result is capped to the max array size and the game continues normally. Logging it as Error causes unnecessary user alarm and log spam. Changed to Warning with a clearer message that explains the cap behavior rather than sounding like a fatal failure.
|
You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-28586083722.zip |
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.
Changes
Harmony_GenRadial.LogNotEnoughSquaresError(): DowngradeLog.Error→Log.WarningReasoning
GenRadial.MaxRadialPatternRadiusis a compile-time const in vanilla RimWorld (~200). Third-party mods compiled against vanilla have this value baked into their IL, and CE cannot override it at runtime. When such a mod (e.g. WVC Work Modes) callsNumCellsInRadiuswith a radius exceeding CE's cap of 119, the prefix correctly caps the result — the game does not crash. ButLog.Errorcauses unnecessary red error spam that alarms users.Log.Warningbetter communicates that this is a compatibility note, not a failure. The updated message also accurately describes the cap behavior instead of sounding like a crash.The performance-conscious design (separate method to avoid string formatting cost in hot path) is preserved unchanged.
Alternatives
Log.Error— causes user-facing red error for a non-fatal compatibility edge caseTesting
Check tests you have performed: