![]() |
#1 |
Veteran
Join Date: Apr 2009
Location: Pisa / DL0
Posts: 1,027
![]() |
bug: objects don't stack
I'm experiencing an odd bug in the development versions - after updating to the last one, objects I find do not stack anymore with those I had before the switch. I'm now carrying two separate packs of CLW and CSW, for instance. Could it be due to the recent changes in object descriptions?
|
![]() |
![]() |
![]() |
#2 | |
Angband Devteam member
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 43
Posts: 1,517
![]() |
Quote:
We've seen these kinds of bugs with old savefiles while developing. I would recommend that people finish their games before trying the newest nightly, although (hopefully) other than minor stacking bugs like this they should be compatible. Thanks for reporting this! Feel free to open a bug, but if this only happens with an old savefile then I expect it will be lower priority than more serious bugs. |
|
![]() |
![]() |
![]() |
#3 | |
Prophet
Join Date: Mar 2008
Posts: 2,771
![]() |
Quote:
[edit] Never mind. The screen dump in the other thread shows restore life not stacking, and that hasn't changed to my knowledge. |
|
![]() |
![]() |
![]() |
#4 |
Veteran
Join Date: Apr 2009
Location: Pisa / DL0
Posts: 1,027
![]() |
|
![]() |
![]() |
![]() |
#5 |
Swordsman
Join Date: Jan 2011
Location: Sarf Laaaahdon
Posts: 323
![]() |
It seems the problem effects *everything*.
Does anyone want to buy c.200 assorted Magic Books, seven Mushrooms of Vigor, twenty or so miscellaneous potions of a healing-related nature, and a dozen Banishments, Mass Banishments, and Destructions? *** Quick aside: 'Vigor' is inconsistent with the English English used elsewhere. Last edited by scud; May 6, 2011 at 07:27. |
![]() |
![]() |
![]() |
#6 | |
Angband Devteam member
|
Quote:
|
|
![]() |
![]() |
![]() |
#7 | |
Prophet
Join Date: Mar 2008
Posts: 2,771
![]() |
Quote:
The real problem is direct access of o_ptr->flags. Everything should go through object_flags(.,.) instead. It is bad style to copy flags from kind to object. If you folks are insistent on doing that, expect a bunch of problems both now while you work out the details and later when you're not expecting it. I suggest you apply the attached patch at least for now. I didn't test it much, but IMO it is the right solution and any problems it causes I'd call preexisting bugs. |
|
![]() |
![]() |
![]() |
#8 |
Prophet
Join Date: Mar 2008
Posts: 2,771
![]() |
I just checked the old code, and it appears that object_flags used to have the stuff I put in and it was purposely removed. That makes my suggested fix pretty pointless.
|
![]() |
![]() |
![]() |
#9 |
Angband Devteam member
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 43
Posts: 1,517
![]() |
This isn't an area of the code I have spent a lot of time in so far.
Can you explain your reasoning? I get that you think that o_ptr->flags shouldn't be used directly because you don't want it to contain kind->flags and kind->base->flags. What's the reason for that? Like I said, I haven't messed around much with ID/item generation/etc so I don't have a lot of intuition here. One nice thing I can see about making o_ptr->flags authoritative is that you can reduce the number of lines of code you need to write to look at object flags. That said, I am in favor of adding lots of helper methods like "obj_grants_telepathy" anyway, so maybe it's not such a big deal for me. For instance, p_ptr->state functions this way now--it is authoritative for the player and whenever items are removed/worn or status effects start/end it is recalculated. Instead of creating player_state every time we need it, we can just use p_ptr->state. |
![]() |
![]() |
![]() |
#10 |
Prophet
Join Date: Mar 2008
Posts: 2,771
![]() |
Hierarchies should be hierarchies. If you copy something from one level to another, you are just messing things up.
Imagine a new spell that changes a potion into a staff. If you implement hierarchically, such a thing is as simple as changing the object kind and setting the number of charges. If you throw away the hierarchy, then you can't do it without a lot of work. That's not to say anyone would ever do this. This is just an example of the power of the approach. Magnate's current attempt at a fix in rd_item_2 will only work if you only add flags. If at some point a flag is subtracted from an object kind or base, things will stop stacking again. Data structures change. If you access everything through functions, then changing a data structure can be restricted to a single file that is responsible for the access functions to the data structure. If you allow direct access, upgrading a data structure is a mess requiring you to look at the entire project. You could imagine implementing a flag that is only active during nighttime. Or a curse that negates a random flag for a while. If everyone calls object_flags, you just add the code there to check the gameturn. That's much cleaner than removing and replacing flags on the item. If you allow direct access, you have to propagate the special casing throughout the code, and bugs will crop up if someone misses something. |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
3.2.0: unidentified items stack? | Chud | Vanilla | 3 | March 11, 2011 11:21 |
bug: no extra gold if you don't spend stat points | fph | Vanilla | 2 | January 9, 2011 14:29 |
Bug (possible) with rating for OOD objects in r2038 | Twilight | Development | 2 | August 12, 2010 14:00 |
Stack items when dropping | Derakon | Vanilla | 10 | July 22, 2010 19:56 |
[Feature Request]: 'g' gets top item from stack | awldune | Vanilla | 0 | December 14, 2007 21:31 |