[3.5.1] bug in drop item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tibarius
    Swordsman
    • Jun 2011
    • 429

    [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.
    Blondes are more fun!
  • PowerWyrm
    Prophet
    • Apr 2008
    • 2987

    #2
    In fact the object should have been dropped under the character. That's what happens in my variant.
    PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

    Comment

    • PowerWyrm
      Prophet
      • Apr 2008
      • 2987

      #3
      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;
      	}
      PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

      Comment

      • PowerWyrm
        Prophet
        • Apr 2008
        • 2987

        #4
        Ticket #1832 created.
        PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

        Comment

        Working...
        😀
        😂
        🥰
        😘
        🤢
        😎
        😞
        😡
        👍
        👎