Re: [BPL14] Retreat

From: Sean Daley (sdaley@BBNPLANET.COM)
Date: 09/17/98


Well, the big part that moves the char is
do_simple_move(ch,dir,TRUE);

Where does dir get setup?  It looks like in the
beginning part of the code, you're setting retreat_type
to the direction you want to retreat in, but then
you don't use it anywhere after that, and dir starts
getting used.

And now that I took a look at the retreat code, I see
it initializes dir to 0 in the beginning which is north.

Now how to analyze things like this.

Let's look at the line do_simple_move(ch, dir, TRUE);
do_simple_move moves ch in whatever direction dir is
set to ... or tries to at least.  ch is the person
calling the command which "should" be passed in
correctly.  This leaves us with dir.  A simple
search on dir in the do_retreat code shows that it's
never set to any value other than 0.  I would say this
needs some fixin'

Sean

At 01:52 AM 09/17/1998 -0600, you wrote:
>Has anyone used the retreat skill from alex's snippets?
>I put it in and no matter which direction i type the char retreats north.
>retreat_south = go_north || retreat_west = go_north...etc...
>I have enclosed the part that actually makes the move so someone can
>perhaps enlighten me why.
>Thanks
>Scorn
>
>retreat_type = search_block(argument + 1, dirs, FALSE);
>   if (retreat_type < 0 || !EXIT(ch, retreat_type) ||
>     EXIT(ch, retreat_type)->to_room == NOWHERE)
>     {
>     send_to_char("Retreat where?\r\n", ch);
>     return;
>     }
>   percent = GET_SKILL(ch, SKILL_RETREAT);
>   prob = number(0, 101);
>   if (prob <= percent){
>      if (CAN_GO(ch, dir) && !IS_SET(ROOM_FLAGS(EXIT(ch,dir)->to_room),
>ROOM_DEATH))
>    {
>    act("$n skillfully retreats from combat.", TRUE, ch, 0, 0, TO_ROOM);
>    send_to_char("You skillfully retreat from combat.\r\n", ch);
>    WAIT_STATE(ch, PULSE_VIOLENCE);
>    do_simple_move(ch, dir, TRUE);
>   if (FIGHTING(ch))
>    stop_fighting(ch);
>
>


     +------------------------------------------------------------+
     | 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/15/00 PST