Skip to content

perf: lowercase trigger commands at load time, replace strn_cmp with …#3004

Open
bylins wants to merge 2 commits intomasterfrom
issue.2821
Open

perf: lowercase trigger commands at load time, replace strn_cmp with …#3004
bylins wants to merge 2 commits intomasterfrom
issue.2821

Conversation

@bylins
Copy link
Owner

@bylins bylins commented Mar 21, 2026

…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.

bylins and others added 2 commits March 21, 2026 07:50
…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>
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.

1 participant