Opened 13 years ago

Closed 13 years ago

#254 closed bug (fixed (in master))

Item drops when there are lots of squelched items on the floor

Reported by: takkaria Owned by:
Milestone: 3.0.9 Keywords:


If all of the squares near a monster have hidden items, monster drops may be at a distance when the player is not expecting it.

Solution to this yet to be explored.

Change History (3)

comment:1 Changed 13 years ago by ajps

A couple of possible solutions:

  • change drop_near to "push" items further out rather than be dropped further out themselves.
  • change drop_near to silently destroy the least valuable hidden item rather than moving out at all. The beauty of that being that while it might be hugely unfair on the player they'll never know. :)
  • Make it so that there isn't so much junk about to hide in the first place (not so much a bugfix, though, as the next release version)

comment:2 Changed 13 years ago by ajps

Here's a pretty simple solution that's only a bit of a kludge - when assessing if we can drop in a given spot, pretend that hidden squelchables simply aren't there when scoring squares to decide a drop location.


  • Interacts badly with adult_no_stacking (I believe it would still stack the items). That's trivially fixable by keeping the "unexpected" behaviour in that case - it is a difficulty option after all.
  • Still limited by the maximum number of different objects on a square, so it might still give "funny" behaviour at times. A rare case indeed, and not very noticeable unless all the 23 or so items on the square are squelchable.
  • Has explicitly different behaviour depending on whether you're hiding and/or squelching, (a non-problem, IMO).
Index: src/object2.c
--- src/object2.c       (revision 349)
+++ src/object2.c       (working copy)
@@ -3138,7 +3138,7 @@
 void drop_near(object_type *j_ptr, int chance, int y, int x)
-       int i, k, d, s;
+       int i, k, n, d, s;
        int bs, bn;
        int by, bx;
@@ -3215,6 +3215,7 @@
                        /* No objects */
                        k = 0;
+                       n = 0;
                        /* Scan objects in that grid */
                        for (o_ptr = get_first_object(ty, tx); o_ptr; o_ptr = get_next_object(o_ptr))
@@ -3223,7 +3224,10 @@
                                if (object_similar(o_ptr, j_ptr)) comb = TRUE;
                                /* Count objects */
-                               k++;
+                               if (!squelch_hide_item(o_ptr))
+                                       k++;
+                               else
+                                       n++;
                        /* Add new object */
@@ -3233,7 +3237,7 @@
                        if (adult_no_stacking && (k > 1)) continue;
                        /* Paranoia */
-                       if (k > MAX_FLOOR_STACK) continue;
+                       if ((k + n) > MAX_FLOOR_STACK) continue;
                        /* Calculate score */
                        s = 1000 - (d + k * 5);

comment:3 Changed 13 years ago by ajps

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [361] merged in [5dfe994] (SVN r399)

Note: See TracTickets for help on using tickets.