Opened 10 years ago

Closed 10 years ago

#248 closed bug (fixed (in master))

Hiding squelcables interacts badly with glyph of warding

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

Description

Report:

My dwarven priest casts Glyph of Warding on an empty square.
"The object resists the spell."
k! "1 item squelched."

Solution:

GoW should silently destroy anything on the floor. (Or at least prompt.)

Change History (2)

comment:1 Changed 10 years ago by ajps

Here's a proposed solution - instead of destroying items or refusing to cast the spell, we simply shove any items out of the way as if they had been picked up by the player before casting and dropped again after (not that I'm suggesting that's what is happening in "real life"):

Index: src/spells2.c
===================================================================
--- src/spells2.c       (revision 349)
+++ src/spells2.c       (working copy)
@@ -77,18 +77,27 @@
  */
 void warding_glyph(void)
 {
+       object_type *o_ptr;
        int py = p_ptr->py;
        int px = p_ptr->px;
 
-       /* XXX XXX XXX */
-       if (!cave_clean_bold(py, px))
+       if (!(cave_feat[py][px] == FEAT_FLOOR))
        {
-               msg_print("The object resists the spell.");
+               msg_print("There is no clear floor on which to cast the spell.");
                return;
        }
 
        /* Create a glyph */
        cave_set_feat(py, px, FEAT_GLYPH);
+
+       /* Shift any objects to further away */
+       for (o_ptr = get_first_object(py, px); o_ptr; o_ptr = get_next_object(o_ptr))
+       {
+               drop_near(o_ptr, 0, py, px);
+       }
+
+       /* Delete the "moved" objects from their original position */
+       delete_object(py, px);
 }
 
 

comment:2 Changed 10 years ago by ajps

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

Fixed in [360] merged in [5dfe994] (SVN r399).

Note: See TracTickets for help on using tickets.