Difference for server/c_misc.c from version 1.80 to 1.81


version 1.80 version 1.81
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_c_misc_c =   * static char *rcsid_c_misc_c =
  *   "$Id: c_misc.c,v 1.80 2006/08/08 10:05:34 ryo_saeba Exp $";   *   "$Id: c_misc.c,v 1.81 2006/09/04 07:21:05 mwedel Exp $";
  */   */
   
 /*  /*
Line 41
 
Line 41
   
 void map_info(object *op, char *search) {  void map_info(object *op, char *search) {
   mapstruct *m;    mapstruct *m;
   char buf[MAX_BUF], map_path[MAX_BUF];      char map_path[MAX_BUF];
   long sec = seconds();    long sec = seconds();
   new_draw_info_format(NDI_UNIQUE, 0, op,  
       draw_ext_info_format(NDI_UNIQUE, 0, op,
    MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MAPS,
    "Current time is: %02ld:%02ld:%02ld.",
  "Current time is: %02ld:%02ld:%02ld.",   "Current time is: %02ld:%02ld:%02ld.",
    (sec%86400)/3600,(sec%3600)/60,sec%60);     (sec%86400)/3600,(sec%3600)/60,sec%60);
   new_draw_info(NDI_UNIQUE, 0,op,"Path               Pl PlM IM   TO Dif Reset");  
       draw_ext_info(NDI_UNIQUE, 0,op,
    MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MAPS,
    "[fixed]Path               Pl PlM IM   TO Dif Reset",
    "Path               Pl PlM IM   TO Dif Reset");
   
   for(m=first_map;m!=NULL;m=m->next) {    for(m=first_map;m!=NULL;m=m->next) {
   
     if ( search && strstr(m->path,search)==NULL ) continue; /* Skip unwanted maps */      if ( search && strstr(m->path,search)==NULL ) continue; /* Skip unwanted maps */
   
     /* Print out the last 18 characters of the map name... */      /* Print out the last 18 characters of the map name... */
     if (strlen(m->path)<=18) strcpy(map_path, m->path);      if (strlen(m->path)<=18) strcpy(map_path, m->path);
     else strcpy(map_path, m->path + strlen(m->path) - 18);      else strcpy(map_path, m->path + strlen(m->path) - 18);
       sprintf(buf,"%-18.18s %2d %2d   %1d %4d %2d  %02d:%02d:%02d",  
    draw_ext_info_format(NDI_UNIQUE,0,op,
        MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MAPS,
        "[fixed]%-18.18s %2d %2d   %1d %4d %2d  %02d:%02d:%02d",
        "%-18.18s %2d %2d   %1d %4d %2d  %02d:%02d:%02d",
               map_path, m->players,players_on_map(m,FALSE),                map_path, m->players,players_on_map(m,FALSE),
               m->in_memory,m->timeout,m->difficulty,                m->in_memory,m->timeout,m->difficulty,
        (MAP_WHEN_RESET(m)%86400)/3600,(MAP_WHEN_RESET(m)%3600)/60,         (MAP_WHEN_RESET(m)%86400)/3600,(MAP_WHEN_RESET(m)%3600)/60,
               MAP_WHEN_RESET(m)%60);                MAP_WHEN_RESET(m)%60);
     new_draw_info(NDI_UNIQUE, 0,op,buf);  
   }    }
 }  }
   
Line 74
 
Line 86
     /* Too hard to try and make a header that lines everything up, so just       /* Too hard to try and make a header that lines everything up, so just
      * give a description.       * give a description.
      */       */
     new_draw_info(NDI_UNIQUE, 0, op, "The first column is the name of the body location.");      draw_ext_info(NDI_UNIQUE, 0, op,
     new_draw_info(NDI_UNIQUE, 0, op, "The second column is how many of those locations your body has.");   MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_BODY,
     new_draw_info(NDI_UNIQUE, 0, op, "The third column is how many slots in that location are available.");   "The first column is the name of the body location.", NULL);
   
       draw_ext_info(NDI_UNIQUE, 0, op,
    MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_BODY,
    "The second column is how many of those locations your body has.", NULL);
   
       draw_ext_info(NDI_UNIQUE, 0, op,
    MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_BODY,
    "The third column is how many slots in that location are available.", NULL);
   
     for (i=0; i<NUM_BODY_LOCATIONS; i++) {      for (i=0; i<NUM_BODY_LOCATIONS; i++) {
  /* really debugging - normally body_used should not be set to anything   /* really debugging - normally body_used should not be set to anything
  * if body_info isn't also set.   * if body_info isn't also set.
  */   */
  if (op->body_info[i] || op->body_used[i]) {   if (op->body_info[i] || op->body_used[i]) {
      new_draw_info_format(NDI_UNIQUE, 0, op,        draw_ext_info_format(NDI_UNIQUE, 0, op,
  "%-30s %5d %5d", body_locations[i].use_name, op->body_info[i], op->body_used[i]);   MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_BODY,
    "[fixed]%-30s %5d %5d",
    "%-30s %5d %5d",
    body_locations[i].use_name, op->body_info[i], op->body_used[i]);
  }   }
     }      }
     if (!QUERY_FLAG(op, FLAG_USE_ARMOUR))      if (!QUERY_FLAG(op, FLAG_USE_ARMOUR))
  new_draw_info(NDI_UNIQUE, 0, op, "You are not allowed to wear armor");   draw_ext_info(NDI_UNIQUE, 0, op,
        MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_BODY,
        "You are not allowed to wear armor", NULL);
     if (!QUERY_FLAG(op, FLAG_USE_WEAPON))      if (!QUERY_FLAG(op, FLAG_USE_WEAPON))
  new_draw_info(NDI_UNIQUE, 0, op, "You are not allowed to use weapons");   draw_ext_info(NDI_UNIQUE, 0, op,
        MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_BODY,
        "You are not allowed to use weapons", NULL);
   
     return 1;      return 1;
 }  }
Line 113
 
Line 141
  return 1;   return 1;
 }  }
   
 int command_bug(object *op, char *params)  
 {  
     char buf[MAX_BUF];  
   
     if (params == NULL) {  
       new_draw_info(NDI_UNIQUE, 0,op,"what bugs?");  
       return 1;  
     }  
     strcpy(buf,op->name);  
     strcat(buf," bug-reports: ");  
     strncat(buf,++params,MAX_BUF - strlen(buf) );  
     buf[MAX_BUF - 1] = '\0';  
     bug_report(buf);  
     LOG(llevError,"%s\n",buf);  
     new_draw_info(NDI_ALL | NDI_UNIQUE, 1, NULL, buf);  
     new_draw_info(NDI_UNIQUE, 0,op, "OK, thanks!");  
     return 1;  
 }  
   
   
 void malloc_info(object *op) {  void malloc_info(object *op) {
   int ob_used=count_used(),ob_free=count_free(),players,nrofmaps;    int ob_used=count_used(),ob_free=count_free(),players,nrofmaps;
   int nrm=0,mapmem=0,anr,anims,sum_alloc=0,sum_used=0,i,tlnr, alnr;    int nrm=0,mapmem=0,anr,anims,sum_alloc=0,sum_used=0,i,tlnr, alnr;
Line 152
 
Line 160
     anims += animations[i].num_animations;      anims += animations[i].num_animations;
   
   for(pl=first_player,players=0;pl!=NULL;pl=pl->next,players++);    for(pl=first_player,players=0;pl!=NULL;pl=pl->next,players++);
   
   for(m=first_map,nrofmaps=0;m!=NULL;m=m->next,nrofmaps++)    for(m=first_map,nrofmaps=0;m!=NULL;m=m->next,nrofmaps++)
  if(m->in_memory == MAP_IN_MEMORY) {   if(m->in_memory == MAP_IN_MEMORY) {
      mapmem+=MAP_WIDTH(m)*MAP_HEIGHT(m)*(sizeof(object *)+sizeof(MapSpace));       mapmem+=MAP_WIDTH(m)*MAP_HEIGHT(m)*(sizeof(object *)+sizeof(MapSpace));
      nrm++;       nrm++;
  }   }
   sprintf(errmsg,"Sizeof: object=%ld  player=%ld  map=%ld",  
           (long)sizeof(object),(long)sizeof(player),(long)sizeof(mapstruct));      draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);   "Sizeof: object=%d  player=%d  map=%d",
   sprintf(errmsg,"%4d used objects:    %8d",ob_used,i=(ob_used*sizeof(object)));   "Sizeof: object=%d  player=%d  map=%d",
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);   sizeof(object),sizeof(player),sizeof(mapstruct));
   sum_used+=i;  sum_alloc+=i;  
   sprintf(errmsg,"%4d free objects:    %8d",ob_free,i=(ob_free*sizeof(object)));      draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);   "[fixed]%4d used objects:    %8d",
   sprintf(errmsg,"%4d active objects:  %8d",count_active(), 0);   "%4d used objects:    %8d",
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);   ob_used,i=(ob_used*sizeof(object)));
   
       sum_used+=i;
       sum_alloc+=i;
       draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
    "[fixed]%4d free objects:    %8d",
    "%4d free objects:    %8d",
    ob_free,i=(ob_free*sizeof(object)));
   
       draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
    "[fixed]%4d active objects:  %8d",
    "%4d active objects:  %8d",
    count_active(), 0);
   
       sum_alloc+=i;
       draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
    "[fixed]%4d players:         %8d",
    "%4d players:         %8d",
    players,i=(players*sizeof(player)));
   
       sum_alloc+=i;
       sum_used+=i;
   
       draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
      "[fixed]%4d maps allocated:  %8d",
      "%4d maps allocated:  %8d",
      nrofmaps, i=(nrofmaps*sizeof(mapstruct)));
   
       sum_alloc+=i;
       sum_used+=nrm*sizeof(mapstruct);
   
       draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
    "[fixed]%4d maps in memory:  %8d",
    "%4d maps in memory:  %8d",
    nrm,mapmem);
   
       sum_alloc+=mapmem;
       sum_used+=mapmem;
   
       draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
    "[fixed]%4d archetypes:      %8d",
    "%4d archetypes:      %8d",
    anr,i=(anr*sizeof(archetype)));
   
       sum_alloc+=i;
       sum_used+=i;
   
       draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
    "[fixed]%4d animations:      %8d",
    "%4d animations:      %8d",
      anims,i=(anims*sizeof(Fontindex)));
   
       sum_alloc+=i;
       sum_used+=i;
   
       draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
    "[fixed]%4d treasurelists    %8d",
    "%4d treasurelists    %8d",
    tlnr,i=(tlnr*sizeof(treasurelist)));
   
       sum_alloc+=i;
       sum_used+=i;
   
       draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
      "[fixed]%4ld treasures        %8d",
      "%4ld treasures        %8d",
      nroftreasures, i=(nroftreasures*sizeof(treasure)));
   
       sum_alloc+=i;
       sum_used+=i;
   
       draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
    "[fixed]%4ld artifacts        %8d",
    "%4ld artifacts        %8d",
    nrofartifacts, i=(nrofartifacts*sizeof(artifact)));
   
       sum_alloc+=i;
       sum_used +=i;
   
       draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
      "[fixed]%4ld artifacts strngs %8d",
      "%4ld artifacts strngs %8d",
      nrofallowedstr, i=(nrofallowedstr*sizeof(linked_char)));
   
   sum_alloc+=i;    sum_alloc+=i;
   sprintf(errmsg,"%4d players:         %8d",players,i=(players*sizeof(player)));      sum_used+=i;
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);  
   sum_alloc+=i; sum_used+=i;      draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
      "[fixed]%4d artifactlists    %8d",
      "%4d artifactlists    %8d",
   sprintf(errmsg,"%4d maps allocated:  %8d",nrofmaps,     alnr,i=(alnr*sizeof(artifactlist)));
           i=(nrofmaps*sizeof(mapstruct)));  
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);      sum_alloc += i;
   sum_alloc+=i;  sum_used+=nrm*sizeof(mapstruct);      sum_used += i;
   sprintf(errmsg,"%4d maps in memory:  %8d",nrm,mapmem);  
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);      draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
   sum_alloc+=mapmem; sum_used+=mapmem;     "[fixed]Total space allocated:%8d",
   sprintf(errmsg,"%4d archetypes:      %8d",anr,i=(anr*sizeof(archetype)));     "Total space allocated:%8d",
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);     sum_alloc);
   sum_alloc+=i; sum_used+=i;  
   sprintf(errmsg,"%4d animations:      %8d",anims,i=(anims*sizeof(Fontindex)));      draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MALLOC,
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);     "[fixed]Total space used:     %8d",
   sum_alloc+=i; sum_used+=i;     "Total space used:     %8d",
      sum_used);
   sprintf(errmsg,"%4d treasurelists    %8d",tlnr,i=(tlnr*sizeof(treasurelist)));  
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);  
   sum_alloc+=i; sum_used+=i;  
   sprintf(errmsg,"%4ld treasures        %8d",nroftreasures,  
           i=(nroftreasures*sizeof(treasure)));  
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);  
   sum_alloc+=i; sum_used+=i;  
   sprintf(errmsg,"%4ld artifacts        %8d", nrofartifacts,  
           i=(nrofartifacts*sizeof(artifact)));  
   new_draw_info(NDI_UNIQUE, 0,op, errmsg);  
   sum_alloc+=i; sum_used +=i;  
   sprintf(errmsg,"%4ld artifacts strngs %8d", nrofallowedstr,  
           i=(nrofallowedstr*sizeof(linked_char)));  
   new_draw_info(NDI_UNIQUE, 0,op, errmsg);  
   sum_alloc += i;sum_used+=i;  
   sprintf(errmsg,"%4d artifactlists    %8d",alnr,i=(alnr*sizeof(artifactlist)));  
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);  
   sum_alloc += i; sum_used += i;  
   
   sprintf(errmsg,"Total space allocated:%8d",sum_alloc);  
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);  
   sprintf(errmsg,"Total space used:     %8d",sum_used);  
   new_draw_info(NDI_UNIQUE, 0,op,errmsg);  
 }  }
   
 /**  /**
Line 224
 
Line 294
      */       */
     region *r = get_region_by_name(get_name_of_region_for_map(op->map));      region *r = get_region_by_name(get_name_of_region_for_map(op->map));
   
       /* This should only be possible if regions are not operating on this server. */
     if (!r)      if (!r)
  return;   return;
  /* This should only be possible if regions are not operating on this server. */  
   
     new_draw_info_format(NDI_UNIQUE, 0,op,         draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  "You are in %s. \n %s", get_region_longname(r), get_region_msg(r));   "You are in %s. \n %s",
    "You are in %s. \n %s",
    get_region_longname(r), get_region_msg(r));
 }  }
   
 void current_map_info(object *op) {  void current_map_info(object *op) {
Line 238
 
Line 310
     if (!m)      if (!m)
  return;   return;
   
     new_draw_info_format(NDI_UNIQUE, 0,op,         draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  "%s (%s) in %s", m->name, m->path, get_name_of_region_for_map(m));   "%s (%s) in %s",
    "%s (%s) in %s",
    m->name, m->path, get_name_of_region_for_map(m));
   
     if (QUERY_FLAG(op,FLAG_WIZ)) {      if (QUERY_FLAG(op,FLAG_WIZ)) {
  new_draw_info_format(NDI_UNIQUE, 0, op,   draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
    "players:%d difficulty:%d size:%dx%d start:%dx%d timeout %ld",
  "players:%d difficulty:%d size:%dx%d start:%dx%d timeout %ld",   "players:%d difficulty:%d size:%dx%d start:%dx%d timeout %ld",
  m->players, m->difficulty,    m->players, m->difficulty,
  MAP_WIDTH(m), MAP_HEIGHT(m),    MAP_WIDTH(m), MAP_HEIGHT(m),
Line 251
 
Line 326
   
     }      }
     if (m->msg)      if (m->msg)
  new_draw_info(NDI_UNIQUE, NDI_NAVY, op, m->msg);   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE, m->msg, NULL);
 }  }
   
 #ifdef DEBUG_MALLOC_LEVEL  #ifdef DEBUG_MALLOC_LEVEL
