Unbind sequential properties and script text limits - #359
Merged
Conversation
Replace whole-line `ArgList` collection for multi-value properties with sequential argument reading. * Read each argument directly from the source line into a reusable 64-byte buffer. * Remove aggregate `MAX_ARG_LEN` and `MAX_ARG_COUNT` limits from open-ended property lists. * Preserve quoting, comments, and the existing 63-character per-item limit. * Count weapon arguments before allocating the persistent weapon list exactly once. * Apply complete `allowselect` lists at runtime while retaining only whole entries that fit its legacy save field. * Keep the legacy 512-byte limit unchanged for general parsing, paths, save fields, and script file-stream arguments.
Store complete allowselect command lines in dynamically sized runtime and per-difficulty save state. Append length-prefixed allowselect data after the legacy fixed save records so current builds can round-trip lists of any practical size. Preserve a whole-argument compatibility mirror for older saves and older engine builds. Load the legacy fixed field when no dynamic extension is present, validate extension lengths against the remaining file, and release all owned state during save resets, level-order resizing, and shutdown.
Delete the fixed 1,024-byte compatibility mirror and fallback path. Require dynamic allowselect save data and advance the saved-game compatibility version so older record layouts are rejected.
Remove the fixed 512-byte findarg buffer and read requested file-stream arguments through the shared sequential token reader. Allocate script storage for only the requested argument, preserve missing-value conversions, and move model frame lookahead onto the same token reader.
Consume @cmd function names and parameters directly from the original command line one item at a time. This removes ParseArgs' whole-line and argument-count ceilings from generated script calls. Restore the dedicated per-command-argument buffer to 512 bytes for paths and other bounded values, and append function names directly to the dynamic script buffer.
Represent script string literals as non-owning pointer-and-length views through preprocessing and lexing, then materialize complete decoded values directly in StrCache when CONSTSTR instructions are emitted. Keep fixed token storage for identifiers and diagnostics only. Pass @cmd source tokens directly into its dynamic generated-script buffer so long quoted arguments do not pass through the 512-byte command scratch buffer. Preserve length-aware macro handling, escape behavior, switch-case lifetimes, and legacy unary-not string behavior.
Replace capacityless ScriptVariant_ToString() calls with explicit-capacity conversion or direct string views. Bound script string inputs and concatenation at 65,535 characters through MAX_SCRIPT_STRING_LENGTH, expose the limit to script, and reject oversized literals during compilation.
Treat matching single and double quotes as grouping syntax when parsing sequential command and file-stream arguments. * Remove opening and closing quote delimiters from decoded output. * Allow double-quoted spans to appear within arguments and concatenate with adjacent unquoted text. * Recognize single-quoted spans only at argument boundaries, preserving apostrophes in ordinary words. * Preserve the opposite quote type as literal content within a quoted span. * Allow quoted file-stream arguments to contain whitespace, comment markers, and newlines. * Support empty quoted arguments. * Track source and decoded lengths separately to avoid unnecessary temporary allocations. * Decode file-stream arguments directly into exact-sized script string storage. * Apply the 65,535-character policy to decoded content. * Reject unterminated quotes and insufficient destination capacity cleanly. File streams can now return complete sentences and multi-line paragraphs as individual arguments without retaining their grouping delimiters.
Prevent `nocmdcompatible` optimization from corrupting generated animation scripts when same-frame `@cmd` calls are separated by other script content. * Track whether the preceding generated section is eligible for `@cmd` merging. * Invalidate merge eligibility after inline scripts, animation changes, and frame changes. * Verify the exact generated `return;` and frame-closing suffix before removing either. * Remove the complete suffix atomically only after successful validation. * Open a fresh frame condition when the preceding output is not safely mergeable. * Preserve normal merging of adjacent same-frame `@cmd` calls. This prevents intervening `@script` content or unexpected generated output from being truncated while retaining the existing compatibility optimization.
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.
Summary
Remove legacy whole-line limits from sequential properties, file-stream arguments, and generated
@cmdcalls. Strengthen script-string handling throughout preprocessing, compilation, conversion, and text rendering.Changes
ArgListstorage.allowselectvalues dynamically in runtime and save state.allowselectsave field and advance save compatibility for the new record layout.@cmdfunction names and arguments directly from the source line.nocmdcompatiblemerging for adjacent same-frame@cmdcalls.Compatibility
General command parsing, paths, save fields, and other intentionally bounded values retain their existing limits.
The saved-game compatibility version is advanced because the obsolete fixed
allowselectrecord was removed. Saves using older record layouts are rejected rather than interpreted incorrectly.Validation
@cmd, quoting, compatibility-merging, frame-transition, and high-argument-count tests.git diff --check.