[CF-Devel] bugfix: triggers and firewalls

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Mon Apr 5 19:24:12 CDT 2004


This patch will fix two timing bugs:

1. Firewalls always cast their spell once every second tic.
   Casting time is supposed to be defined by "speed".

2. Triggers ignore their reset delay time.
-------------- next part --------------
Index: common/button.c
===================================================================
RCS file: /cvsroot/crossfire/crossfire/common/button.c,v
retrieving revision 1.23
diff -c -r1.23 button.c
*** common/button.c	27 Oct 2003 03:44:33 -0000	1.23
--- common/button.c	5 Apr 2004 23:06:36 -0000
***************
*** 332,338 ****
      op->stats.wc = state;
      if (state) {
  	use_trigger(op);
! 	op->speed = 1.0 / op->arch->clone.stats.exp;
  	update_ob_speed(op);
  	op->speed_left = -1;
      } else {
--- 332,341 ----
      op->stats.wc = state;
      if (state) {
  	use_trigger(op);
! 	if (op->stats.exp > 0) /* check sanity  */
! 		op->speed = 1.0 / op->stats.exp;
! 	else
! 		op->speed = 1.0;
  	update_ob_speed(op);
  	op->speed_left = -1;
      } else {
Index: server/spell_util.c
===================================================================
RCS file: /cvsroot/crossfire/crossfire/server/spell_util.c,v
retrieving revision 1.85
diff -c -r1.85 spell_util.c
*** server/spell_util.c	23 Mar 2004 07:52:32 -0000	1.85
--- server/spell_util.c	5 Apr 2004 23:11:20 -0000
***************
*** 1089,1097 ****
  	 * take two ticks.  Things that cast spells on the players
  	 * behalf (eg, altars, and whatever else) shouldn't cost
  	 * the player any time.
! 	 * 
  	 */
! 	if (caster == op) {
  	    op->speed_left -= spell_ob->casting_time*PATH_TIME_MULT(op,spell_ob) * FABS(op->speed);
  	    /* Other portions of the code may also decrement the speed of the player, so
  	     * put a lower limit so that the player isn't stuck here too long
--- 1089,1097 ----
  	 * take two ticks.  Things that cast spells on the players
  	 * behalf (eg, altars, and whatever else) shouldn't cost
  	 * the player any time.
! 	 * Ignore casting time for firewalls
  	 */
! 	if (caster == op && caster->type != FIREWALL) {
  	    op->speed_left -= spell_ob->casting_time*PATH_TIME_MULT(op,spell_ob) * FABS(op->speed);
  	    /* Other portions of the code may also decrement the speed of the player, so
  	     * put a lower limit so that the player isn't stuck here too long
-------------- next part --------------
_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list