Line 260
 
Line 335
  extern int malloc_verify(void);   extern int malloc_verify(void);
   
  if (!malloc_verify())    if (!malloc_verify())
  new_draw_info(NDI_UNIQUE, 0,op,"Heap is corrupted.");   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
      "Heap is corrupted.", NULL);
  else   else
  new_draw_info(NDI_UNIQUE, 0,op,"Heap checks out OK.");   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
    "Heap checks out OK.", NULL);
   
  return 1;   return 1;
  }   }
 #endif  #endif
Line 295
 
Line 373
  LOG(llevError,"command_whereabouts() Region %s with no longname has no parent", reg->name);   LOG(llevError,"command_whereabouts() Region %s with no longname has no parent", reg->name);
  }   }
     }      }
  new_draw_info_format(NDI_UNIQUE, 0,op,      draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  "In the world currently there are:");   "In the world currently there are:", NULL);
   
  for (reg=first_region;reg!=NULL;reg=reg->next)   for (reg=first_region;reg!=NULL;reg=reg->next)
      if(reg->counter>0)   if(reg->counter>0) {
  new_draw_info_format(NDI_UNIQUE, 0,op,       draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
      "%u players in %s", reg->counter, get_region_longname(reg));   "%u players in %s",
    "%u players in %s",
    reg->counter, get_region_longname(reg));
    }
     return 1;      return 1;
 }  }
   
 typedef struct  typedef struct {
     {  
       char namebuf[MAX_BUF];        char namebuf[MAX_BUF];
       int login_order;        int login_order;
     } chars_names;      } chars_names;
   
 /** local functon for qsort comparison*/  /** local functon for qsort comparison*/
 static int name_cmp (const chars_names *c1, const chars_names *c2)  static int name_cmp (const chars_names *c1, const chars_names *c2) {
     {  
       return strcasecmp (c1->namebuf, c2->namebuf);        return strcasecmp (c1->namebuf, c2->namebuf);
     }      }
   
Line 321
 
Line 401
     uint16 i;      uint16 i;
     region *reg;      region *reg;
     char* format;      char* format;
     int num_players = 0;      int num_players = 0, num_wiz = 0, num_afk = 0, num_bot = 0;
     int num_wiz = 0;  
     int num_afk = 0;  
     int num_bot = 0;  
     chars_names *chars = NULL;      chars_names *chars = NULL;
          
     /*       /*
Line 356
 
Line 433
      num_players++;       num_players++;
      chars = (chars_names *) realloc(chars, num_players*sizeof(chars_names));       chars = (chars_names *) realloc(chars, num_players*sizeof(chars_names));
             if (chars == NULL) {              if (chars == NULL) {
          new_draw_info(NDI_UNIQUE, 0, op, "who failed - out of memory!");           draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WHO,
          "who failed - out of memory!", NULL);
                 return 0;                  return 0;
             }               }
      sprintf(chars[num_players-1].namebuf, "%s", pl->ob->name);       sprintf(chars[num_players-1].namebuf, "%s", pl->ob->name);
      chars[num_players-1].login_order = num_players;       chars[num_players-1].login_order = num_players;
   
      /*Check for WIZ's & AFK's*/       /*Check for WIZ's & AFK's*/
      if (QUERY_FLAG(pl->ob,FLAG_WIZ))       if (QUERY_FLAG(pl->ob,FLAG_WIZ))
        num_wiz++;         num_wiz++;
   
      if (QUERY_FLAG(pl->ob,FLAG_AFK))       if (QUERY_FLAG(pl->ob,FLAG_AFK))
        num_afk++;         num_afk++;
   
  if (pl->socket.is_bot)   if (pl->socket.is_bot)
  num_bot++;   num_bot++;
  }   }
     }      }
     if (first_player != (player *) NULL) {      if (first_player != (player *) NULL) {
     if (reg == NULL)       if (reg == NULL)
  new_draw_info_format(NDI_UNIQUE, 0, op, "Total Players (%d) -- WIZ(%d) AFK(%d) BOT(%d)",        draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WHO,
         "Total Players (%d) -- WIZ(%d) AFK(%d) BOT(%d)",
         "Total Players (%d) -- WIZ(%d) AFK(%d) BOT(%d)",
            num_players, num_wiz, num_afk, num_bot);             num_players, num_wiz, num_afk, num_bot);
  else if (reg->longname == NULL)  
      new_draw_info_format(NDI_UNIQUE, 0, op, "Total Players in %s (%d) -- WIZ(%d) AFK(%d) BOT(%d)",   
  reg->name, num_players, num_wiz, num_afk, num_bot);  
  else   else
  new_draw_info_format(NDI_UNIQUE, 0, op, "Total Players in %s (%d) -- WIZ(%d) AFK(%d) BOT(%d)",        draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WHO,
            reg->longname, num_players, num_wiz, num_afk, num_bot);        "Total Players in %s (%d) -- WIZ(%d) AFK(%d) BOT(%d)",
         "Total Players in %s (%d) -- WIZ(%d) AFK(%d) BOT(%d)",
         reg->longname?reg->longname:reg->name, num_players, num_wiz, num_afk, num_bot);
     }      }
     qsort (chars, num_players, sizeof(chars_names), (int (*)(const void *, const void *))name_cmp);      qsort (chars, num_players, sizeof(chars_names), (int (*)(const void *, const void *))name_cmp);
     for (i=0;i<num_players;i++)      for (i=0;i<num_players;i++)
Line 391
 
Line 473
 /** Display a line of 'who' to op, about pl, using the formatting specified by format */  /** Display a line of 'who' to op, about pl, using the formatting specified by format */
 void display_who_entry(object *op, player *pl, const char *format) {  void display_who_entry(object *op, player *pl, const char *format) {
     char tmpbuf[MAX_BUF];      char tmpbuf[MAX_BUF];
     char outbuf[MAX_BUF];      char outbuf[MAX_BUF], outbuf1[MAX_BUF];
     size_t i;      size_t i;
     outbuf[0]='\0'; /* we strcat to this, so reset it here. */  
       strcpy(outbuf, "[fixed]");
       outbuf1[0] = '\0';
   
     if (pl==NULL) {      if (pl==NULL) {
     LOG(llevError,"display_who_entry(): I was passed a null player");      LOG(llevError,"display_who_entry(): I was passed a null player");
  return;   return;
Line 403
 
Line 488
             i++;              i++;
             get_who_escape_code_value(tmpbuf,format[i],pl);              get_who_escape_code_value(tmpbuf,format[i],pl);
             strcat(outbuf, tmpbuf);              strcat(outbuf, tmpbuf);
               strcat(outbuf1, tmpbuf);
         }          }
         else if (format[i]=='_')          else if (format[i]=='_') {
             strcat(outbuf," "); /* allow '_' to be used in place of spaces */              strcat(outbuf," "); /* allow '_' to be used in place of spaces */
               strcat(outbuf1," "); /* allow '_' to be used in place of spaces */
    }
         else {          else {
             sprintf(tmpbuf,"%c",format[i]);              sprintf(tmpbuf,"%c",format[i]);
             strcat(outbuf,tmpbuf);              strcat(outbuf,tmpbuf);
               strcat(outbuf1,tmpbuf);
         }          }
     }      }
     new_draw_info(NDI_UNIQUE, 0, op, outbuf);      draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WHO, outbuf, outbuf1);
 }  }
   
 /**  /**
Line 441
 
Line 530
     switch (letter) {      switch (letter) {
  case 'N' :    strcpy(return_val, pl->ob->name);   case 'N' :    strcpy(return_val, pl->ob->name);
            break;             break;
   
  case 't' :    strcpy(return_val,(pl->own_title[0]=='\0'?pl->title:pl->own_title));   case 't' :    strcpy(return_val,(pl->own_title[0]=='\0'?pl->title:pl->own_title));
    break;     break;
   
     case 'T' :    if (pl->own_title[0]=='\0')      case 'T' :    if (pl->own_title[0]=='\0')
                       strcpy(return_val,"the ");                        strcpy(return_val,"the ");
                   else                    else
                       *return_val='\0';                        *return_val='\0';
               break;                break;
   
  case 'c' :    sprintf(return_val,"%d",pl->ob->count);   case 'c' :    sprintf(return_val,"%d",pl->ob->count);
    break;     break;
   
  case 'n' :    strcpy(return_val, "\n");    case 'n' :    strcpy(return_val, "\n");
            break;             break;
   
  case 'h' :    strcpy(return_val,pl->peaceful?"":" [Hostile]");   case 'h' :    strcpy(return_val,pl->peaceful?"":" [Hostile]");
    break;     break;
   
  case 'l' :    sprintf(return_val,"%d",pl->ob->level);   case 'l' :    sprintf(return_val,"%d",pl->ob->level);
    break;     break;
   
  case 'd' :    strcpy(return_val,(QUERY_FLAG(pl->ob,FLAG_WIZ)?" [WIZ]":""));   case 'd' :    strcpy(return_val,(QUERY_FLAG(pl->ob,FLAG_WIZ)?" [WIZ]":""));
    break;     break;
   
  case 'a' :    strcpy(return_val,(QUERY_FLAG(pl->ob,FLAG_AFK)?" [AFK]":""));   case 'a' :    strcpy(return_val,(QUERY_FLAG(pl->ob,FLAG_AFK)?" [AFK]":""));
    break;     break;
   
  case 'b' :    strcpy(return_val,(pl->socket.is_bot == 1)?" [BOT]":"");   case 'b' :    strcpy(return_val,(pl->socket.is_bot == 1)?" [BOT]":"");
    break;     break;
   
      case 'm' :    strcpy(return_val,pl->ob->map->path);       case 'm' :    strcpy(return_val,pl->ob->map->path);
    break;     break;
   
  case 'M' :    strcpy(return_val,pl->ob->map->name?pl->ob->map->name:"Untitled");   case 'M' :    strcpy(return_val,pl->ob->map->name?pl->ob->map->name:"Untitled");
    break;      break;
   
  case 'r' :    strcpy(return_val,get_name_of_region_for_map(pl->ob->map));   case 'r' :    strcpy(return_val,get_name_of_region_for_map(pl->ob->map));
    break;     break;
   
  case 'R' :    strcpy(return_val,get_region_longname(get_region_by_map(pl->ob->map)));   case 'R' :    strcpy(return_val,get_region_longname(get_region_by_map(pl->ob->map)));
    break;     break;
   
  case 'i' :    strcpy(return_val,pl->socket.host);   case 'i' :    strcpy(return_val,pl->socket.host);
    break;     break;
   
  case '%' :    strcpy(return_val, "%");    case '%' :    strcpy(return_val, "%");
            break;             break;
   
  case '_' :    strcpy(return_val, "_");    case '_' :    strcpy(return_val, "_");
            break;             break;
     }      }
   
 }  }
   
   
Line 485
 
Line 589
 {  {
     if QUERY_FLAG(op,FLAG_AFK) {       if QUERY_FLAG(op,FLAG_AFK) {
        CLEAR_FLAG(op,FLAG_AFK);         CLEAR_FLAG(op,FLAG_AFK);
        new_draw_info(NDI_UNIQUE, 0, op, "You are no longer AFK");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "You are no longer AFK", NULL);
     }          }   
     else       else
     {      {
        SET_FLAG(op,FLAG_AFK);         SET_FLAG(op,FLAG_AFK);
        new_draw_info(NDI_UNIQUE, 0, op, "You are now AFK");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "You are now AFK", NULL);
     }      }
     return 1;      return 1;
 }  }
Line 522
 
Line 628
 int command_strings (object *op, char *params)  int command_strings (object *op, char *params)
 {  {
     ss_dump_statistics();      ss_dump_statistics();
     new_draw_info(NDI_UNIQUE, 0,op,errmsg);      draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_LAST,
     new_draw_info(NDI_UNIQUE, 0,op,ss_dump_table(2));   "[fixed]%s\n",
    "%s",
      errmsg);
   
       draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_LAST,
      ss_dump_table(2), NULL);
     return 1;      return 1;
   }    }
   
Line 557
 
Line 668
   
     if (QUERY_FLAG(op, FLAG_WIZ)) {      if (QUERY_FLAG(op, FLAG_WIZ)) {
  /* dump the weather, Dm style! Yo! */   /* dump the weather, Dm style! Yo! */
  new_draw_info_format(NDI_UNIQUE, 0, op, "Real temp: %d",  
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
         "Real temp: %d",
         "Real temp: %d",
      real_world_temperature(op->x, op->y, op->map));       real_world_temperature(op->x, op->y, op->map));
  new_draw_info_format(NDI_UNIQUE, 0, op, "Base temp: %d",  
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
         "Base temp: %d",
         "Base temp: %d",
      weathermap[wx][wy].temp);       weathermap[wx][wy].temp);
  new_draw_info_format(NDI_UNIQUE, 0, op, "Humid: %d",  
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
         "Humid: %d",
         "Humid: %d",
      weathermap[wx][wy].humid);       weathermap[wx][wy].humid);
  new_draw_info_format(NDI_UNIQUE, 0, op, "Wind: dir=%d speed=%d",  
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
         "Wind: dir=%d speed=%d",
         "Wind: dir=%d speed=%d",
      weathermap[wx][wy].winddir, weathermap[wx][wy].windspeed);       weathermap[wx][wy].winddir, weathermap[wx][wy].windspeed);
  new_draw_info_format(NDI_UNIQUE, 0, op, "Pressure: %d",  
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
         "Pressure: %d",
         "Pressure: %d",
      weathermap[wx][wy].pressure);       weathermap[wx][wy].pressure);
  new_draw_info_format(NDI_UNIQUE, 0, op, "Avg Elevation: %d",  
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
         "Avg Elevation: %d",
         "Avg Elevation: %d",
      weathermap[wx][wy].avgelev);       weathermap[wx][wy].avgelev);
  new_draw_info_format(NDI_UNIQUE, 0, op, "Rainfall: %d  Water: %d",  
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
         "Rainfall: %d  Water: %d",
         "Rainfall: %d  Water: %d",
      weathermap[wx][wy].rainfall, weathermap[wx][wy].water);       weathermap[wx][wy].rainfall, weathermap[wx][wy].water);
     }      }
   
     temp = real_world_temperature(op->x, op->y, op->map);      temp = real_world_temperature(op->x, op->y, op->map);
     new_draw_info_format(NDI_UNIQUE, 0, op, "It's currently %d degrees "      draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
  "Centigrade out.", temp);   "It's currently %d degrees Centigrade out.",
    "It's currently %d degrees Centigrade out.",
    temp);
   
     /* humid */      /* humid */
     if (weathermap[wx][wy].humid < 20)      if (weathermap[wx][wy].humid < 20)
  new_draw_info(NDI_UNIQUE, 0, op, "It is very dry.");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
          "It is very dry.", NULL);
     else if (weathermap[wx][wy].humid < 40)      else if (weathermap[wx][wy].humid < 40)
  new_draw_info(NDI_UNIQUE, 0, op, "It is very comfortable today.");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
          "It is very comfortable today.", NULL);
     else if (weathermap[wx][wy].humid < 60)      else if (weathermap[wx][wy].humid < 60)
  new_draw_info(NDI_UNIQUE, 0, op, "It is a bit muggy.");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
          "It is a bit muggy.", NULL);
     else if (weathermap[wx][wy].humid < 80)      else if (weathermap[wx][wy].humid < 80)
  new_draw_info(NDI_UNIQUE, 0, op, "It is muggy.");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
          "It is muggy.", NULL);
     else      else
  new_draw_info(NDI_UNIQUE, 0, op, "It is uncomfortably muggy.");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
          "It is uncomfortably muggy.", NULL);
   
     /* wind */      /* wind */
     switch (weathermap[wx][wy].winddir) {      switch (weathermap[wx][wy].winddir) {
     case 1: sprintf(buf, "north"); break;   case 1: strcpy(buf, "north");     break;
     case 2: sprintf(buf, "northeast"); break;   case 2: strcpy(buf, "northeast");   break;
     case 3: sprintf(buf, "east"); break;   case 3: strcpy(buf, "east");     break;
     case 4: sprintf(buf, "southeast"); break;   case 4: strcpy(buf, "southeast");   break;
     case 5: sprintf(buf, "south"); break;   case 5: strcpy(buf, "south");     break;
     case 6: sprintf(buf, "southwest"); break;   case 6: strcpy(buf, "southwest");   break;
     case 7: sprintf(buf, "west"); break;   case 7: strcpy(buf, "west");     break;
     case 8: sprintf(buf, "northwest"); break;   case 8: strcpy(buf, "northwest");   break;
     }      }
     if (weathermap[wx][wy].windspeed < 5)      if (weathermap[wx][wy].windspeed < 5)
  new_draw_info_format(NDI_UNIQUE, 0, op, "There is a mild breeze "   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "coming from the %s.", buf);        "There is a mild breeze coming from the %s.",
         "There is a mild breeze coming from the %s.",
         buf);
     else if (weathermap[wx][wy].windspeed < 10)      else if (weathermap[wx][wy].windspeed < 10)
  new_draw_info_format(NDI_UNIQUE, 0, op, "There is a strong breeze "   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "coming from the %s.", buf);         "There is a strong breeze coming from the %s.",
          "There is a strong breeze coming from the %s.",
          buf);
     else if (weathermap[wx][wy].windspeed < 15)      else if (weathermap[wx][wy].windspeed < 15)
  new_draw_info_format(NDI_UNIQUE, 0, op, "There is a light wind "   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "coming from the %s.", buf);        "There is a light wind coming from the %s.",
         "There is a light wind coming from the %s.",
         buf);
     else if (weathermap[wx][wy].windspeed < 25)      else if (weathermap[wx][wy].windspeed < 25)
  new_draw_info_format(NDI_UNIQUE, 0, op, "There is a strong wind "   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "coming from the %s.", buf);        "There is a strong wind coming from the %s.",
         "There is a strong wind coming from the %s.",
         buf);
     else if (weathermap[wx][wy].windspeed < 35)      else if (weathermap[wx][wy].windspeed < 35)
  new_draw_info_format(NDI_UNIQUE, 0, op, "There is a heavy wind "   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "coming from the %s.", buf);        "There is a heavy wind coming from the %s.",
         "There is a heavy wind coming from the %s.",
         buf);
     else      else
  new_draw_info_format(NDI_UNIQUE, 0, op, "The wind from the %s is "   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "incredibly strong!", buf);        "The wind from the %s is incredibly strong!",
         "The wind from the %s is incredibly strong!",
         buf);
   
     sky = weathermap[wx][wy].sky;      sky = weathermap[wx][wy].sky;
     if (temp <= 0 && sky > SKY_OVERCAST && sky < SKY_FOG)      if (temp <= 0 && sky > SKY_OVERCAST && sky < SKY_FOG)
  sky += 10; /*let it snow*/   sky += 10; /*let it snow*/
   
     switch (sky) {      switch (sky) {
     case SKY_CLEAR: new_draw_info(NDI_UNIQUE, 0, op, "There isn''t a cloud in the sky."); break;   case SKY_CLEAR:
     case SKY_LIGHTCLOUD: new_draw_info(NDI_UNIQUE, 0, op, "There are a few light clouds in the sky."); break;       draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
     case SKY_OVERCAST: new_draw_info(NDI_UNIQUE, 0, op, "The sky is cloudy and dreary."); break;     "There isn't a cloud in the sky.", NULL);
     case SKY_LIGHT_RAIN: new_draw_info(NDI_UNIQUE, 0, op, "It is raining softly."); break;       break;
     case SKY_RAIN: new_draw_info(NDI_UNIQUE, 0, op, "It is raining."); break;   case SKY_LIGHTCLOUD:
     case SKY_HEAVY_RAIN: new_draw_info(NDI_UNIQUE, 0, op, "It is raining heavily."); break;       draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
     case SKY_HURRICANE: new_draw_info(NDI_UNIQUE, 0, op, "There is a heavy storm!  You should go inside!"); break;     "There are a few light clouds in the sky", NULL);
     case SKY_FOG: new_draw_info(NDI_UNIQUE, 0, op, "It''s foggy and miserable."); break;       break;
     case SKY_HAIL: new_draw_info(NDI_UNIQUE, 0, op, "It''s hailing out!  Take cover!"); break;   case SKY_OVERCAST:
     case SKY_LIGHT_SNOW: new_draw_info(NDI_UNIQUE, 0, op, "Snow is gently falling from the sky."); break;       draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
     case SKY_SNOW: new_draw_info(NDI_UNIQUE, 0, op, "It''s snowing out."); break;      "The sky is cloudy and dreary.", NULL);
     case SKY_HEAVY_SNOW: new_draw_info(NDI_UNIQUE, 0, op, "The snow is falling very heavily now."); break;       break;
     case SKY_BLIZZARD: new_draw_info(NDI_UNIQUE, 0, op, "A full blown blizzard is in effect.  You might want to take cover!"); break;   case SKY_LIGHT_RAIN:
        draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "It is raining softly.", NULL);
        break;
    case SKY_RAIN:
        draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "It is raining.", NULL);
        break;
    case SKY_HEAVY_RAIN:
        draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "It is raining heavily.", NULL);
        break;
    case SKY_HURRICANE:
        draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "There is a heavy storm!  You should go inside!", NULL);
        break;
    case SKY_FOG:
        draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
       "It's foggy and miserable.", NULL);
        break;
    case SKY_HAIL:
        draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "It's hailing out!  Take cover!", NULL);
        break;
    case SKY_LIGHT_SNOW:
        draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "Snow is gently falling from the sky.", NULL);
        break;
    case SKY_SNOW:
        draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "It is snowing out.", NULL);
        break;
    case SKY_HEAVY_SNOW:
        draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "Snow is falling very heavily.", NULL);
        break;
    case SKY_BLIZZARD:
        draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_WEATHER,
      "A full blown blizzard is in effect.  You might want to take cover!", NULL);
        break;
     }      }
     return 1;      return 1;
 }  }
Line 655
 
Line 846
 int command_debug (object *op, char *params)  int command_debug (object *op, char *params)
 {  {
     int i;      int i;
     char buf[MAX_BUF];  
   if(params==NULL || !sscanf(params, "%d", &i)) {    if(params==NULL || !sscanf(params, "%d", &i)) {
       sprintf(buf,"Global debug level is %d.",settings.debug);   draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
       new_draw_info(NDI_UNIQUE, 0,op,buf);   "Global debug level is %d.",
    "Global debug level is %d.",
    settings.debug);
       return 1;        return 1;
     }      }
   if(op != NULL && !QUERY_FLAG(op, FLAG_WIZ)) {    if(op != NULL && !QUERY_FLAG(op, FLAG_WIZ)) {
       new_draw_info(NDI_UNIQUE, 0,op,"Privileged command.");   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "Debug is a privileged command.", NULL);
       return 1;        return 1;
     }      }
     settings.debug = (enum LogLevel) FABS(i);      settings.debug = (enum LogLevel) FABS(i);
     sprintf(buf,"Set debug level to %d.", i);      draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
     new_draw_info(NDI_UNIQUE, 0,op,buf);   "Debug level set to %d.",
    "Debug level set to %d.",
    i);
     return 1;      return 1;
   }    }
   
Line 680
 
Line 876
 {  {
   if (op && op->below) {    if (op && op->below) {
    dump_object(op->below);     dump_object(op->below);
    new_draw_info(NDI_UNIQUE, 0,op,errmsg);   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE, errmsg, NULL);
   
       /* Let's push that item on the dm's stack */        /* Let's push that item on the dm's stack */
       dm_stack_push( op->contr, op->below->count );        dm_stack_push( op->contr, op->below->count );
       }        }
Line 700
 
Line 897
     i =onoff_value(params);      i =onoff_value(params);
   
   if (i) {    if (i) {
           new_draw_info(NDI_UNIQUE, 0,op, "You will now walk through walls.\n");   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "You will now walk through walls.\n", NULL);
    SET_FLAG(op, FLAG_WIZPASS);     SET_FLAG(op, FLAG_WIZPASS);
   } else {    } else {
     new_draw_info(NDI_UNIQUE, 0,op, "You will now be stopped by walls.\n");   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "You will now be stopped by walls.\n", NULL);
     CLEAR_FLAG(op, FLAG_WIZPASS);      CLEAR_FLAG(op, FLAG_WIZPASS);
   }    }
   return 0;    return 0;
Line 722
 
Line 921
     i = onoff_value(params);      i = onoff_value(params);
   
   if (i) {    if (i) {
     new_draw_info(NDI_UNIQUE, 0, op, "You can now cast spells anywhere.");   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "You can now cast spells anywhere.", NULL);
     SET_FLAG(op, FLAG_WIZCAST);      SET_FLAG(op, FLAG_WIZCAST);
   } else {    } else {
     new_draw_info(NDI_UNIQUE, 0, op, "You now cannot cast spells in no-magic areas.");   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "You now cannot cast spells in no-magic areas.", NULL);
     CLEAR_FLAG(op, FLAG_WIZCAST);      CLEAR_FLAG(op, FLAG_WIZCAST);
   }    }
   return 0;    return 0;
Line 783
 
Line 984
 }  }
   
   
 #ifndef BUG_LOG  
 #define BUG_LOG "bug_log"  
 #endif  
 void bug_report(const char * reportstring){  
   FILE * fp;  
   if((fp = fopen( BUG_LOG , "a")) != NULL){  
       fprintf(fp,"%s\n", reportstring);  
       fclose(fp);  
   } else {  
       LOG(llevError, "Cannot write bugs file %s: %s\n", BUG_LOG, strerror_local(errno));  
   }  
 }  
   
 int command_output_sync(object *op, char *params)  int command_output_sync(object *op, char *params)
 {  {
     int val;      int val;
   
     if (!params) {      if (!params) {
  new_draw_info_format(NDI_UNIQUE, 0, op,   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  "Output sync time is presently %d", op->contr->outputs_sync);        "Output sync time is presently %d",
         "Output sync time is presently %d",
         op->contr->outputs_sync);
  return 1;   return 1;
     }      }
     val=atoi(params);      val=atoi(params);
     if (val>0) {      if (val>0) {
  op->contr->outputs_sync = val;   op->contr->outputs_sync = val;
  new_draw_info_format(NDI_UNIQUE, 0, op,   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  "Output sync time now set to %d", op->contr->outputs_sync);        "Output sync time now set to %d",
         "Output sync time now set to %d",
         op->contr->outputs_sync);
     }      }
     else      else
  new_draw_info(NDI_UNIQUE, 0, op,"Invalid value for output_sync.");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "Invalid value for output_sync.", NULL);
   
     return 1;      return 1;
 }  }
Line 822
 
Line 1015
     int val;      int val;
   
     if (!params) {      if (!params) {
  new_draw_info_format(NDI_UNIQUE, 0, op,   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  "Output count is presently %d", op->contr->outputs_count);        "Output count is presently %d",
         "Output count is presently %d",
         op->contr->outputs_count);
  return 1;   return 1;
     }      }
     val=atoi(params);      val=atoi(params);
     if (val>0) {      if (val>0) {
  op->contr->outputs_count = val;   op->contr->outputs_count = val;
  new_draw_info_format(NDI_UNIQUE, 0, op,   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  "Output count now set to %d", op->contr->outputs_count);        "Output count now set to %d",
         "Output count now set to %d",
         op->contr->outputs_count);
     }      }
     else      else
  new_draw_info(NDI_UNIQUE, 0, op,"Invalid value for output_count.");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "Invalid value for output_count.", NULL);
   
     return 1;      return 1;
 }  }
Line 843
 
Line 1041
   int i;    int i;
   
   if(params==NULL || !sscanf(params, "%d", &i)) {    if(params==NULL || !sscanf(params, "%d", &i)) {
     new_draw_info_format(NDI_UNIQUE, 0, op,   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  "Set listen to what (presently %d)?", op->contr->listening);        "Set listen to what (presently %d)?",
         "Set listen to what (presently %d)?",
         op->contr->listening);
       return 1;        return 1;
     }      }
     op->contr->listening=(char) i;      op->contr->listening=(char) i;
     new_draw_info_format(NDI_UNIQUE, 0, op,      draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  "Your verbose level is now %d.",i);   "Your verbose level is now %d.",
    "Your verbose level is now %d.",
      i);
     return 1;      return 1;
 }  }
   
Line 862
 
Line 1064
 int command_statistics(object *pl, char *params)  int command_statistics(object *pl, char *params)
 {  {
     if (!pl->contr) return 1;      if (!pl->contr) return 1;
 #ifndef WIN32  
     new_draw_info_format(NDI_UNIQUE, 0, pl,"  Experience: %lld",pl->stats.exp);  
     new_draw_info_format(NDI_UNIQUE, 0, pl,"  Next Level: %lld",level_exp(pl->level+1, pl->expmul));  
 #else  
     new_draw_info_format(NDI_UNIQUE, 0, pl,"  Experience: %I64d",pl->stats.exp);  
     new_draw_info_format(NDI_UNIQUE, 0, pl,"  Next Level: %I64d",level_exp(pl->level+1, pl->expmul));  
 #endif  
     new_draw_info(NDI_UNIQUE, 0, pl,       "\nStat       Nat/Real/Max");  
   
     new_draw_info_format(NDI_UNIQUE, 0, pl, "Str         %2d/ %3d/%3d",      draw_ext_info_format(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_STATISTICS,
    "[fixed]  Experience: " FMT64,
    "  Experience: " FMT64,
    pl->stats.exp);
       draw_ext_info_format(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_STATISTICS,
    "[fixed]  Next Level: " FMT64,
    "  Next Level: " FMT64,
    level_exp(pl->level+1, pl->expmul));
   
       draw_ext_info(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_STATISTICS,
      "[fixed]\nStat       Nat/Real/Max",
      "\nStat       Nat/Real/Max");
   
       draw_ext_info_format(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_STATISTICS,
    "[fixed]Str         %2d/ %3d/%3d",
    "Str         %2d/ %3d/%3d",
  pl->contr->orig_stats.Str, pl->stats.Str, 20+pl->arch->clone.stats.Str);   pl->contr->orig_stats.Str, pl->stats.Str, 20+pl->arch->clone.stats.Str);
     new_draw_info_format(NDI_UNIQUE, 0, pl, "Dex         %2d/ %3d/%3d",      draw_ext_info_format(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_STATISTICS,
    "[fixed]Dex         %2d/ %3d/%3d",
    "Dex         %2d/ %3d/%3d",
  pl->contr->orig_stats.Dex, pl->stats.Dex, 20+pl->arch->clone.stats.Dex);   pl->contr->orig_stats.Dex, pl->stats.Dex, 20+pl->arch->clone.stats.Dex);
     new_draw_info_format(NDI_UNIQUE, 0, pl, "Con         %2d/ %3d/%3d",      draw_ext_info_format(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_STATISTICS,
    "[fixed]Con         %2d/ %3d/%3d",
    "Con         %2d/ %3d/%3d",
  pl->contr->orig_stats.Con, pl->stats.Con, 20+pl->arch->clone.stats.Con);   pl->contr->orig_stats.Con, pl->stats.Con, 20+pl->arch->clone.stats.Con);
     new_draw_info_format(NDI_UNIQUE, 0, pl, "Int         %2d/ %3d/%3d",      draw_ext_info_format(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_STATISTICS,
    "[fixed]Int         %2d/ %3d/%3d",
    "Int         %2d/ %3d/%3d",
  pl->contr->orig_stats.Int, pl->stats.Int, 20+pl->arch->clone.stats.Int);   pl->contr->orig_stats.Int, pl->stats.Int, 20+pl->arch->clone.stats.Int);
     new_draw_info_format(NDI_UNIQUE, 0, pl, "Wis         %2d/ %3d/%3d",      draw_ext_info_format(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_STATISTICS,
    "[fixed]Wis         %2d/ %3d/%3d",
    "Wis         %2d/ %3d/%3d",
  pl->contr->orig_stats.Wis, pl->stats.Wis, 20+pl->arch->clone.stats.Wis);   pl->contr->orig_stats.Wis, pl->stats.Wis, 20+pl->arch->clone.stats.Wis);
     new_draw_info_format(NDI_UNIQUE, 0, pl, "Pow         %2d/ %3d/%3d",      draw_ext_info_format(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_STATISTICS,
    "[fixed]Pow         %2d/ %3d/%3d",
    "Pow         %2d/ %3d/%3d",
  pl->contr->orig_stats.Pow, pl->stats.Pow, 20+pl->arch->clone.stats.Pow);   pl->contr->orig_stats.Pow, pl->stats.Pow, 20+pl->arch->clone.stats.Pow);
     new_draw_info_format(NDI_UNIQUE, 0, pl, "Cha         %2d/ %3d/%3d",      draw_ext_info_format(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_STATISTICS,
    "[fixed]Cha         %2d/ %3d/%3d",
    "Cha         %2d/ %3d/%3d",
  pl->contr->orig_stats.Cha, pl->stats.Cha, 20+pl->arch->clone.stats.Cha);   pl->contr->orig_stats.Cha, pl->stats.Cha, 20+pl->arch->clone.stats.Cha);
     new_draw_info_format(NDI_UNIQUE, 0, pl, "\nAttack Mode: %s",pl->contr->peaceful? "Peaceful":"Hostile");      draw_ext_info_format(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_STATISTICS,
    "\nAttack Mode: %s",
    "\nAttack Mode: %s",
    pl->contr->peaceful? "Peaceful":"Hostile");
   
    /* Can't think of anything else to print right now */     /* Can't think of anything else to print right now */
    return 0;     return 0;
Line 922
 
Line 1146
              * if ((Stat.st_mode & S_IFMT)==S_IFDIR) {               * if ((Stat.st_mode & S_IFMT)==S_IFDIR) {
              */               */
             if (S_ISDIR(Stat.st_mode)){              if (S_ISDIR(Stat.st_mode)){
  char buf2[MAX_BUF];  
  struct tm *tm=localtime(&Stat.st_mtime);   struct tm *tm=localtime(&Stat.st_mtime);
  sprintf(buf2,"%s\t%04d %02d %02d %02d %02d %02d",  
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
              "[fixed]%s\t%04d %02d %02d %02d %02d %02d",
              "%s\t%04d %02d %02d %02d %02d %02d",
    Entry->d_name,     Entry->d_name,
    1900+tm->tm_year,     1900+tm->tm_year,
    1+tm->tm_mon,     1+tm->tm_mon,
Line 932
 
Line 1158
    tm->tm_hour,     tm->tm_hour,
    tm->tm_min,     tm->tm_min,
    tm->tm_sec);     tm->tm_sec);
  new_draw_info(NDI_UNIQUE, 0, op, buf2);  
      }       }
  }   }
      }       }
Line 953
 
Line 1178
     for(i=2; i<socket_info.allocated_sockets; i++) {      for(i=2; i<socket_info.allocated_sockets; i++) {
  if (init_sockets[i].old_mode == Old_Listen) {   if (init_sockets[i].old_mode == Old_Listen) {
      if (first) {       if (first) {
  new_draw_info(NDI_UNIQUE,0,op,"Kill-logs are sent to:");   draw_ext_info(NDI_UNIQUE,0,op,MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "Kill-logs are sent to:", NULL);
  first=0;   first=0;
      }       }
      new_draw_info_format(NDI_UNIQUE, 0, op, "%s: %s",       draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
    "%s: %s",
    "%s: %s",
  init_sockets[i].host,init_sockets[i].comment);   init_sockets[i].host,init_sockets[i].comment);
  }   }
     }      }
     if (first) {      if (first) {
  new_draw_info(NDI_UNIQUE,0,op,"Nobody is currently logging kills.");   draw_ext_info(NDI_UNIQUE,0,op,MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "Nobody is currently logging kills.", NULL);
     }      }
     return 1;      return 1;
 }  }
Line 972
 
Line 1201
     static const char* const types[]={"nochoice", "never", "always"};      static const char* const types[]={"nochoice", "never", "always"};
   
     if (!params) {      if (!params) {
  new_draw_info_format(NDI_UNIQUE, 0, op, "applymode is set to %s",   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
         "applymode is set to %s",
         "applymode is set to %s",
  types[op->contr->unapply]);   types[op->contr->unapply]);
  return 1;   return 1;
     }      }
Line 984
 
Line 1215
     else if (!strcmp(params,"always"))       else if (!strcmp(params,"always"))
  op->contr->unapply=unapply_always;   op->contr->unapply=unapply_always;
     else {      else {
  new_draw_info_format(NDI_UNIQUE, 0, op,   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
         "applymode: Unknown options %s, valid options are nochoice, never, always",
      "applymode: Unknown options %s, valid options are nochoice, never, always",       "applymode: Unknown options %s, valid options are nochoice, never, always",
       params);        params);
  return 0;   return 0;
     }      }
     new_draw_info_format(NDI_UNIQUE, 0, op, "Applymode %s set to %s",      draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
    "Applymode %s set to %s",
    "Applymode %s set to %s",
  (unapply==op->contr->unapply?"":" now"),   (unapply==op->contr->unapply?"":" now"),
  types[op->contr->unapply]);   types[op->contr->unapply]);
   
     return 1;      return 1;
 }  }
   
Line 1006
 
Line 1241
     int i, found;      int i, found;
   
     if (!params) {      if (!params) {
  new_draw_info_format(NDI_UNIQUE, 0, op, "bowmode is set to %s",   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
         "bowmode is set to %s",
         "bowmode is set to %s",
  types[op->contr->bowtype]);   types[op->contr->bowtype]);
  return 1;   return 1;
     }      }
Line 1028
 
Line 1265
      else       else
  strcat(buf, ".");   strcat(buf, ".");
  }   }
  new_draw_info_format(NDI_UNIQUE, 0, op, buf);   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG, buf, NULL);
  return 0;   return 0;
     }      }
     new_draw_info_format(NDI_UNIQUE, 0, op, "bowmode %s set to %s",      draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
    "bowmode %s set to %s",
    "bowmode %s set to %s",
  (oldtype==op->contr->bowtype?"":"now"),   (oldtype==op->contr->bowtype?"":"now"),
  types[op->contr->bowtype]);   types[op->contr->bowtype]);
     return 1;      return 1;
Line 1043
 
Line 1282
     static const char* const types[]={"normal", "sad", "defend", "arena"};      static const char* const types[]={"normal", "sad", "defend", "arena"};
   
     if (!params) {      if (!params) {
  new_draw_info_format(NDI_UNIQUE, 0, op, "petmode is set to %s",   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
         "petmode is set to %s",
         "petmode is set to %s",
  types[op->contr->petmode]);   types[op->contr->petmode]);
  return 1;   return 1;
     }      }
Line 1057
 
Line 1298
     else if (!strcmp(params,"arena"))       else if (!strcmp(params,"arena"))
  op->contr->petmode=pet_arena;   op->contr->petmode=pet_arena;
     else {      else {
  new_draw_info_format(NDI_UNIQUE, 0, op,   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
      "petmode: Unknown options %s, valid options are normal,"       "petmode: Unknown options %s, valid options are normal, sad (seek and destroy), defend, arena",
      "sad (seek and destroy), defend, arena", params);       "petmode: Unknown options %s, valid options are normal, sad (seek and destroy), defend, arena",
         params);
  return 0;   return 0;
     }      }
     new_draw_info_format(NDI_UNIQUE, 0, op, "petmode %s set to %s",      draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
    "petmode %s set to %s",
    "petmode %s set to %s",
  (oldtype==op->contr->petmode?"":"now"),   (oldtype==op->contr->petmode?"":"now"),
  types[op->contr->petmode]);   types[op->contr->petmode]);
     return 1;      return 1;
Line 1074
 
Line 1318
     int counter=0, target=0;      int counter=0, target=0;
     int have_shown_pet=0;      int have_shown_pet=0;
     if (params !=NULL) target= atoi(params);      if (params !=NULL) target= atoi(params);
   
     for (obl = first_friendly_object; obl != NULL; obl = next) {      for (obl = first_friendly_object; obl != NULL; obl = next) {
     object *ob = obl->ob;      object *ob = obl->ob;
     next = obl->next;      next = obl->next;
     if (get_owner(ob) == op) {      if (get_owner(ob) == op) {
      if (target ==0) {       if (target ==0) {
      if (counter==0)       if (counter==0)
      new_draw_info(NDI_UNIQUE, 0, op, "Pets:");        draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  new_draw_info_format(NDI_UNIQUE, 0, op, "%d  %s - level %d", ++counter, ob->name, ob->level );     "Pets:", NULL);
    draw_ext_info_format(NDI_UNIQUE, 0, op,  MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
         "%d  %s - level %d",
         "%d  %s - level %d",
         ++counter, ob->name, ob->level );
      }        }
      else if (!have_shown_pet && ++counter==target) {       else if (!have_shown_pet && ++counter==target) {
      new_draw_info_format(NDI_UNIQUE, 0, op, "level %d %s", ob->level, ob->name);       draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  new_draw_info_format(NDI_UNIQUE, 0, op, "%d/%d HP, %d/%d SP",        "[fixed]level %d %s",
         "level %d %s",
         ob->level, ob->name);
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
         "[fixed]%d/%d HP, %d/%d SP",
         "%d/%d HP, %d/%d SP",
      ob->stats.hp, ob->stats.maxhp, ob->stats.sp, ob->stats.maxsp);       ob->stats.hp, ob->stats.maxhp, ob->stats.sp, ob->stats.maxsp);
   
  /* this is not a nice way to do this, it should be made to be more like the statistics command */   /* this is not a nice way to do this, it should be made to be more like the statistics command */
  new_draw_info_format(NDI_UNIQUE, 0, op, "Str %d", ob->stats.Str);   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  new_draw_info_format(NDI_UNIQUE, 0, op, "Dex %d", ob->stats.Dex);        "[fixed]Str %d",
  new_draw_info_format(NDI_UNIQUE, 0, op, "Con %d", ob->stats.Con);        "Str %d",
  new_draw_info_format(NDI_UNIQUE, 0, op, "Int %d", ob->stats.Int);        ob->stats.Str);
  new_draw_info_format(NDI_UNIQUE, 0, op, "Wis %d", ob->stats.Wis);   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
  new_draw_info_format(NDI_UNIQUE, 0, op, "Cha %d", ob->stats.Cha);        "[fixed]Dex %d",
  new_draw_info_format(NDI_UNIQUE, 0, op, "Pow %d", ob->stats.Pow);        "Dex %d",
  new_draw_info_format(NDI_UNIQUE, 0, op, "wc %d  damage %d ac %d ",         ob->stats.Dex);
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
         "[fixed]Con %d",
         "Con %d",
         ob->stats.Con);
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
         "[fixed]Int %d",
         "Int %d",
         ob->stats.Int);
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
         "[fixed]Wis %d",
         "Wis %d",
         ob->stats.Wis);
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
         "[fixed]Cha %d",
         "Cha %d",
         ob->stats.Cha);
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
         "[fixed]Pow %d",
         "Pow %d",
         ob->stats.Pow);
    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
         "[fixed]wc %d  damage %d ac %d ",
         "wc %d  damage %d ac %d ",
      ob->stats.wc, ob->stats.dam, ob->stats.ac);       ob->stats.wc, ob->stats.dam, ob->stats.ac);
  have_shown_pet=1;   have_shown_pet=1;
      }       }
  }   }
     }      }
     if (counter == 0)       if (counter == 0)
     new_draw_info(NDI_UNIQUE, 0, op, "you have no pets.");      draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "you have no pets.", NULL);
     else if (target !=0 && have_shown_pet==0)      else if (target !=0 && have_shown_pet==0)
     new_draw_info(NDI_UNIQUE, 0, op, "no such pet.");      draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "no such pet.", NULL);
     return 0;      return 0;
 }  }
   
Line 1114
 
Line 1394
     static const char* const types[]={"inventory", "keyrings", "containers"};      static const char* const types[]={"inventory", "keyrings", "containers"};
   
     if (!params) {      if (!params) {
  new_draw_info_format(NDI_UNIQUE, 0, op, "usekeys is set to %s",   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
         "usekeys is set to %s",
         "usekeys is set to %s",
  types[op->contr->usekeys]);   types[op->contr->usekeys]);
  return 1;   return 1;
     }      }
Line 1126
 
Line 1408
     else if (!strcmp(params,"containers"))       else if (!strcmp(params,"containers"))
  op->contr->usekeys=containers;   op->contr->usekeys=containers;
     else {      else {
  new_draw_info_format(NDI_UNIQUE, 0, op,   draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
        "usekeys: Unknown options %s, valid options are inventory, keyrings, containers",
      "usekeys: Unknown options %s, valid options are inventory, keyrings, containers",       "usekeys: Unknown options %s, valid options are inventory, keyrings, containers",
       params);        params);
  return 0;   return 0;
     }      }
     new_draw_info_format(NDI_UNIQUE, 0, op, "usekeys %s set to %s",      draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
    "usekeys %s set to %s",
    "usekeys %s set to %s",
  (oldtype==op->contr->usekeys?"":"now"),   (oldtype==op->contr->usekeys?"":"now"),
  types[op->contr->usekeys]);   types[op->contr->usekeys]);
   
     return 1;      return 1;
 }  }
   
Line 1146
 
Line 1432
     for (i=0; i<NROFATTACKS; i++) {      for (i=0; i<NROFATTACKS; i++) {
  if (i==ATNR_INTERNAL) continue;   if (i==ATNR_INTERNAL) continue;
   
  new_draw_info_format(NDI_UNIQUE, 0, op, "%-20s %+5d",    draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
         "[fixed]%-20s %+5d",
         "%-20s %+5d",
  attacktype_desc[i], op->resist[i]);   attacktype_desc[i], op->resist[i]);
     }      }
   
     /* If dragon player, let's display natural resistances */      /* If dragon player, let's display natural resistances */
     if ( is_dragon_pl( op ) )      if ( is_dragon_pl( op ) ) {
         {  
         int attack;          int attack;
         object* tmp;          object* tmp;
         for ( tmp = op->inv; tmp != NULL; tmp = tmp->below )  
             {          for ( tmp = op->inv; tmp != NULL; tmp = tmp->below ) {
             if ( ( tmp->type == FORCE ) && ( strcmp( tmp->arch->name, "dragon_skin_force" )== 0 ) )              if ( ( tmp->type == FORCE ) && ( strcmp( tmp->arch->name, "dragon_skin_force" )== 0 ) ) {
                 {                  draw_ext_info( NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
                 new_draw_info( NDI_UNIQUE, 0, op, "\nNatural skin resistances:" );         "\nNatural skin resistances:", NULL);
                 for ( attack = 0; attack < NROFATTACKS; attack++ )  
                     {                  for ( attack = 0; attack < NROFATTACKS; attack++ ) {
                     if ( atnr_is_dragon_enabled( attack ) )                      if ( atnr_is_dragon_enabled( attack ) ) {
                         {                          draw_ext_info_format( NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
                         new_draw_info_format( NDI_UNIQUE, 0, op, "%s: %d", change_resist_msg[ attack ], tmp->resist[ attack ] );        "%s: %d",
         "%s: %d",
         change_resist_msg[ attack ], tmp->resist[ attack ] );
                         }                          }
                     }                      }
                 break;                  break;
Line 1183
 
Line 1472
 {  {
     DIR *dirp;      DIR *dirp;
     struct dirent *de;      struct dirent *de;
     char filename[MAX_BUF], line[80];      char filename[MAX_BUF], line[HUGE_BUF];
     int namelen, linelen=0;      int namelen;
      
     switch (what) {      switch (what) {
  case 1:   case 1:
      sprintf(filename, "%s/wizhelp", settings.datadir);       sprintf(filename, "%s/wizhelp", settings.datadir);
      new_draw_info(NDI_UNIQUE, 0,op, "      Wiz commands:");       draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
      "      Wiz commands:", NULL);
      break;       break;
  case 3:   case 3:
      sprintf(filename, "%s/mischelp", settings.datadir);       sprintf(filename, "%s/mischelp", settings.datadir);
      new_draw_info(NDI_UNIQUE, 0,op, "      Misc help:");       draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
      "      Misc help:", NULL);
      break;       break;
  default:   default:
      sprintf(filename, "%s/help", settings.datadir);       sprintf(filename, "%s/help", settings.datadir);
      new_draw_info(NDI_UNIQUE, 0,op, "      Commands:");       draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
      "      Commands:", NULL);
      break;       break;
     }      }
     if (!(dirp=opendir(filename)))      if (!(dirp=opendir(filename)))
Line 1206
 
Line 1498
     line[0] ='\0';      line[0] ='\0';
     for (de = readdir(dirp); de; de = readdir(dirp)) {      for (de = readdir(dirp); de; de = readdir(dirp)) {
  namelen = NAMLEN(de);   namelen = NAMLEN(de);
   
  if (namelen <= 2 && *de->d_name == '.' &&   if (namelen <= 2 && *de->d_name == '.' &&
  (namelen == 1 || de->d_name[1] == '.' ) )   (namelen == 1 || de->d_name[1] == '.' ) )
      continue;       continue;
  linelen +=namelen+1;  
  if (linelen > 42) {  
      new_draw_info(NDI_UNIQUE, 0,op, line);  
      sprintf(line, " %s", de->d_name);  
      linelen =namelen+1;  
      continue;  
  }  
  strcat(line, " ");  
  strcat(line, de->d_name);   strcat(line, de->d_name);
    strcat(line, " ");
     }      }
     new_draw_info(NDI_UNIQUE, 0,op, line);      draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
      line, line);
     closedir(dirp);      closedir(dirp);
 }  }
   
 static void show_commands(object *op, int what)  static void show_commands(object *op, int what)
 {  {
   char line[80];      char line[HUGE_BUF];
   int i, size, namelen, linelen=0;      int i, size, namelen;
   command_array_struct *ap;    command_array_struct *ap;
   extern command_array_struct Commands[], WizCommands[];    extern command_array_struct Commands[], WizCommands[];
   extern const int CommandsSize, WizCommandsSize;    extern const int CommandsSize, WizCommandsSize;
Line 1235
 
Line 1523
   case 1:    case 1:
     ap =WizCommands;      ap =WizCommands;
     size =WizCommandsSize;      size =WizCommandsSize;
     new_draw_info(NDI_UNIQUE, 0,op, "      Wiz commands:");       draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
      "      Wiz commands:", NULL);
     break;      break;
   
   case 2:    case 2:
     ap= CommunicationCommands;      ap= CommunicationCommands;
     size= CommunicationCommandSize;      size= CommunicationCommandSize;
     new_draw_info(NDI_UNIQUE, 0, op, "      Communication commands:");       draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
      "      Communication commands:", NULL);
     break;      break;
   
   default:    default:
     ap =Commands;      ap =Commands;
     size =CommandsSize;      size =CommandsSize;
     new_draw_info(NDI_UNIQUE, 0,op, "      Commands:");       draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
      "      Commands:", NULL);
     break;      break;
   }    }
   
   line[0] ='\0';    line[0] ='\0';
   for (i=0; i<size; i++) {    for (i=0; i<size; i++) {
     namelen = strlen(ap[i].name);      namelen = strlen(ap[i].name);
     linelen +=namelen+1;  
     if (linelen > 42) {  
       new_draw_info(NDI_UNIQUE, 0,op, line);  
       sprintf(line, " %s", ap[i].name);  
       linelen =namelen+1;  
       continue;  
     }  
     strcat(line, " ");  
     strcat(line, ap[i].name);      strcat(line, ap[i].name);
    strcat(line, " ");
   }            }       
   new_draw_info(NDI_UNIQUE, 0,op, line);      draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO, line, line);
 }  }
   
   
Line 1273
 
