perf: lowercase trigger commands at load time, replace strn_cmp with …#3004
Open
perf: lowercase trigger commands at load time, replace strn_cmp with …#3004
Conversation
…strncmp (#2821) Lowercase the first word (command keyword) of each trigger script line when loading from files and OLC. This allows using standard strncmp (case-sensitive) instead of custom strn_cmp (case-insensitive with per-character LOWER()) in the command dispatch loop. Changes: - world_data_source_base.cpp: lowercase first word in ParseTriggerScript - boot_data_files.cpp: same for legacy text format loader - dg_olc.cpp: same for OLC trigger editor save - dg_scripts.cpp: strn_cmp -> strncmp in find_end, find_else_end, find_continue_done, find_done, find_case, exec_script dispatch Only command keywords (first word) are lowercased. Variable values, field names, and player input comparisons remain case-insensitive. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace hand-written ASCII-only lowercase (c >= 'A' && c <= 'Z') with LOWER() macro which uses a_lcc_table and properly handles KOI8-R encoding. DG commands can come through console in KOI8-R. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
…strncmp (#2821)
Lowercase the first word (command keyword) of each trigger script line when loading from files and OLC. This allows using standard strncmp (case-sensitive) instead of custom strn_cmp (case-insensitive with per-character LOWER()) in the command dispatch loop.
Changes:
Only command keywords (first word) are lowercased. Variable values, field names, and player input comparisons remain case-insensitive.