[LONG] [NEWBIE] Ascii Pfile loading problems

From: Jory Graham (Treimor@aol.com)
Date: 08/05/01


I have a problem where idnum 1 can log in fine after saving, yet any char
after initial character can be created, saved fine, and then when i try to
load, it says no character of that name and prompts for new char.  Here is
all code i can think of that might pertain to it. I'm using MSVC 4.0 on a
win98 system.

In interpreter.c, case CON_GET_NAME:

      if ((player_i = load_char(tmp_name, d->character)) > -1) {
    GET_PFILEPOS(d->character) = player_i;

in db.c:

int load_char(char *name, struct char_data * ch)
{
  int rec_count = 0, i, idnum;
  FILE *plr_index;
  char line[256];
  char arg2[80];


  if(!(plr_index = fopen(PLR_INDEX_FILE, "r"))) {
    return -1;
  }

  while(get_line(plr_index, line))
    if(*line != '~')
      rec_count++;
  rewind(plr_index);

  if(rec_count == 0) {
    return -1;
   }

  for(i = 0; i < rec_count; i++) {
    get_line(plr_index, line);
    sscanf(line, "%d %s", &idnum, arg2);
    for (i = 0;(*(name + i) = LOWER(*(name + i))); i++);

    if (!strcmp(arg2, name)) {
      fclose(plr_index);
      store_to_char(name, ch);
      return idnum; }
  }

  return -1;
  fclose(plr_index);
}

my plr_index:

1 aliste 10 0 992296661
2 bob 1 0 992323211
3 treimor 1 fkoqsvwyDE 997061310
~

aliste's pfile (which will load fine):

Name: Aliste
Pass: circlemud
Titl: is a newbie.
Sex : 1
Clas: 6
Cla2: 7
Cla3: 7
Levl: 10
LvCl: 100
LvC2: 100
LvC3: 100
Home: 1
Brth: 992296661
Plyd: 0
Last: 992296661
Host: 127.0.0.1
Hite: 164
Wate: 138
Alin: 0
Id  : 1
Act : 0
Aff :
Thr1: 0
Thr2: 0
Thr3: 0
Thr4: 0
Thr5: 0
Skil:
1 100
2 100
0 0
Wimp: 0
Frez: 0
Invs: 0
Room: -1
Pref: efghnow
Badp: 0
Lern: 0
Str : 500
Int : 500
Wis : 500
Dex : 500
Con : 500
Cha : 500
Hit : 12500/10000
Mana: 5100/100
Move: 5082/82
Ac  : 100
Gold: 0
Bank: 0
Exp : 100000000
Hrol: 1000
Drol: 0
Affs:
0 0 0 0 0

and Treimor's pfile (#3 according to plr_index) :

Name: Treimor
Pass: rules
Titl: the newbie! &1HELP ME!!!!&0
Sex : 1
Clas: 2
Cla2: 7
Cla3: 7
Levl: 1
LvCl: 1
LvC2: 0
LvC3: 0
Home: 1
Brth: 997061309
Plyd: 0
Last: 997061310
Host: 127.0.0.1
Hite: 161
Wate: 156
Alin: 0
Id  : 3
Act : 128
Aff :
Thr1: 0
Thr2: 0
Thr3: 0
Thr4: 0
Thr5: 0
Skil:
131 10
133 5
0 0
Wimp: 0
Frez: 0
Invs: 0
Room: -1
Pref: efghnow
Badp: 0
Hung: 24
Thir: 24
Drnk: 0
Lern: 3
Str : 11
Int : 21
Wis : 17
Dex : 17
Con : 11
Cha : 14
Hit : 80/25
Mana: 290/100
Move: 252/82
Ac  : 100
Gold: 0
Bank: 0
Exp : 10000
Hrol: 0
Drol: 0
Affs:
0 0 0 0 0

I am baffled over this, and maybe i'm looking in the total wrong direction,
and pardon me if i attached worthless information, but if anyone has had this
problem, or can direct me to an answer, it would be greatly appreciated.
Thanks.

Jory Graham
ShaduinMUD

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST