Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: "bug" fix for hiding




	Here is a patch to prevent a player using the "fragile"
	form of invisibility (or hiding) to do some tasks such
	as unlocking a door, rolling a boulder. -b.t.

*** player.c	Sun Aug 17 22:45:14 1997
--- player.c.new	Tue Sep 30 08:27:35 1997
***************
*** 1369,1374 ****
--- 1369,1377 ----
      if(tmp->head != NULL)
        tmp = tmp->head;
  
+     /* for 'fragile' forms of invisibiity, eg hidden or invisibility spell, 
+      * any of the following actions, if true,  will make us become seen */
+ 
      /* This blocks deals with opening a normal door.  We look for a key,
       * and if we found one, break the door.  If not, let normal attack
       * code deal with it.
***************
*** 1386,1391 ****
--- 1389,1395 ----
  	hit_player(tmp,9999,op,AT_PHYSICAL); /* Break through the door */
  	if(tmp->inv && tmp->inv->type ==RUNE) spring_trap(tmp->inv,op);	
        }
+       if(op->contr->tmp_invis||op->hide) make_visible(op);
      }
  
      /* This area deals with locked doors.  These are doors that require
***************
*** 1398,1411 ****
  	    tmp2->slaying != tmp->slaying)) /* Find the key */
  	tmp2=tmp2->below;
  
! 	if(tmp2) {
  	  decrease_ob_nr(tmp2, 1); /* Use the key */
  	  remove_door2(tmp); /* remove door without violence ;-) */
  #ifdef SOUND_EFFECTS
  	  play_sound_map(op->map, op->x, op->y, SOUND_OPEN_DOOR);
  #endif
! 	  } else if (tmp->msg) /* show door's message if present */
  	    new_draw_info(NDI_UNIQUE | NDI_NAVY, 0, op, tmp->msg);
      }
  
      /* The following deals with possibly attacking peaceful
--- 1402,1416 ----
  	    tmp2->slaying != tmp->slaying)) /* Find the key */
  	tmp2=tmp2->below;
  
!       if(tmp2) {
  	  decrease_ob_nr(tmp2, 1); /* Use the key */
  	  remove_door2(tmp); /* remove door without violence ;-) */
  #ifdef SOUND_EFFECTS
  	  play_sound_map(op->map, op->x, op->y, SOUND_OPEN_DOOR);
  #endif
!       } else if (tmp->msg) /* show door's message if present */
  	    new_draw_info(NDI_UNIQUE | NDI_NAVY, 0, op, tmp->msg);
+       if(op->contr->tmp_invis||op->hide) make_visible(op);
      }
  
      /* The following deals with possibly attacking peaceful
***************
*** 1424,1436 ****
  	  play_sound_map(op->map, op->x, op->y, SOUND_PUSH_PLAYER);
  #endif
  	  (void) push_ob(tmp,dir,op);
  	}
  
        /* If the object is a boulder or other rollable object, then
         * roll it if not braced.  You can't roll it if you are braced.
         */
!       else if(QUERY_FLAG(tmp,FLAG_CAN_ROLL)&&(!op->contr->braced))
  	  recursive_roll(tmp,dir,op);
  
        /* Any generic living creature.  Including things like doors.
         * Way it works is like this:  First, it must have some hit points
--- 1429,1444 ----
  	  play_sound_map(op->map, op->x, op->y, SOUND_PUSH_PLAYER);
  #endif
  	  (void) push_ob(tmp,dir,op);
+           if(op->contr->tmp_invis||op->hide) make_visible(op);
  	}
  
        /* If the object is a boulder or other rollable object, then
         * roll it if not braced.  You can't roll it if you are braced.
         */
!       else if(QUERY_FLAG(tmp,FLAG_CAN_ROLL)&&(!op->contr->braced)) {
  	  recursive_roll(tmp,dir,op);
+           if(op->contr->tmp_invis||op->hide) make_visible(op);
+       }
  
        /* Any generic living creature.  Including things like doors.
         * Way it works is like this:  First, it must have some hit points
***************
*** 1468,1474 ****
  #endif
  	    tmp->stats.luck = luck;
  	  }
! 	  if(op->contr->tmp_invis||op->hide) make_visible(op);
  	}
      }
  }
--- 1476,1483 ----
  #endif
  	    tmp->stats.luck = luck;
  	  }
! 
!           if(op->contr->tmp_invis||op->hide) make_visible(op);
  	}
      }
  }
[to unsubscribe etc., send mail to crossfire-request@ifi.uio.no]