Re: Abbreviate acting strange?

From: The Merciless Lord of everything (serces@mud.dk)
Date: 12/07/98


Daniel Koepke wrote:
>   if (!*argument) { /* No Argument */
>     .
>     .
>     .
>   } else {
>     one_argument(argument, arg);
>
>     if (!(vict = get_char_room_vis(ch, arg))) {
>       send_to_char("Bash who?\r\n", ch);
>       return;
>     }
>   }
This was my Approach finally, except I put it in so that I could use it
anywhere by making it a struct of it's own. for those interessted here
it goes :

In handler.c put this in somwhere, I put it below the get_char thingies
--- in handler.c ---
struct char_data *get_opponent(struct char_data * ch, char *argu)
{
 struct char_data *vict;
 if (!*argu) { /* No Argument */
  if (FIGHTING(ch)) {
   return(FIGHTING(ch));
  } else {
   return NULL;
  }
 } else {
  one_argument(argu, arg);
  if (!(vict = get_char_room_vis(ch, arg))) {
   return NULL;
  } else {
   return vict;
  }
 }
 return NULL; // Just in case
}


then in handler.h remember this line :
struct char_data *get_opponent(struct char_data *ch, char *argu);
this one I put below the struct *get_char_vis...

Now this should actually work with everything taken into consideration
(I hope) and you can do something like :

if (!(vict = get_opponent(ch, argument))) {
 send_to_char("Bash Who?", ch);
 return;
}

Use it if you like, if not, don't.. If you have suggestions to the code,
please let me know (Speedups whatnots.. :), flames are archived directly
into the dustbin..

:)

/Serces
Merry Dol, Derry dol my hearties.


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



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