[CF-Devel] patch for altar triggers

Andreas Vogl andi.vogl at gmx.net
Thu Mar 8 11:05:47 CST 2001


This is only a minor issue, but nevertheless I wanna air it
here on the list:

There is a problem with altar triggers. Altar triggers work like
normal altars but they reset after a while, thus can be used
infinitly.
The problem is: Altar triggers push their connected value
TWO times per sacrifice. First when you drop the sacrifice, second
when the altar is reset. In most cases that is unwanted, e.g.
when I connect the altar trigger to a creator for selling tickets
or something.

I've written a patch so that one can set the attribute "last_sp 1"
to altar triggers. If set, the altar-connector will be pushed only
once: per sacrifice - not by reset.
Altars with "last_sp 0" (default) remain unchanged.

Attached the patch to the mail. If there are no objections I'll
check it into cvs.


Andreas V.

 
-------------- next part --------------
*** button.c.orig	Wed Mar  7 14:50:46 2001
--- button.c	Wed Mar  7 16:45:36 2001
***************
*** 380,386 ****
            if (operate_altar (op, &cause)) {
              SET_ANIMATION (op, 1);
              update_object(op);
!             trigger_move (op, 1);
              return cause == NULL;
            } else {
              return 0;
--- 380,399 ----
            if (operate_altar (op, &cause)) {
              SET_ANIMATION (op, 1);
              update_object(op);
! 	    
! 	    if (op->last_sp >= 0) {
! 	      trigger_move (op, 1);
! 	      if (op->last_sp > 0)
! 		op->last_sp = -op->last_sp;
! 	    }
! 	    else {
! 	      /* for trigger altar with last_sp, the ON/OFF
! 		 status (->  value) is "simulated": */
! 	      op->value = !op->value;
! 	      trigger_move (op, 1);
! 	      op->last_sp = -op->last_sp;
! 	      op->value = !op->value;
! 	    }
              return cause == NULL;
            } else {
              return 0;
***************
*** 388,394 ****
          } else {
            SET_ANIMATION (op, 0);
            update_object(op);
!           trigger_move (op, 0);
          }
          return 0;
  
--- 401,419 ----
          } else {
            SET_ANIMATION (op, 0);
            update_object(op);
! 	  
!           /* If trigger_altar has "last_sp > 0" set on the map,
!              it will push the connected value only once per sacrifice.
!              Otherwise (default), the connected value will be
!              pushed twice: First by sacrifice, second by reset! -AV */
!           if (!op->last_sp)
!             trigger_move (op, 0);
!           else {
!             op->stats.wc = 0;
!             op->value = !op->value;
!             op->speed = 0;
!             update_ob_speed(op);
!           }
          }
          return 0;
  

    
    


More information about the crossfire mailing list