Re: Intuitive db files

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 09/06/97


On Sat, 6 Sep 1997, Rasdan wrote:

-+1. How can I make it so that old db files are compatible with the newer
-+version?

Name your new db.c as db2.c; rename all of its functions (or do it the
other way around: rename the old db.c as db2.c and rename all of its
functions).  Then at the header of your new format db files make it
check for a version number statement.  Something like:

  !version2

and if it sees that, it knows it's the new format.  If it doesn't see
that, or it sees "!version1" it knows it's the old format. :)

-+2. Exit descriptions no longer work. (Not sure how to fix it).

Uhm.  Two ways.  Either use extra-descriptions in the exit descs place,
or add a tag that applies an exit description to the last exit created.
That is, it sets a "PriorExit" variable in the while(!feof(fp) && x != '$')
type of loop whenever it encounters an "exit" field in the db file.  The
PriorExit variable equals, of course, NORTH/SOUTH/EAST/WEST/UP/DOWN.
Then the next line is read through and if it's ExitD: then it applies
the description to the exit.  If it's not, and PriorExit is not -1, then
it sets PriorExit to -1 and continues with the loop.  This prevents you
from having to supply the direction to apply the description to in the
db files; and with the ExitD: only being accepted when PriorExit is >= 0
and <= 5, it keeps the db file clean and safe. :)


--
Daniel Koepke -:- dkoepke@california.com -:-  [Shadowlord/Nether]
Think.


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



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