Line 1560
   char filename[MAX_BUF], line[MAX_BUF];    char filename[MAX_BUF], line[MAX_BUF];
   int len;    int len;
   
   if(op != NULL)  
     clear_win_info(op);  
   
 /*  /*
    * Main help page?     * Main help page?
  */   */
   
   if (!params) {    if (!params) {
     sprintf(filename, "%s/def_help", settings.datadir);      sprintf(filename, "%s/def_help", settings.datadir);
     if ((fp=fopen(filename, "r")) == NULL) {      if ((fp=fopen(filename, "r")) == NULL) {
Line 1290
 
Line 1575
       len =strlen(line)-1;        len =strlen(line)-1;
       if (line[len] == '\n')        if (line[len] == '\n')
  line[len] ='\0';   line[len] ='\0';
       new_draw_info(NDI_UNIQUE, 0,op, line);       draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO, line, NULL);
     }      }
     fclose(fp);      fclose(fp);
     return 0;      return 0;
Line 1312
 
Line 1597
    */     */
   if (!strcmp(params, "commands")) {    if (!strcmp(params, "commands")) {
     show_commands(op, 0);      show_commands(op, 0);
    draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO, "\n", NULL);
     show_commands(op, 2); /* show comm commands */      show_commands(op, 2); /* show comm commands */
     if (QUERY_FLAG(op, FLAG_WIZ))   if (QUERY_FLAG(op, FLAG_WIZ)) {
        draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO, "\n", NULL);
       show_commands(op, 1);        show_commands(op, 1);
    }
     return 0;      return 0;
   }    }
   
Line 1322
 
Line 1610
    * User wants info about command     * User wants info about command
    */     */
   if (strchr(params, '.') || strchr(params, ' ') || strchr(params, '/')) {    if (strchr(params, '.') || strchr(params, ' ') || strchr(params, '/')) {
     sprintf(line, "Illegal characters in '%s'", params);   draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
     new_draw_info(NDI_UNIQUE, 0,op, line);        "Illegal characters in '%s'",
         "Illegal characters in '%s'",
         params);
     return 0;      return 0;
   }    }
   
Line 1349
 
Line 1639
     LOG(llevError, "Cannot open help file %s: %s\n", filename, strerror_local(errno));      LOG(llevError, "Cannot open help file %s: %s\n", filename, strerror_local(errno));
     return 0;      return 0;
       }        }
   sprintf(line, "Help about '%s'", params);  
   new_draw_info(NDI_UNIQUE, 0,op, line);    draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
           "Help about '%s'",
           "Help about '%s'",
           params);
   
   while (fgets(line, MAX_BUF, fp)) {    while (fgets(line, MAX_BUF, fp)) {
     line[MAX_BUF-1] ='\0';      line[MAX_BUF-1] ='\0';
     len =strlen(line)-1;      len =strlen(line)-1;
     if (line[len] == '\n')      if (line[len] == '\n')
       line[len] ='\0';        line[len] ='\0';
     new_draw_info(NDI_UNIQUE, 0,op, line);   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO, line, NULL);
     }      }
   fclose(fp);    fclose(fp);
   return 0;    return 0;
Line 1364
 
Line 1658
   /*    /*
    * No_help -escape     * No_help -escape
    */     */
   
  nohelp:   nohelp:
   sprintf(line, "No help available on '%s'", params);  
   new_draw_info(NDI_UNIQUE, 0,op, line);      draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO,
    "No help available on '%s'",
    "No help available on '%s'",
    params);
   
   return 0;    return 0;
 }  }
   
Line 1377
 
Line 1676
   
   if (sscanf(line, "%d", &i))    if (sscanf(line, "%d", &i))
     return (i != 0);      return (i != 0);
   
   switch (line[0]) {    switch (line[0]) {
   case 'o':    case 'o':
     switch (line[1]) {      switch (line[1]) {
Line 1388
 
Line 1688
   case 's':    case 's':
   case 'd':    case 'd':
     return 1;      return 1;
   
   case 'n': /* n[o] */    case 'n': /* n[o] */
   case 'e': /* e[i] */    case 'e': /* e[i] */
   case 'u':    case 'u':
Line 1418
 
Line 1719
    * are there any cases when first_player->next==NULL and we are not solo?     * are there any cases when first_player->next==NULL and we are not solo?
    */     */
     if ((first_player!=op->contr) || (first_player->next!=NULL)) {      if ((first_player!=op->contr) || (first_player->next!=NULL)) {
  new_draw_info(NDI_UNIQUE, 0,op,"You can not enter explore mode if you are in a party");   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "You can not enter explore mode if there are other players", NULL);
     } else if (op->contr->explore)      } else if (op->contr->explore)
  new_draw_info(NDI_UNIQUE, 0,op, "There is no return from explore mode");   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "There is no return from explore mode", NULL);
     else {      else {
  op->contr->explore=1;   op->contr->explore=1;
  new_draw_info(NDI_UNIQUE, 0,op, "You are now in explore mode");   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "You are now in explore mode", NULL);
     }      }
     return 1;      return 1;
 }  }
Line 1432
 
Line 1736
 {  {
     if (op->contr->socket.sound) {      if (op->contr->socket.sound) {
         op->contr->socket.sound=0;          op->contr->socket.sound=0;
         new_draw_info(NDI_UNIQUE, 0,op, "Silence is golden...");          draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "Sounds are turned off", NULL);
     }      }
     else {      else {
         op->contr->socket.sound=1;          op->contr->socket.sound=1;
         new_draw_info(NDI_UNIQUE, 0,op, "The sounds are enabled.");          draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "The sounds are enabled.", NULL);
     }      }
     return 1;      return 1;
 }  }
Line 1454
 
Line 1760
     }      }
     FREE_AND_COPY(op->name, op->contr->write_buf+1);      FREE_AND_COPY(op->name, op->contr->write_buf+1);
     FREE_AND_COPY(op->name_pl, op->contr->write_buf+1);      FREE_AND_COPY(op->name_pl, op->contr->write_buf+1);
     new_draw_info(NDI_UNIQUE, 0,op,op->contr->write_buf);      draw_ext_info(NDI_UNIQUE, 0,op,MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE, op->contr->write_buf, NULL);
     op->contr->name_changed=1;      op->contr->name_changed=1;
     get_password(op);      get_password(op);
 }  }
Line 1462
 
Line 1768
 void receive_player_password(object *op,char k) {  void receive_player_password(object *op,char k) {
   
     unsigned int pwd_len=strlen(op->contr->write_buf);      unsigned int pwd_len=strlen(op->contr->write_buf);
   
     if(pwd_len<=1||pwd_len>17) {      if(pwd_len<=1||pwd_len>17) {
         if (op->contr->state == ST_CHANGE_PASSWORD_OLD || op->contr->state == ST_CHANGE_PASSWORD_NEW || op->contr->state == ST_CHANGE_PASSWORD_CONFIRM) {          if (op->contr->state == ST_CHANGE_PASSWORD_OLD || op->contr->state == ST_CHANGE_PASSWORD_NEW || op->contr->state == ST_CHANGE_PASSWORD_CONFIRM) {
             new_draw_info(NDI_UNIQUE, 0, op, "Password changed cancelled.");              draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
      "Password changed cancelled.", NULL);
             op->contr->state = ST_PLAYING;              op->contr->state = ST_PLAYING;
         }          }
         else          else
             get_name(op);              get_name(op);
         return;          return;
     }      }
     new_draw_info(NDI_UNIQUE, 0,op,"          "); /* To hide the password better */      /* To hide the password better */
       /* With currently clients, not sure if this is really the case - MSW */
       draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,"          ", NULL);
   
     if (checkbanned(op->name, op->contr->socket.host)) {      if (checkbanned(op->name, op->contr->socket.host)) {
         LOG(llevInfo, "Banned player tried to add: [%s@%s]\n", op->name, op->contr->socket.host);          LOG(llevInfo, "Banned player tried to add: [%s@%s]\n", op->name, op->contr->socket.host);
         new_draw_info(NDI_UNIQUE|NDI_RED, 0, op, "You are not allowed to play.");          draw_ext_info(NDI_UNIQUE|NDI_RED, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "You are not allowed to play.", NULL);
         get_name(op);          get_name(op);
         return;          return;
     }      }
   
     if(op->contr->state==ST_CONFIRM_PASSWORD) {      if(op->contr->state==ST_CONFIRM_PASSWORD) {
         if(!check_password(op->contr->write_buf+1,op->contr->password)) {          if(!check_password(op->contr->write_buf+1,op->contr->password)) {
             new_draw_info(NDI_UNIQUE, 0,op,"The passwords did not match.");              draw_ext_info(NDI_UNIQUE, 0,op,  MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
      "The passwords did not match.", NULL);
             get_name(op);              get_name(op);
             return;              return;
         }          }
         clear_win_info(op);  
         display_motd(op);          display_motd(op);
         new_draw_info(NDI_UNIQUE, 0,op," ");          draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
         new_draw_info(NDI_UNIQUE, 0,op,"Welcome, Brave New Warrior!");         "\nWelcome, Brave New Warrior!\n", NULL);
         new_draw_info(NDI_UNIQUE, 0,op," ");  
         roll_again(op);          roll_again(op);
         op->contr->state=ST_ROLL_STAT;          op->contr->state=ST_ROLL_STAT;
         return;          return;
Line 1498
 
Line 1808
   
     if (op->contr->state == ST_CHANGE_PASSWORD_OLD) {      if (op->contr->state == ST_CHANGE_PASSWORD_OLD) {
         if (!check_password(op->contr->write_buf + 1, op->contr->password)) {          if (!check_password(op->contr->write_buf + 1, op->contr->password)) {
             new_draw_info(NDI_UNIQUE, 0, op, "You entered the wrong current password.");              draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
      "You entered the wrong current password.", NULL);
             op->contr->state = ST_PLAYING;              op->contr->state = ST_PLAYING;
         } else {          } else {
             send_query(&op->contr->socket, CS_QUERY_HIDEINPUT, "Please enter your new password, or blank to cancel:");              send_query(&op->contr->socket, CS_QUERY_HIDEINPUT, "Please enter your new password, or blank to cancel:");
Line 1516
 
Line 1827
   
     if (op->contr->state == ST_CHANGE_PASSWORD_CONFIRM) {      if (op->contr->state == ST_CHANGE_PASSWORD_CONFIRM) {
         if (strcmp(crypt_string(op->contr->write_buf + 1, op->contr->new_password), op->contr->new_password)) {          if (strcmp(crypt_string(op->contr->write_buf + 1, op->contr->new_password), op->contr->new_password)) {
             new_draw_info(NDI_UNIQUE, 0, op, "The new passwords don't match!");              draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
      "The new passwords don't match!", NULL);
         } else {          } else {
         new_draw_info(NDI_UNIQUE, 0, op, "Password changed.");          draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "Password changed.", NULL);
             strncpy(op->contr->password, op->contr->new_password, 13);              strncpy(op->contr->password, op->contr->new_password, 13);
         }          }
         op->contr->state = ST_PLAYING;          op->contr->state = ST_PLAYING;
Line 1532
 
Line 1845
 }  }
   
   
 int explore_mode(void) {  
     player *pl;  
   
     if (settings.explore_mode == TRUE) {  
  for (pl = first_player; pl != (player *) NULL; pl = pl->next)  
      if (pl->explore)  
  return 1;  
     }  
     return 0;  
 }  
   
   
 int command_title (object *op, char *params)  int command_title (object *op, char *params)
 {  {
     char buf[MAX_BUF];      char buf[MAX_BUF];
          
     if (settings.set_title == FALSE) {      if (settings.set_title == FALSE) {
  new_draw_info(NDI_UNIQUE, 0, op, "You cannot change your title.");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
          "You cannot change your title.", NULL);
  return 1;   return 1;
     }      }
   
     /* dragon players cannot change titles */      /* dragon players cannot change titles */
     if (is_dragon_pl(op)) {      if (is_dragon_pl(op)) {
         new_draw_info(NDI_UNIQUE, 0, op, "Dragons cannot change titles.");          draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
          "Dragons cannot change titles.", NULL);
         return 1;          return 1;
     }      }
          
Line 1564
 
Line 1867
      sprintf(buf,"Your title is '%s'.", op->contr->title);       sprintf(buf,"Your title is '%s'.", op->contr->title);
  else   else
      sprintf(buf,"Your title is '%s'.", op->contr->own_title);       sprintf(buf,"Your title is '%s'.", op->contr->own_title);
  new_draw_info(NDI_UNIQUE, 0,op,buf);   draw_ext_info(NDI_UNIQUE, 0,op,MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,buf, NULL);
  return 1;   return 1;
     }      }
     if(strcmp(params, "clear")==0 || strcmp(params, "default")==0) {      if(strcmp(params, "clear")==0 || strcmp(params, "default")==0) {
  if(op->contr->own_title[0]=='\0')   if(op->contr->own_title[0]=='\0')
      new_draw_info(NDI_UNIQUE, 0,op,"Your title is the default title.");       draw_ext_info(NDI_UNIQUE, 0,op,MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
      "Your title is the default title.", NULL);
  else   else
      new_draw_info(NDI_UNIQUE, 0,op,"Title set to default.");       draw_ext_info(NDI_UNIQUE, 0,op,MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
      "Title set to default.", NULL);
  op->contr->own_title[0]='\0';   op->contr->own_title[0]='\0';
  return 1;   return 1;
     }      }
   
     if((int)strlen(params) >= MAX_NAME) {      if((int)strlen(params) >= MAX_NAME) {
  new_draw_info(NDI_UNIQUE, 0,op,"Title too long.");   draw_ext_info(NDI_UNIQUE, 0,op,MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
          "Title too long.", NULL);
  return 1;   return 1;
     }      }
     strcpy(op->contr->own_title, params);      strcpy(op->contr->own_title, params);
