On 08/30/10 01:12 PM, Nicolas Weeger wrote:
Hello.
On trunk there is a merging bug with items in eg a unique map.
How to reproduce:
- enter a unique map
- drop some item
- reset the map
- drop more of the same item
Dropped item won't merge with the one on the floor. But if you pick both
items,
they correctly merge.
Tracing the issue, it's because of FLAG_OBJ_ORIGINAL which is set on the item
on the map.
That flag is cleared when the player picks up the item, so items can merge.
On the other hand, when dropping, that flag is not ignored, so items won't
merge.
As I briefly look at the code, I'm not sure if that flag is really being used
properly, but I'm not really sure what it is used for now.
At one time there was the addition of overlay maps to the server, but I don't
think that was ever really used.
It seems the only time that makes a different is if SAVE_FLAG_NO_REMOVE is
set, and that is set when making backup saves of the player file. And in that
case, FLAG_OBJ_ORIGINAL should already be cleared, because as you note it is
cleared when something is picked up.
From what I can gather, this flag is used with overlays, to distinguish
between
items on a map initially (and thus which will be restored later) and others
added to the map.
Yep, but I don't think overlays are in use anymore (I could be wrong). But
even if that was the intention, it seems broken that it gets set on unique maps
- if I drop an item in my apartment, I wouldn't think that flag should get set
on next load, since that object is hardly original (and I don't think original
to this load was the intention)
I admit to not being sure of the fix here.
One solution is to ignore that flag when merging, ensuring it is cleared after
merge. This would mean that, if there are 5 platinum coins on a map, and I
drop 3 more, the map resets, those 8 coins would stay, and I'd get 5 more
because of the initial map... That doesn't seem too strange, especially
considering that merely picking those 5 coins then dropping them means they
will indeed be restored.
I'm not totally sure of the possible other side effects, though. But the flag
is
not used too much, so it shouldn't be too bard.
Other solution is to remove overlays totally. Not sure if they are used or
not.
That would be the approach I'd lean to, but may be harder. But no reason to
have unused code sitting about that creates complications.
___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire