Skip to content

RESTEST: a bare ID is an item, like in RESCOUNT - #1653

Open
DavideRei wants to merge 1 commit into
Sphereserver:devfrom
DavideRei:fix/restest-bare-item-id
Open

DavideRei wants to merge 1 commit into
Sphereserver:devfrom
DavideRei:fix/restest-bare-item-id

Conversation

@DavideRei

Copy link
Copy Markdown
Contributor

Description

Fixes #1430. RESTEST loaded its resource list with RES_UNKNOWN, so an item given by number (RESTEST 1 01034, or a def holding a hex ID) failed with "Bad resource list id" and returned 0, while RESCOUNT reads a number as an item ID (ResourceGetID(RES_ITEMDEF, ...)).

CResourceQty::Load and CResourceQtyArray::Load take an optional default type for bare IDs (default RES_UNKNOWN, the current behaviour). RESTEST passes RES_ITEMDEF, like RESCOUNT; the other resource lists (RESOURCES, SKILLMAKE, ...) are unchanged. A defname still carries its own type (skills, typedefs, etc.), and a bare ID of 0 is still refused with the same error.

Note: with two numbers the first one is the quantity ("qty id"), as before.


Type of Change

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation update
  • Build / CI change
  • Other (please describe):

Related Issues

Fixes #1430


Testing

  • Compiled with MSVC 2022 (Windows x64, Release) on top of the current dev.
  • Tested on our shard (a private fork kept aligned with dev) with the script of the issue: rescount 01034 = 1, restest 1 01034 = 1 (was 0 with the error), restest 1 i_saw = 1, restest i_saw 1 = 1.

Checklist

  • Code compiles successfully
  • Changes follow the project's coding style
  • No unrelated code was modified
  • Documentation updated where necessary (Changelog.txt)
  • This PR does not introduce breaking changes (or they are documented)

Additional Notes

None.

🤖 Generated with Claude Code

RESTEST loaded its list with RES_UNKNOWN, so an item given by number
(01034, or a def holding a hex ID) failed with 'Bad resource list id'
and returned 0, while RESCOUNT reads it as an item. CResourceQtyArray::Load
takes the type to give to bare IDs; RESTEST passes RES_ITEMDEF, the other
resource lists keep the old behaviour.

Fixes Sphereserver#1430

Co-Authored-By: Claude Opus 5.5 <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