Line 1587
 
Line 1893
 int command_save (object *op, char *params)  int command_save (object *op, char *params)
 {  {
     if (get_map_flags(op->map, NULL, op->x, op->y, NULL, NULL) & P_NO_CLERIC) {      if (get_map_flags(op->map, NULL, op->x, op->y, NULL, NULL) & P_NO_CLERIC) {
  new_draw_info(NDI_UNIQUE, 0, op, "You can not save on unholy ground");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "You can not save on unholy ground", NULL);
     } else if (!op->stats.exp) {      } else if (!op->stats.exp) {
  new_draw_info(NDI_UNIQUE, 0, op, "You don't deserve to save yet.");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "You don't deserve to save yet.", NULL);
     } else {      } else {
  if(save_player(op,1))   if(save_player(op,1))
      new_draw_info(NDI_UNIQUE, 0,op,"You have been saved.");       draw_ext_info(NDI_UNIQUE, 0,op,MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
      "You have been saved.", NULL);
  else   else
      new_draw_info(NDI_UNIQUE, 0,op,"SAVE FAILED!");       draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
      "SAVE FAILED!", NULL);
     }      }
     return 1;      return 1;
 }  }
Line 1603
 
Line 1913
 int command_peaceful (object *op, char *params)  int command_peaceful (object *op, char *params)
 {  {
     if((op->contr->peaceful=!op->contr->peaceful))      if((op->contr->peaceful=!op->contr->peaceful))
  new_draw_info(NDI_UNIQUE, 0,op,"You will not attack other players.");   draw_ext_info(NDI_UNIQUE, 0,op,MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
          "You will not attack other players.", NULL);
     else      else
  new_draw_info(NDI_UNIQUE, 0,op,"You will attack other players.");   draw_ext_info(NDI_UNIQUE, 0,op,MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
          "You will attack other players.", NULL);
     return 1;      return 1;
 }  }
   
Line 1614
 
Line 1926
 int command_wimpy (object *op, char *params)  int command_wimpy (object *op, char *params)
 {  {
     int i;      int i;
     char buf[MAX_BUF];  
   
     if (params==NULL || !sscanf(params, "%d", &i)) {      if (params==NULL || !sscanf(params, "%d", &i)) {
  sprintf(buf, "Your current wimpy level is %d.", op->run_away);   draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
  new_draw_info(NDI_UNIQUE, 0,op, buf);        "Your current wimpy level is %d.",
         "Your current wimpy level is %d.",
         op->run_away);
  return 1;   return 1;
     }      }
     sprintf(buf, "Your new wimpy level is %d.", i);      draw_ext_info_format(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_CONFIG,
     new_draw_info(NDI_UNIQUE, 0,op, buf);   "Your new wimpy level is %d.",
    "Your new wimpy level is %d.",
    i);
     op->run_away = i;      op->run_away = i;
     return 1;      return 1;
 }  }
Line 1636
 
Line 1951
     op->contr->braced =onoff_value(params);      op->contr->braced =onoff_value(params);
   
   if(op->contr->braced)    if(op->contr->braced)
     new_draw_info(NDI_UNIQUE, 0,op, "You are braced.");   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "You are braced.", NULL);
   else    else
     new_draw_info(NDI_UNIQUE, 0,op, "Not braced.");   draw_ext_info(NDI_UNIQUE, 0,op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "Not braced.", NULL);
   
       fix_player(op);        fix_player(op);
   return 0;  
 }  
   
 int command_style_map_info(object *op, char *params)  
 {  
     extern mapstruct *styles;  
     mapstruct *mp;  
     int     maps_used=0, mapmem=0, objects_used=0, x,y;  
     object  *tmp;  
   
     for (mp = styles; mp!=NULL; mp=mp->next) {  
  maps_used++;  
  mapmem += MAP_WIDTH(mp)*MAP_HEIGHT(mp)*(sizeof(object *)+sizeof(MapSpace)) + sizeof(mapstruct);  
  for (x=0; x<MAP_WIDTH(mp); x++) {  
      for (y=0; y<MAP_HEIGHT(mp); y++) {  
  for (tmp=get_map_ob(mp, x, y); tmp!=NULL; tmp=tmp->above)   
      objects_used++;  
      }  
  }  
     }  
     new_draw_info_format(NDI_UNIQUE, 0, op, "Style maps loaded:    %d", maps_used);  
     new_draw_info(NDI_UNIQUE, 0, op, "Memory used, not");  
     new_draw_info_format(NDI_UNIQUE, 0, op, "including objects:    %d", mapmem);  
     new_draw_info_format(NDI_UNIQUE, 0, op, "Style objects:        %d", objects_used);  
     new_draw_info_format(NDI_UNIQUE, 0, op, "Mem for objects:      %d", objects_used * sizeof(object));  
     return 0;      return 0;
 }  }
   
Line 1675
 
Line 1968
     int counter=0, removecount=0;      int counter=0, removecount=0;
     if (params == NULL) {       if (params == NULL) {
     terminate_all_pets(op);      terminate_all_pets(op);
  new_draw_info(NDI_UNIQUE, 0, op, "Your pets have been killed.");   draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
          "Your pets have been killed.", NULL);
     }      }
     else {      else {
  int target = atoi(params);   int target = atoi(params);
Line 1692
 
Line 1986
             }              }
  }   }
  if (removecount!=0)    if (removecount!=0)
      new_draw_info_format(NDI_UNIQUE, 0, op, "killed %d pets.\n", removecount);       draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
    "killed %d pets.",
    "killed %d pets.",
    removecount);
  else   else
      new_draw_info(NDI_UNIQUE, 0, op, "Couldn't find any suitable pets to kill.\n");       draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_SUBTYPE_NONE,
      "Couldn't find any suitable pets to kill.",NULL);
     }      }
     return 0;      return 0;
 }  }
Line 1704
 
Line 2002
  **/   **/
 static void display_quest_details( object* pl, object* quest )  static void display_quest_details( object* pl, object* quest )
     {      {
 /*    object* item; */  
   
     new_draw_info_format( NDI_WHITE, 0, pl, "Quest: %s\n%s\n",      draw_ext_info_format( NDI_WHITE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_QUESTS,
         quest_get_name( quest ),   "Quest: %s\n%s\n",
         quest->lore ? quest->lore : "(no description available)" );   "Quest: %s\n%s\n",
 /*   quest_get_name( quest ), quest->lore ? quest->lore : "(no description available)" );
     for ( item = pl->inv; item; item = item->below )  
         {  
         if ( ( item != quest )  
             && ( quest_is_quest_marker( item ) )  
             && ( quest_is_same_quest( quest->slaying, item->slaying ) )  
             && ( item->lore ) )  
             {  
             new_draw_info( NDI_WHITE, 0, pl, item->lore );  
             new_draw_info( NDI_WHITE, 0, pl, "------\n" );  
             }  
         }  
      */  
     }      }
   
 /**  /**
Line 1738
 
Line 2023
     {      {
     object* item;      object* item;
   
     if ( params && !strcmp( params, "finished" ) )      if ( params && !strcmp( params, "finished" ) ) {
         {          draw_ext_info( NDI_WHITE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_QUESTS,
         new_draw_info( NDI_WHITE, 0, pl, "Completed quests:\n" );         "Completed quests:\n", NULL);
         for ( item = pl->inv; item; item = item->below )  
             {          for ( item = pl->inv; item; item = item->below ) {
             if ( quest_is_quest_marker( item, 0 ) )              if ( quest_is_quest_marker( item, 0 ) ) {
                 {                  draw_ext_info( NDI_WHITE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_QUESTS,
                 new_draw_info( NDI_WHITE, 0, pl, quest_get_name( item ) );         quest_get_name( item ), NULL );
                 new_draw_info( NDI_WHITE, 0, pl, "\n" );  
                 }                  }
             }              }
         return 1;          return 1;
         }          }
   
     if ( params )      if ( params ) {
         {          for ( item = pl->inv; item; item = item->below ) {
         for ( item = pl->inv; item; item = item->below )  
             {  
             if ( quest_is_quest_marker( item, 0 )              if ( quest_is_quest_marker( item, 0 )
                 && !strcmp( quest_get_name( item ), params ) )                  && !strcmp( quest_get_name( item ), params ) ) {
                 {  
                 display_quest_details( pl, item );                  display_quest_details( pl, item );
                 }                  }
             }              }
Line 1766
 
Line 2047
         }          }
   
     /*Display current quests */      /*Display current quests */
     new_draw_info( NDI_WHITE, 0, pl, "Current quests:\n" );      draw_ext_info( NDI_WHITE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_QUESTS,
     for ( item = pl->inv; item; item = item->below )     "Current quests:\n",NULL );
         {  
         if ( quest_is_quest_marker( item, 0 )      for ( item = pl->inv; item; item = item->below ) {
             && quest_is_in_progress( item, 0 ) )          if ( quest_is_quest_marker( item, 0 ) && quest_is_in_progress( item, 0 ) ) {
             {              draw_ext_info( NDI_WHITE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_QUESTS,
             new_draw_info( NDI_WHITE, 0, pl, quest_get_name( item ) );     quest_get_name( item ), NULL );
             new_draw_info( NDI_WHITE, 0, pl, "\n" );  
             }              }
         }          }
     return 1;      return 1;


Legend:
line(s) removed in v.1.80 
line(s) changed
 line(s) added in v.1.81

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:26