[code] ascii pfiles and char creation

From: Mark Setzer (mark@setz.org)
Date: 04/23/01

Hey all,

Okay, I've been messing around with ascii playerfiles on my bpl17 mud and I
think I understand how it does business in db.c, as far as replacing the
char_to_store and store_to_char procedures, and how I can add/remove saved
values. Very cool, when it works.

The thing is, Race values aren't saving for me at character creation time.
Race is chosen early on in the char selection process and obviously I want
to save that value to the player file for that char, so I added the
appropriate lines. (I copied the code for the storing/reading of other
values in save_char and load_char, respectively.)

Plus, when the character chooses the first available race (Human), the mud
will not crash, but neither will it save the Race line to the playerfile -
it has never done so successfully.

in utils.h, the GET_RACE(ch) macro:
#define GET_RACE(ch)   ((ch)->player.race)

in db.c, the snippets from save_char and load_char:
      fbprintf(fl, "Race: %s\n", GET_RACE(ch));

     case 'R':
    if(!strcmp(tag, "Room"))
      GET_LOADROOM(ch) = num;
    if(!strcmp(tag, "Race"))
      GET_RACE(ch) = num;

Here's the gdb information:

Program received signal SIGSEGV, Segmentation fault.
0x4008d431 in _IO_vfprintf (s=0xbfffd220, format=0x80d4c48 "Race: %s\n",
    ap=0xbfffd2f0) at vfprintf.c:1259
1259    vfprintf.c: No such file or directory.
(gdb) frame 2
#2  0x808eedb in fbprintf (fbfl=0x82ee880, format=0x80d4c48 "Race: %s\n")
    at diskio.c:297
297       bytes_written = vsprintf(fbfl->ptr, format, args);
(gdb) frame 3
#3  0x807d5a2 in save_char (ch=0x82ee588, load_room=-1) at db.c:2669
2669          fbprintf(fl, "Race: %s\n", GET_RACE(ch));

I am still learning how to code for Circle and can not interpret this error,
and was hoping someone could give me a couple pointers on tracking down this
bug. Thanks,


   | 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/05/01 PST