Re: [CODE] Structures, saving, initializing

From: Patrick J. Dughi (dughi@IMAXX.NET)
Date: 04/20/98

> Lets say I have the following structure
> Ok, I cannot figure out how to initialize this.
> In init_char I added
> ch->marriage.shared_bank = 0;
> ch->marriage.mate = 0;
> and so on.  It didn't work.  I get random large negative numbers for
> num_divorces, etc.

    Gee, that looks alright to me - but then again, I'd have to bet that
after your init char, you probably have something where you set
ch->marriage.mate to the previously saved value.  So, we'll want to assume
that you're doing this on characters which have this value saved, or that
you check for the existance of this value before you set it.  And, we'll
also assume that these are new characters that were created with a 0 value
set, as opposed to old chars which didn't have this value initalized
(possible - especially if you didn't rwrite the init_char additions till
after you set marriage statistics).  Otherwise, make sure that you're
within your bounds of your variables, and that when you save/read that
variable that you do appropiate checking that its a real value, else init
it to 0.

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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