Viewing Issue Simple Details Jump to Notes ] Wiki ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006235 [DCSS] Bug Report minor have not tried 2012-09-17 07:26 2013-02-11 01:45
Reporter Stelpa View Status public  
Assigned To neil
Priority normal Resolution done  
Status resolved   Product Branch 0.11 ancient branch
Summary 0006235: !bad item on weapon adjust
Description I picked up a short sword and attempted to adjust it (=) to slot b, and it would not switch, instead saying the name of some darts I was wielding. After trying it several times, the message log said: _a !bad item (cl:100,ty:0,pl:0,pl2:0,sp:0,qu:0)

I was told to report this here. I was playing on CSZO. My username is Stelpa. I am not sure how to get the save, but I will request it from an admit if it's needed.
Additional Information
Tags No tags attached.
Attached Files ? file icon 6235_patch_1.diff [^] (1,320 bytes) 2013-02-10 07:02 [Show Content]

- Relationships

-  Notes
(0020184)
Stelpa (reporter)
2012-09-17 07:31

Made a link to the save using the Advanced Options menu in CSZO. Here it is: http://dobrazupa.org/saves/Stelpa-crawl-0.11-120917-0526.tar.bz2 [^]
(0020558)
blackcustard (reporter)
2012-11-24 19:07

I just experienced the same bug while trying to adjust my staff of cold from P to y.

-I killed a dragon, cut it up, and ate + sublimated some of its chunks.
-Then I tried to swap back to my staff of cold, but it took at couple tries because I discovered it was in slot P instead of slot y.
-First I started typing "#adjust" like in Nethack. This resulting in a character dump and "Sorry, you're not good enough to have a special ability." message.
-Then I tried to inscribe my staff so it would auto-adjust, but I forgot what inscription is used to fix items to a particular inventory slot (I tried "=a").
-Then I cleared the inscription.
-Then I tried several times to adjust manually. Sometimes Crawl gave a message like the one Stelpa reported, sometimes Crawl adjusted another item instead.
-I tried to adjust to a different slot, and I tried to adjust a different item. Only the staff of cold failed to adjust, and adjusting to different slots made no difference.
-Reasoning that there might be a bad handle somewhere, I dropped the staff of cold and picked it up again. After that I could adjust it like normal.

Annotated message log:
*** I stop to restore some mana.
 The chunk of flesh you are holding crumbles to dust.
_A flood of magical energy pours into your mind!
*** I try to swap back to my staff, but find that it wasn't on y like I'm used to.
 You don't have any such object.
*** This is a typo. I meant to do "wP". I did "wwP" instead or something.
_w - a wand of disintegration {zapped: 5} (in hand)
*** I succeed in wielding my staff.
_P - an uncursed staff of cold (weapon)
*** I start trying to adjust the staff from P to y.
 Char dumped successfully.
 Sorry, you're not good enough to have a special ability.
*** Here I inscribe the staff and then clear the inscription.
*** First attempt to adjust staff of cold to y. A potion of speed ends up in y instead.
 y - a potion of speed
*** Second attempt. The potion goes to p and nothing ends up in y.
 y - a !bad item (cl:100,ty:7,pl:0,pl2:0,sp:19,qu:0)
 p - a potion of speed
*** Third attempt. The potion goes back to y.
 y - a potion of speed
*** Fourth attempt. I adjust to Y this time. Y ends up empty and my armour goes to p.
 Y - a !bad item (cl:100,ty:7,pl:0,pl2:0,sp:19,qu:0)
 p - a +2 mottled dragon armour (worn)
*** WTF? Does this happen if I adjust something else?
 t - a ring of magical power (right hand)
*** That worked fine, let's trying adjusting the ring to y.
 y - a ring of magical power (right hand)
 t - a potion of speed
*** That worked fine as well. What if I adjust the staff to a letter besides y? I try to adjust the staff to t.
 t - a +2 mottled dragon armour (worn); p - a potion of speed
*** That failed. Here I wield another item by mistake and have to swap back to the staff.
_E - an uncursed blowgun (weapon)
_P - an uncursed staff of cold (weapon)
*** Here I try to reset the staff by dropping it and picking it up again.
_You are now empty-handed. You drop an uncursed staff of cold.
_P - an uncursed staff of cold
*** Now it adjusts just fine.
 y - an uncursed staff of cold
 P - a ring of magical power (right hand)

Save:
http://crawl.develz.org/saves/dumps/blackcustard-9585b9a-121124-1739.tar.bz2 [^]

I tried and failed to duplicate the bug.
(0020561)
Runemage (reporter)
2012-11-25 23:27
edited on: 2012-11-25 23:28

This has happened to me when I have tried to adjust the letter of an item and the letter I'm adjusting to isn't in my inventory, but used to be. That may be a coincidence, though, because it has also happened when I do have the destination letter in my inventory.

I seem to remember it always happens when I drop stuff of at my stash so I think it has something to do with dropping the lettered item and picking up another item which gets that letter assigned to it.

I have gotten around this by adjusting the item that has the destination letter to the letter of the item I'm trying to adjust.

(0020979)
infiniplex (reporter)
2013-02-09 03:41

I just had the same problem. I was rearranging the order of my assorted thrown weapons and was trying to move item w (a dwarven hand axe) to spot d.

d - a fizzy green potion; f - a scroll labeled KHUTOS TAIKEIN
d - a scroll labeled KHUTOS TAIKEIN; f - a fizzy green potion

I then tried moving it to spot e (the item in d would not be thrown anyway).

e - a fizzy green potion; f - a potion of blood

I then tired moving the item (currently a potion of blood) to spot Y. That worked. However, when I tried moving the war axe to spot d, I got:

d - a potion of blood
Y - a potion of blood
d - a !bad item (cl:100,ty:2,pl:17,pl2:0,sp:92,qu:0)

I don't remember if I got the last line immediately, or if I had to try moving the axe again. Further tries always produce:

a !bad item (cl:100,ty:0,pl:0,pl2:0,sp:0,qu:0)

There is currently no item in position d.
(0020990)
blackcustard (reporter)
2013-02-10 04:04
edited on: 2013-02-10 04:23

I'm working on this bug, though it's quite difficult because I can't reproduce it. All I've got to go on is these reports, the code, and the TTYRECs.

The inventory letter is recorded in in three places: the slot and links members in each item item, and implicitly by the items position in you.inv. I think that some code is buggering the inventory array (you.inv).

I was able to perfectly recreate my exact experience (check the second post, where I pasted an annotated message log) using a simulated version of swap_inv_slots, but I needed to bugger the inventory array manually first (specifically by swapping the staff of cold and the potion of speed in the array without updating their slot and link members).

I think the slot swapping / adjust code is working just fine, it's some other part of the code that's broken. So it comes down to figuring out where in the codebase the array is getting buggered.

Will post more info and a patch eventually ... hopefully.

IF YOU FOUND THIS TICKET BECAUSE YOU EXPERIENCED THIS BUG:
PLEASE POST HERE! You don't have to say much. Just nickname+date+time+server+turncount, I'll find your ttyrec. If you play locally I would greatly appreciate it if you could copy and paste the last couple pages of your message log. More info would be awesome of course, but just that in particular would be quite useful.

UPDATE: And half an hour later I manage to recreate the bug. Now we're talking :).

(0020991)
blackcustard (reporter)
2013-02-10 07:00

Alright, I've got a patch.

To replicate:
Roll a character.
Drop everything.
Wizmode up an item.
Pick it up so it goes into slot a.
Drop it.
Wizmode up another item so it goes into slot a.
Pick up the first item so it goes into slot b.
Go into your inventory, select the first item (in slot b).
From within the item's description, hit = and c to try to adjust the item to c.
Watch as the SECOND item (in slot a) moves to c instead.

NOTE: DON'T JUST HIT "=" and then "i"!!! This bug ONLY manifests if you adjust an item from within its description!

This bug appears to have been introduced in commit 99b051c4 by jpeg back in 2007. Why did it take so long to patch?
1. It was a really obscure bug. You could only trigger it by dropping and picking up items in the right order and then adjusting them, and even then only if you adjusted through the less obvious of two menus.
2. The nature of the bug is such that a traceback won't help.
3. No one knew how to replicate it.

As with all the best bugs, it takes a solid day to puzzle it out, but the actual fix is a three line patch. :)

Long description:
When you pick up an item you dropped previously, Crawl tries to remember what slot it was in and put it back there again. If the old slot is filled up, the item is supposed to get a new slot. Unfortunately an item's slot is stored in three places, and Crawl was only updating two of the copies when you picked the item back up. Most of the time that's not a problem. However, the function responsible for swapping items, swap_inv_slots, inspects TWO of the three copies of the slot information, instead of just one, and so it happens that it trips over the inconsistency.

you.inv is perfectly fine. And you.inv[i].link is also just fine. It's you.inv[i].slot that's getting buggered. The problem was in move_item_to_player in items.cc.

The item swapping code in command.cc and describe.cc is perfectly fine.

The menu for "=i" swapping, without going into the inventory, where you have to specify BOTH slots, is handled by _adjust_item in command.cc.

The menu for "i<x>=" swapping, from within item <x>'s description, and where you only have to specify the destination slot, is handled by _adjust_item in describe.cc. (Same name, different functions.)

The actual swapping is performed by swap_inv_slots in command.cc in both cases.

The important difference here is that describe.cc's _adjust_item inspects the slot member of the specified item to determine the FROM slot. command.cc's _adjust_item gets the FROM slot direct from the player, and overwrites the old (potentially incorrect) slot. Both of them inspect the slot member of the item in the TO slot (if there is an item there).

As far as I can tell, the way command.cc did it covered up the error entirely.
(0020997)
neil (administrator)
2013-02-11 01:45

blackcustard's patch is in trunk (0.12-a0-2145-g49c2f50) and stable (0.11.2-4-g0170066).

- Issue History
Date Modified Username Field Change
2012-09-17 07:26 Stelpa New Issue
2012-09-17 07:31 Stelpa Note Added: 0020184
2012-11-24 19:07 blackcustard Note Added: 0020558
2012-11-25 23:27 Runemage Note Added: 0020561
2012-11-25 23:28 Runemage Note Edited: 0020561
2012-11-25 23:28 Runemage Note Edited: 0020561
2012-11-25 23:30 Runemage Status new => acknowledged
2012-11-25 23:30 Runemage Issue Monitored: Runemage
2013-02-09 03:41 infiniplex Note Added: 0020979
2013-02-10 04:04 blackcustard Note Added: 0020990
2013-02-10 04:10 blackcustard Issue Monitored: blackcustard
2013-02-10 04:23 blackcustard Note Edited: 0020990
2013-02-10 07:00 blackcustard Note Added: 0020991
2013-02-10 07:02 blackcustard File Added: 6235_patch_1.diff
2013-02-10 07:02 blackcustard Status acknowledged => feedback
2013-02-11 01:45 neil Note Added: 0020997
2013-02-11 01:45 neil Status feedback => resolved
2013-02-11 01:45 neil Fixed in Branch => 0.12 development branch
2013-02-11 01:45 neil Resolution open => done
2013-02-11 01:45 neil Assigned To => neil


Mantis 1.1.8[^]
Copyright © 2000 - 2009 Mantis Group
Powered by Mantis Bugtracker