Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Vanilla (http://angband.oook.cz/forum/forumdisplay.php?f=3)
-   -   [3.5.1] bug in drop item (http://angband.oook.cz/forum/showthread.php?t=7136)

Tibarius January 10, 2015 11:33

[3.5.1] bug in drop item
 
birth Setting "don't stack objects on the floor" is YES

BUG: An object you drop disappears even if there would be an empty space for it in a 3x3 grid around the Player Position.

reproduce bug by the following steps:
create new testchar, set birth Option don't stack Options to true
Buy 80 arrows and 10 flasks of oil and a 3rd item type in town, enter dungeon and leave dungeon until you find an empty room that is big enough to have a 7x7 grid in it.

You cover the floor with items (i.e. arrows) for a grid of 7x7 floor spaces (Player Position is in the Center of the grid). Now you take one arrow out (regardless where) and drop a 2nd item (i.e. flask of oil). The object Drops at the place where you picked up the arrow. Now you drop a 3rd object (i.e. iron shot or pebble) - it disappears.

That is the "normal" behavior which is correct. Now you fill the whole grid with 1 arrow at each Position and just take one arrow out, right beside the Center Position. You squelch arrows.

If you hit "K" and toggle ignore off/on you can check that there is a grid of arrows around you, with just one empty space right beside the Player Position in the Center of the grid.

You toggle ignore "on", it Looks like the whole room is empty (we just know that only one space is empty tho).

You drop a 2nd item type (i.e. flask of oil). The item disappears (bug!).
Instead of disappearing the object should have been dropped in the empty Position right beside the Player, because there IS an empy space within a 3x3 grid around the Player.

PowerWyrm January 12, 2015 12:51

In fact the object should have been dropped under the character. That's what happens in my variant.

PowerWyrm January 12, 2015 13:31

The drop_near() function indeed retrieves the position of the character as a valid drop point. The floor_carry() function discards that location because it doesn't take into account squelched items. That's why the dropped item disappears.

In my variant, there is currently no birth_no_stacking option, but the MAX_FLOOR_STACK value is currently set to 1, which is completely equivalent. The code should make the same assumption.

So instead of:

Code:

        /* Option -- disallow stacking */
        if (OPT(birth_no_stacking) && n) return (0);

        /* The stack is already too large */
        if (n >= MAX_FLOOR_STACK)
        {
                /* Squelch the oldest squelched object */
                s16b squelch_idx = floor_get_idx_oldest_squelched(y, x);

                if (squelch_idx)
                        delete_object_idx(squelch_idx);
                else
                        return 0;
        }

the code should be:

Code:

        /* The stack is already too large */
        if ((n >= MAX_FLOOR_STACK) || (OPT(birth_no_stacking) && n))
        {
                /* Squelch the oldest squelched object */
                s16b squelch_idx = floor_get_idx_oldest_squelched(y, x);

                if (squelch_idx)
                        delete_object_idx(squelch_idx);
                else
                        return 0;
        }


PowerWyrm January 13, 2015 09:27

Ticket #1832 created.


All times are GMT +1. The time now is 20:08.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.