Repository navigation
Conversation
|
This would be good to implement in other places, where |
|
And what will happen, if I try to search for resource different from item? Like |
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 lists that only take items do the same: CONSUME, CONTCONSUME, RESOURCES of ITEMDEF/CHARDEF and of SPELL. The lists that mix different types (SKILLMAKE, SKILLTEST, DESIRES, AVERSIONS, RANDGROUP) keep refusing a bare ID. Fixes Sphereserver#1430 Co-Authored-By: Claude Opus 5.5 <[email protected]>
7944ef8 to
bc933c6
Compare
|
About About the other places: all of them refused a bare number with that same error, because a number has no resource type.
I added a test script to the description ( |
Description
Fixes #1430.
RESTESTloaded its resource list withRES_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, whileRESCOUNTreads a number as an item ID (ResourceGetID(RES_ITEMDEF, ...)).CResourceQty::LoadandCResourceQtyArray::Loadtake an optional default type for bare IDs (defaultRES_UNKNOWN, the current behaviour).RESTESTpassesRES_ITEMDEF, likeRESCOUNT. The other lists that only take items do the same:CONSUME(chars),CONTCONSUME(containers),RESOURCESof ITEMDEF/CHARDEF andRESOURCESof SPELL (reagents). The lists that mix different types (SKILLMAKE, SKILLTEST, DESIRES, AVERSIONS, RANDGROUP RESOURCES) are unchanged: there a bare ID is still refused, since it could be a skill, a char or an item. 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
Related Issues
Fixes #1430
Testing
pr_test_1653.scp), run with and without this PR on a test shard: 7 PASS with the PR; on current dev the 4[BUG]tests FAIL (with "Bad resource list id") and the 3[SANITY]ones pass, including RESTEST with a typedef.CResourceQtyArray::Loadas the ITEMDEF one.Checklist
Additional Notes
Test script, in the same format as the
pr_test.scpof #1627: run.pt_run_allas a GM, anywhere. It puts a saw (01034) in the backpack and removes it at the end; its ITEMDEF gives RESOURCES by number, so on dev it logs "Bad resource list id" when the scripts are loaded.pr_test_1653.scp
🤖 Generated with Claude Code