View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000417 | LDMud 3.3 | Efuns | public | 2005-11-25 09:09 | 2018-01-29 21:57 |
Reporter | Sorcerer | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 3.3 | ||||
Fixed in Version | 3.3.713 | ||||
Summary | 0000417: present() does not return all items | ||||
Description | This refers to ldmud 3.4.0. When calling present(<name>,<number>) not all items are returned properly. Example: If you have 2 items called "strauss" in the environment() and one more in the inventory of the object using present(), <number>=1 will find the one in the inventory, <number>=2 will find the _second_ one in the environment, but the first one in the environment will never be found. (<number>=3 will return 0). To me it seems, present() first looks up all items in the inventory but then does not reset it's internal counter and continues to look at environment(). The following code shows this behaviour: int present_test() { write("present(\"strauss\",<n>) :\n"); write(sprintf("1: %O\n",present("strauss",1))); write(sprintf("2: %O\n",present("strauss",2))); write(sprintf("3: %O\n",present("strauss",3))); write("present(\"strauss\",<n>,environment()) :\n"); write(sprintf("1: %O\n",present("strauss",1,environment()))); write(sprintf("2: %O\n",present("strauss",2,environment()))); write(sprintf("3: %O\n",present("strauss",3,environment()))); write("present(\"strauss\",<n>,this_object()) :\n"); write(sprintf("1: %O\n",present("strauss",1,this_object()))); write(sprintf("2: %O\n",present("strauss",2,this_object()))); write(sprintf("3: %O\n",present("strauss",3,this_object()))); return 1; } Output for 2 "strauss" in the inventory and 1 in the environment: present("strauss",<n>) : 1: /wizards/sorcerer/item/blumenstrauss#1394 2: /wizards/sorcerer/item/blumenstrauss#1397 3: 0 present("strauss",<n>,environment()) : 1: /wizards/sorcerer/item/blumenstrauss#1395 2: 0 3: 0 present("strauss",<n>,this_object()) : 1: /wizards/sorcerer/item/blumenstrauss#1394 2: /wizards/sorcerer/item/blumenstrauss#1397 3: 0 This time the one in the environment is not found at all since the counter is already at 2 after the inventory. | ||||
Tags | No tags attached. | ||||
|
This is tricky, as present() is actually working as designed - it is just that item 0000001 in the environment is hidden by item 0000001 in the object itself. Let me think about that. |
|
note: In the unilib family the parser (parse_com) implemented inside the lib gives precedence to objects in the environment before objects inside the second specific object in search space (which will usually be this_player). This is usefull, since a player can specify himself as only search space by using the keyword "my" ("mein" in German). So, allthough we rarily use the second argument for present() to select objects in the mudlib, a consistant approach would be elegant, and I dont think this will have any regressions. |
|
I have implemented this now - let's see how many Muds break now :-) |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-11-25 09:09 | Sorcerer | New Issue | |
2005-11-25 13:06 |
|
Note Added: 0000424 | |
2005-11-26 11:31 | _xtian_ | Note Added: 0000425 | |
2005-11-27 14:39 |
|
Status | new => resolved |
2005-11-27 14:39 |
|
Fixed in Version | => 3.3.713 |
2005-11-27 14:39 |
|
Resolution | open => fixed |
2005-11-27 14:39 |
|
Assigned To | => lars |
2005-11-27 14:39 |
|
Note Added: 0000427 | |
2006-02-28 20:04 |
|
Status | resolved => closed |
2010-11-16 09:42 |
|
Source_changeset_attached | => ldmud.git master dbef0cd1 |
2018-01-29 18:59 |
|
Source_changeset_attached | => ldmud.git master dbef0cd1 |
2018-01-29 21:57 |
|
Source_changeset_attached | => ldmud.git master dbef0cd1 |