Difference for server/c_misc.c from version 1.50 to 1.51


version 1.50 version 1.51
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_c_misc_c =   * static char *rcsid_c_misc_c =
  *   "$Id: c_misc.c,v 1.50 2005/03/20 22:23:40 majorwoo Exp $";   *   "$Id: c_misc.c,v 1.51 2005/03/22 02:39:50 majorwoo Exp $";
  */   */
   
 /*  /*
Line 250
 
Line 250
  else   else
  new_draw_info(NDI_UNIQUE, 0,op,"Heap checks out OK.");   new_draw_info(NDI_UNIQUE, 0,op,"Heap checks out OK.");
  return 1;   return 1;
 }  yea }
 #endif  #endif
   
 int command_who (object *op, char *params) {  int command_who (object *op, char *params) {
Line 270
 
Line 270
     /*local functon for qsort comparison*/      /*local functon for qsort comparison*/
     int name_cmp (chars_names *c1, chars_names *c2)      int name_cmp (chars_names *c1, chars_names *c2)
     {      {
       return strcmp (c1->namebuf, c2->namebuf);        return strcasecmp (c1->namebuf, c2->namebuf);
     }      }
          
     /*       /*
Line 292
 
Line 292
  if (pl->state==ST_PLAYING || pl->state==ST_GET_PARTY_PASSWORD) {   if (pl->state==ST_PLAYING || pl->state==ST_GET_PARTY_PASSWORD) {
   
      num_players++;       num_players++;
      chars = (chars_names *) realloc(chars, (num_players+1)*sizeof(chars_names));       chars = (chars_names *) realloc(chars, num_players*sizeof(chars_names));
      sprintf(chars[num_players].namebuf, "");  
      chars[num_players].login_order = num_players;  
             if (chars == NULL)              if (chars == NULL)
      {       {
          new_draw_info(NDI_UNIQUE, 0, op, "who failed - out of memory!");           new_draw_info(NDI_UNIQUE, 0, op, "who failed - out of memory!");
                 return 0;                  return 0;
             }               }
        sprintf(chars[num_players-1].namebuf, "");
        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++;
Line 310
 
Line 310
      if (settings.who_wiz_format[i]=='%') {       if (settings.who_wiz_format[i]=='%') {
  i++;   i++;
  get_who_escape_code_value(tmpbuf,settings.who_wiz_format[i],pl);   get_who_escape_code_value(tmpbuf,settings.who_wiz_format[i],pl);
  strcat(chars[num_players].namebuf, tmpbuf);   strcat(chars[num_players-1].namebuf, tmpbuf);
      }       }
      else if (settings.who_wiz_format[i]=='_')       else if (settings.who_wiz_format[i]=='_')
  strcat(chars[num_players].namebuf," "); /* allow '_' to be used in place of spaces */   strcat(chars[num_players-1].namebuf," "); /* allow '_' to be used in place of spaces */
      else {       else {
  sprintf(tmpbuf,"%c",settings.who_wiz_format[i]);   sprintf(tmpbuf,"%c",settings.who_wiz_format[i]);
  strcat(chars[num_players].namebuf,tmpbuf);   strcat(chars[num_players-1].namebuf,tmpbuf);
      }       }
  }   }
      }       }
Line 325
 
Line 325
      if (settings.who_format[i]=='%') {       if (settings.who_format[i]=='%') {
  i++;   i++;
  get_who_escape_code_value(tmpbuf,settings.who_format[i],pl);   get_who_escape_code_value(tmpbuf,settings.who_format[i],pl);
  strcat(chars[num_players].namebuf, tmpbuf);   strcat(chars[num_players-1].namebuf, tmpbuf);
      }       }
      else if (settings.who_format[i]=='_')       else if (settings.who_format[i]=='_')
      strcat(chars[num_players].namebuf," "); /* allow '_' to be used in place of spaces */       strcat(chars[num_players-1].namebuf," "); /* allow '_' to be used in place of spaces */
      else {       else {
  sprintf(tmpbuf,"%c",settings.who_format[i]);   sprintf(tmpbuf,"%c",settings.who_format[i]);
  strcat(chars[num_players].namebuf,tmpbuf);   strcat(chars[num_players-1].namebuf,tmpbuf);
      }       }
  }   }
      }            }    
Line 342
 
Line 342
       sprintf(players_str, "Total Players (%d) -- WIZ(%d) AFK(%d)", num_players, num_wiz, num_afk);        sprintf(players_str, "Total Players (%d) -- WIZ(%d) AFK(%d)", num_players, num_wiz, num_afk);
       new_draw_info(NDI_UNIQUE, 0, op, players_str);        new_draw_info(NDI_UNIQUE, 0, op, players_str);
     }      }
     qsort (chars, (num_players+1), sizeof(chars_names), name_cmp);      qsort (chars, num_players, sizeof(chars_names), name_cmp);
     for (i=1;i<=num_players;i++)      for (i=0;i<num_players;i++)
  new_draw_info(NDI_UNIQUE, 0, op, chars[i].namebuf);   new_draw_info(NDI_UNIQUE, 0, op, chars[i].namebuf);
     free (chars);          free (chars);   
     return 1;      return 1;


Legend:
line(s) removed in v.1.50 
line(s) changed
 line(s) added in v.1.51

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