struct plist *parse_player_list( ACCOUNT_DATA *account, char *list)
{
CHAR_DATA *dMob;
struct plist *p_list;
char tempbuf[MAX_STRING_LENGTH];
bool first = TRUE;
int total_time = 0;
if ((p_list = malloc(sizeof(*p_list))) == NULL)
{
bug("Parse_player_list: Cannot allocate memory", 0);
abort();
}
p_list->count = 0;
list = account->players;
while (*list != '\0')
{
char name[20];
char race[20];
char *ptr1, *ptr2;
int played = 0;
bool in_game = FALSE;
name[0] = '\0'; ptr1 = name;
race[0] = '\0'; ptr2 = race;
/* get the name */
while (*list != ' ')
*ptr1++ = *list++;
*ptr1 = '\0'; list++;
/* is that player already logged on ?? */
for (dMob = char_list; dMob; dMob = dMob->next)
{
if (IS_NPC(dMob)) continue;
if (!str_cmp(dMob->name, name))
in_game = TRUE;
}
/* get the race */
// while (*list != ' ')
while (*list && *list != ' ')
*ptr2++ = *list++;
*ptr2 = '\0'; list++;
/* get the hours */
while (*list != ' ' && *list != '\0')
{
played *= 10;
played += *list++ - '0';
}
if (*list == ' ') list++;
p_list->count++;
sprintf(tempbuf, " [%d] %-12s %-12s %5d hour%s%s\n\r",
p_list->count, name, race, played, (played == 1) ? "" : "s",
(in_game) ? " (active)" : "");
/* add up */
total_time += played;
if (first)
{
first = FALSE;
sprintf(p_list->text, "%s", tempbuf);
}
else strcat(p_list->text, tempbuf);
}
/* should we add a line with the total time ? */
if (!first)
{
sprintf(tempbuf, "%34s %5d hour%s total\n\r", " ", total_time, (total_time == 1) ? "" : "s");
strcat(p_list->text, tempbuf);
}
return p_list;
}
I tryed to log into my account.. and got this..
anyone know why?