Re: Olc, ASCII pfile, player char data... :P

From: Emil Nilimaa (kyos_overlord@hotmail.com)
Date: 11/23/99


>From: "Daniel A. Koepke" <dkoepke@CALIFORNIA.COM>
>Reply-To: Circle Discussion List <CIRCLE@post.queensu.ca>
>To: CIRCLE@post.queensu.ca
>Subject: Re: Olc, ASCII pfile, player char data... :P
>Date: Mon, 22 Nov 1999 16:52:28 -0800
>
>On Mon, 22 Nov 1999, Emil Nilimaa wrote:
>
> > Hmm, yes i know im a newbie :) hehe.
> > Not sure what/how to check it :P
>
>Err, you'd check it by looking, of course.  There'll be a line like,
>
>     char line[256];
>
>That little 256 is the number of chars in the array 'line'.  Or, if it's a
>pointer ("char *line;") you'd look for a call to the CREATE() macro that
>looks like,
>
>     CREATE(line, char, 256);
>
>but I doubt it's dynamically allocated (that'd be rather pointless).  This
>would all be sitting around in the same function as that little 'while'
>loop you pasted a ways back in the thread.
>
>I hope that helps you help us in helping you...<blink>
>
>-dak
>

from the ascii player stuff 2.0 in db.c (untouched i think.)
-------------------------------------------------
int rec_count = 0, i;
  FBFILE *plr_index;
  char index_name[40], line[256], bits[64];
  char arg2[80];

  sprintf(index_name, "%s", PLR_INDEX_FILE);
  if(!(plr_index = fbopen(index_name, FB_READ))) {
    top_of_p_table = -1;
    log("No player index file!  First new char will be IMP!");
    return;
  }

  /* count the number of players in the index */
  while(fbgetline(plr_index, line))
    if(*line != '~')
      rec_count++;                  <--- 461
  fbrewind(plr_index);

  if(rec_count == 0) {
    player_table = NULL;
    top_of_p_file = top_of_p_table = -1;
    return;
  }

  CREATE(player_table, struct player_index_element, rec_count);
  for(i = 0; i < rec_count; i++) {
    fbgetline(plr_index, line);
    sscanf(line, "%ld %s %d %s %d", &player_table[i].id, arg2,
        &player_table[i].level, bits, (int *)&player_table[i].last);
    CREATE(player_table[i].name, char, strlen(arg2) + 1);
    strcpy(player_table[i].name, arg2);
    player_table[i].flags = asciiflag_conv(bits);
    top_idnum = MAX(top_idnum, player_table[i].id);
  }
  fbclose(plr_index);
  top_of_p_file = top_of_p_table = i - 1;
}
------------------------------------------------------------------
And this seem to not like more then one character in the player
index.

Seems to be something wrong as it counts the players in index...


in diskio.c (ascii 2.0 stuff, havent touched it either)
------------------------------------------------------------------
int fbgetline(FBFILE *fbfl, char *line)
{
  char *r = fbfl->ptr, *w = line;

  if(!fbfl || !line || !*fbfl->ptr)
    return FALSE;

  for(; *r && *r != '\n' && r <= fbfl->buf + fbfl->size; r++)  <- 23
    *(w++) = *r;

  while(*r == '\r' || *r == '\n')
    r++;

  *w = '\0';

  if(r > fbfl->buf + fbfl->size)
    return FALSE;
  else {
    fbfl->ptr = r;
    return TRUE;
  }
}
------------------------------------------------------------------

Gdb info can be found in some of the earlier msgs...
It points to line 461 in db.c and 23 in diskio.c
shrug...

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST