Re: [CODE] GET_LEVEL(vict) && crash

From: Co-Sysop (dmodem@CYBNETONLINE.COM)
Date: 11/10/97


At 10:59 PM 11/8/97 -0800, you wrote:
>On Sat, 8 Nov 1997, Co-Sysop wrote:
>
>->>>         else if (GET_LEVEL(vict) < LVL_IMPL)
>->>>           act(message to player like "Don't kill imps");
>->
>->There were no warning while compiling.  That is why I was so puzzled.
>
>A warning/compiler error results in code that won't work.  A crash
>results from code that doesn't work how you want it to (unless you
>wanted to crash the game).

Who would want to crash their MUD?  I sure don't (although I end up
crashing it more often than I would like).

>BTW, looking at the above code, isn't that a logic error?  I mean,
>that would mean that the message would only be shown if they tried
>killing people that were below the Implementor level.  I thought the
>idea was to prevent people from killing implementors, not everyone but
>implementors?  Hopefully that was just an error from when you retyped
>it, and this message probably is worthless, but you never can tell...

I was just sort of tossing things together because I was assuming the
problem was in GET_LEVEL(vict) and that was really the only relevant part
(or so I thought).  Just in case anyone is wondering, here is the actual
fixed code (which I'm sure everyone could have done in 3 seconds by
themselves):

right after
    else if (ch == vict)
      send_to_char("Your mother would be so sad..
:(\r\n", ch);
in ACMD(do_kill) in act.offensive.c add
    else if (GET_LEVEL(vict) == LVL_IMPL)
      send_to_char("Hey!  Don't do that!", ch); /* Feel free to edit this
line to your liking */
and there you go.  Imps can't kill imps :)
In case you are wondering "Why?", one of my imps was playing around killing
things and asked if he could kill me.  I assuming an implementor couldn't
die so I laughed and said 'I'd like to see you try!'.  And well, I got to
die for the first time on my MUD!...I really would rather have avoided the
whole ugly mess, but, c'est la vie!
Yes I am a perfectionist.  I also plan on going through the code and
changing a few things so that only the first player (me) can do things that
other imps can't do (like some things that imps can't do to other imps).
Maybe I'm paranoid but at least I won't have any of my immortal staff
giving a stranger access to the code (sorry if I offended the person who
had their code stolen but it seems to be the best example).


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST