Skip to content

fix(config): increase shortname (32) and point_template (64) buffers - #99

Closed
Rushaway wants to merge 5 commits into
darkerz7:masterfrom
srcdslab:fix/increase-shortname-template-buffers
Closed

Rushaway wants to merge 5 commits into
darkerz7:masterfrom
srcdslab:fix/increase-shortname-template-buffers

Conversation

@Rushaway

@Rushaway Rushaway commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Suggested / co-authored by notkoen.

Problem

LoadConfig() reads every KeyValues string through one shared buffer:

char sBuffer_path[...], sBuffer_path_override[...], sBuffer_temp[32];

pt_spawner is copied into class_ItemConfig.Spawner[64], but it is read
through that 32-byte buffer first, so any point_template name longer than
31 characters is silently truncated. EWM_Spawn_Spawn() then compares the
truncated name against m_iName of the map's point_template entities,
never finds a match, and sm_espawnitem fails for those items.

Change

  • New buffer-size defines in entwatch/function.inc:
    • EW_MAX_SHORTNAME_LENGTH = 32
    • EW_MAX_TEMPLATE_LENGTH = 64
  • sBuffer_temp is sized to the largest string field it has to hold
    (EW_MAX_TEMPLATE_LENGTH), so pt_spawner is no longer cut short and
    shortname gets its full 32 characters.
  • The defines are used at the places that share these limits, so they stay
    in sync: class_ItemConfig.ShortName / .Spawner,
    class_ItemList.ShortName, sm_ewsetshortname's sNewName, and
    sPTName in the point_template lookup.

No config format change and no behaviour change for names that already fit.

🤖 Generated with Claude Code

Rushaway and others added 5 commits August 27, 2026 15:29
Co-authored-by: Rushaway <176180971+Rushaway@users.noreply.github.com>
The KeyValues parse buffer in LoadConfig was a single sBuffer_temp[32]
shared by every string field, so "pt_spawner" was cut to 31 characters
before being copied into Spawner[64] and item spawning then failed to
match the point_template in the map.

Size the parse buffer to the largest string field and introduce
EW_MAX_SHORTNAME_LENGTH (32) / EW_MAX_TEMPLATE_LENGTH (64) so the
shortname and point_template limits are declared in one place and used
by the item structs, the parse buffer, sm_ewsetshortname and the
point_template lookup.

Suggested-by: notkoen
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Rushaway

Rushaway commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Opened against the wrong repository, reopening on srcdslab/sm-plugin-EntWatch.

@Rushaway Rushaway closed this Sep 5, 2026
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