[CF-Devel] button.c magic mouth suggestions

Mark Wedel mwedel at sonic.net
Sat Sep 7 16:21:01 CDT 2002


Kurt Fitzner wrote:
>
     
      On 07-Sep-2002 Andreas Vogl wrote:
     
     >
     
     
     >
     
     
     >>
     
     Before putting it on CVS though, I believe it would be
     
     >>
     
     very good if the patch was tested. One thing I wonder
     
     >>
     
     for example: Kurt you said this works for buttons connected
     
     >>
     
     to a magic_mouth, but does it also work for inventory-checkers
     
     >>
     
     and pedestals? It would be wonderful if it worked for
     
     >>
     
     all of this, not only buttons.
     
     >
     
     
     >
     
     
     >
     
      Sorry, I wasn't explicit.  When I say "button", I mean "anything that
     
     >
     
      provides an output to a 'connection'".
     
     >
     
     
     >
     
      One thing to note, is that 'sp 1' set on a button will reverse it's action. 
     
     >
     
      It makes pressing it cause a release and releasing it cause a press.  In this
     
     >
     
      case, if the button has 'sp 1' and the magic mouth has 'sp 1', then instead of
     
     >
     
      activating the magic mouth on button presses, it will get activated on button
     
     >
     
      releases.  In my opinion, though, this is desired behavior.  If you
     
     >
     
      explicitely reverse the operation of a button, the magic mouth will honor that
     
     >
     
      reversal.
     
     
  Just a note/clarification -

  This works for anything that activates the sign (magic mouth).   It won't do 
anything for other objects that can get connected and that currently get called 
two times (one on push, one on unpush), like mood floors, directors, teleports, 
creators.

  That probably isn't a big deal - it would be easy to add similar code for 
those.  Only danger for some of those is that they may use 'sp' for something else.

  I'd really like to get away from overloading meanings of variables like this. 
  I know crossfire has done a lot of this in the past, but there is no reason to 
continue to do this (other than it is slightly easier to code).

  That said, I'd much rather add something like a couple new flags ' 
FLAG_ON_BUTTON_PRESS' and FLAG_ON_BUTTON_RELEASE' or the like (those are perhaps 
a bit verbose).

  That is much clearer than using sp, and would also mean that other objects 
could use those flags without worry about possible conflicts or the like.




    
    


More information about the crossfire mailing list