check_flags should work now!?!?!

From: Corey Elliott (strmchsr@arn.net)
Date: 04/08/99


Thanks to everyone for helping me with my first post. That ugliness was
simply the
result of staring at code too long and not seeing the obvious (plus the fact
that it is
me writing the code). I have finally come up with the following block of
code that
I believe should be working. I've looked at all the other two_argument
instances and
I don't see what is wrong with mine, except being three_arguments : )

ACMD(do_flagset)
{
  struct char_data *vict = NULL;
  int number2, number3 = 0;
  char *flag_number, *flag_value;

  flag_number = buf1;
  flag_value = buf2;

  three_arguments(argument, arg, flag_number, flag_value);

  if (!*arg || !*flag_number || !*flag_value || !isdigit(*flag_number) ||
!isdigit(*flag_value)) {
  send_to_char("Usage: flags <victim> <flag number> <flag value>\r\n", ch);
  return;
  }
  if ((number2 = atoi(flag_number) < 0) || (number3 = atoi(flag_value) < 0))
  {
    send_to_char("You can't use a negative number!\r\n", ch);
    return;
  }
    if (!(vict = get_player_vis(ch, arg, 0))) {
 send_to_char("There is no such player.\r\n", ch);
 return;
      }
    CHECK_FLAGS(vict, number2) = number3;
 sprintf(buf,"%s's Flag %d is set at %d.\r\n", GET_NAME(vict), number2,
number3);
    send_to_char(buf, ch);
}


Whenever I type -> flagset <victim> <number> <number> I always get :
<victim>'s Flag 0 is set at 0.

I inserted some checks to print the value of flag_number and flag_value to
the mudlog
and kept getting some massive numbers (ex. 5134752) and the checks for
number2
and number 3 are always zero.


Corey Elliott
strmchsr@arn.net
http://users.arn.net/~strmchsr/Lightning.html


     +------------------------------------------------------------+
     | 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