Skip to content

bugfix(worldbuilder): Add carriage return to delimiter array in loadCommandButtons tokenization#2300

Open
ViTeXFTW wants to merge 1 commit intoTheSuperHackers:mainfrom
ViTeXFTW:fix/wb-false-cb-script-error
Open

bugfix(worldbuilder): Add carriage return to delimiter array in loadCommandButtons tokenization#2300
ViTeXFTW wants to merge 1 commit intoTheSuperHackers:mainfrom
ViTeXFTW:fix/wb-false-cb-script-error

Conversation

@ViTeXFTW
Copy link

@ViTeXFTW ViTeXFTW commented Feb 13, 2026

Description
This PR fixes an issue in WorldBuilder where CommandButton validation incorrectly reports "Command button does not exist" errors when using the Add a CommandButton to an object type. The issue occurs when CommandButton names are loaded from INI files - the names contain trailing carriage return characters from Windows line endings, causing string comparisons to fail even though the buttons exist and display correctly in the UI.

This means for mappers they get a visual indication that their script has an error when the CommandButton name is correct and a false positive when the CommandButton name still has the trailing carriage return.

Root Cause
The strtok delimiter array in loadCommandButtons() only included " ,\t\n"

Fix in EditParameter.cpp. In loadCommandButtons(): added \r to the delimiter.

Old:
image

New:
image

@greptile-apps
Copy link

greptile-apps bot commented Feb 13, 2026

Greptile Overview

Greptile Summary

Fixed a WorldBuilder validation bug where CommandButton names loaded from INI files with Windows line endings (CRLF) contained trailing carriage return characters, causing false "Command button does not exist" errors during validation.

  • Added \r to the strtok delimiter array in loadCommandButtons() to properly strip carriage returns from parsed tokens
  • The fix ensures string comparisons work correctly regardless of line ending format (LF or CRLF)
  • This is a minimal, targeted fix that resolves the validation false positives without affecting functionality

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a single-character addition to a delimiter string, addressing a well-documented line ending issue. The fix is minimal, correct, and follows standard practice for handling Windows CRLF line endings in C string tokenization. No logical or structural changes were made.
  • No files require special attention

Important Files Changed

Filename Overview
GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp Added \r to strtok delimiter to handle Windows line endings (CRLF) when parsing CommandButton.ini

Last reviewed commit: fdbdad3

in loadCommandButton seperator

Co-authored-by: AdrianeYves
@ViTeXFTW ViTeXFTW force-pushed the fix/wb-false-cb-script-error branch from 03d1d5b to fdbdad3 Compare February 13, 2026 15:00
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.

Worldbuilder: adding/removing command buttons have an invisible character, causing the script to appear with an error

1 participant