Whois Problems...

From: Bejhan Jetha (nhlstar6@YAHOO.COM)
Date: 01/12/02


Okay I got a few problems with do_whois and I don't know why, maybe you can
help me. First I'll give you the errors and then ill give you the function.
By the way 1878 is the first line and 1935 is the last line of the
function. One thing I think it might be useful if I mention is this was in
act.informative.c

The Errors:

act.informative.c: In function `do_whois':
act.informative.c:1896: parse error before `else'
act.informative.c:1882: warning: unused variable `tmp'
act.informative.c:1881: warning: unused variable `tmp_store'
act.informative.c: At top level:
act.informative.c:1897: parse error before `while'
act.informative.c:1898: warning: type defaults to `int' in declaration of
`clear_char'
act.informative.c:1898: warning: parameter names (without types) in
function declaration
act.informative.c:1898: conflicting types for `clear_char'
db.h:123: previous declaration of `clear_char'
act.informative.c:1898: warning: data definition has no type or storage
class
act.informative.c:1899: parse error before `if'
act.informative.c:1902: parse error before `0'
act.informative.c:1902: warning: type defaults to `int' in declaration of
`char_to_room'
act.informative.c:1902: conflicting types for `char_to_room'
handler.h:58: previous declaration of `char_to_room'
act.informative.c:1902: warning: data definition has no type or storage
class
act.informative.c:1903: warning: type defaults to `int' in declaration of
`do_whois_function'
act.informative.c:1903: warning: parameter names (without types) in
function declaration
act.informative.c:1903: conflicting types for `do_whois_function'
act.informative.c:95: previous declaration of `do_whois_function'
act.informative.c:1903: warning: data definition has no type or storage
class
act.informative.c:1904: warning: type defaults to `int' in declaration of
`extract_char'
act.informative.c:1904: warning: parameter names (without types) in
function declaration
act.informative.c:1904: conflicting types for `extract_char'
handler.h:59: previous declaration of `extract_char'
act.informative.c:1904: warning: data definition has no type or storage
class
act.informative.c:1905: parse error before `}'
act.informative.c:1907: warning: type defaults to `int' in declaration of
`free'
act.informative.c:1907: warning: parameter names (without types) in
function declaration
act.informative.c:1907: conflicting types for `free'
/usr/include/stdlib.h:67: previous declaration of `free'
act.informative.c:1907: warning: data definition has no type or storage
class
act.informative.c:1908: parse error before `}'
make[1]: *** [act.informative.o] Error 1
make[1]: Leaving directory `/cygdrive/c/mud/src'
make: *** [circle] Error 2


The function:

ACMD(do_whois)
{
  struct char_data *victim;
  struct char_file_u tmp_store;
  int tmp;

  one_argument(argument, buf1);

  if (!*buf1) {
    send_to_char("Who?\r\n", ch);
    return;
  }

  else {
    if ((victim = get_player_vis(ch, buf1, FIND_CHAR_WORLD)) != NULL)
      do_whois_function(ch, victim);
  }

  else {
    CREATE(victim, struct char_data, 1);
    clear_char(victim);
    if (load_char(buf1, &tmp_store) > -1) {
      store_to_char(&tmp_store, victim);
      victim->player.time.logon = tmp_store.last_logon;
      char_to_room(victim, 0);
      do_whois_function(ch, victim);
      extract_char(victim);
    } else {
      send_to_char("There is no such player.\r\n", ch);
      free(victim);
    }
  }
}

void do_whois_fuction(struct char_data *ch, struct char_data *victim)
{
  char whois [MAX_STRING_LENGTH];
  const char *immlevels[LVL_IMPL - (LVL_IMMORT-1)] = {
     "[\\c03Immortal\\c00]",
     "[\\c04Creator\\c00]",
     "[\\c05God\\c00]",
     "[\\c08Overlord\\c00]",
     "[\\c06Ruler\\c00]",
     "[\\c09High Ruler\\c00]",
     "[\\c10High Council\\c00]",
     "[\\c14A*Almighty\\c00]",
     "[\\c11The Almighty\\c00]"
  };

  if (GET_LEVEL(victim) >= LVL_IMMORT)
    sprintf(whois, "%s %s %s\r\n",
        immlevels[GET_LEVEL(victim)-LVL_IMMORT], GET_NAME(victim), GET_TITLE
(victim));
  else if (GET_LEVEL(victim) < LVL_IMMORT)
    sprintf(whois, "Level %d %s - %s %s\r\n",
          GET_LEVEL(victim), CLASS_ABBR(victim), GET_NAME(victim), GET_TITLE
(victim));
  send_to_char(whois, ch);

}

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT