On Sun, 2 Jun 2002, Mike wrote:
> I added a new sh_int to my char_data struct...for banking. My problem is
> that I am LOUSY with the fread and fwrite stuff in save.c. I am not
> familiar with that area of the code yet...if someone could help me out and
> tell me how to add a new field to each player file for ch->bank, i would be
> really greatful. I know how to add it to fread and fwrite, but is there
> more that I need to do? *shrugs* if you could help me out, that would be
> great.
> -tarian
>
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>
In fwrite_char add in this somewhere (I did it after gold and silver):
if (ch->bank > 0)
fprintf (fp, "Bank %d\n", ch->bank);
else
fprintf (fp, "Bank %d\n", 0);
Then, down in fread_char, add in after "case 'B'":
KEY ("Bank", ch->bank, fread_number(fp));
Thats all you need to do. The var will be stored in their pfile when they
save/quit, and when they enter the game and load the pfile, the varaible
will be read in. You might want to change the bank var to an int too.
And make sure players can't deposit/withdraw negative amounts.
-G
Prodigy Wakes
prodigy.kyndig.com 8000