Well, the only part of area files that are not linear is reading in of the types, ie. rooms, objects, etc. In mud.h, find your area structure, and addstruct area_data
{
int version;
AREA_DATA *next;
AREA_DATA *prev;
If load_area, where the AREA_DATA is initialized, you should set version to a default of 0 pArea->low_r_vnum = 0;
pArea->low_o_vnum = 0;
pArea->low_m_vnum = 0;
pArea->hi_r_vnum = 0;
pArea->hi_o_vnum = 0;
pArea->hi_m_vnum = 0;
pArea->version = 0;
Look in load_area_file in db.c, and you can add something like this:
else if (!str_cmp(word, "AUTHOR"))
load_author(tarea, fpArea);
else if (!str_cmp(word, "VERSION"))
tarea->version = fread_number(fpArea);
else if (!str_cmp(word, "FLAGS"))
Then, in fold_area you could throw in fprintf(fpout, "#AREA %s~\n\n\n\n", tarea->name);
fprintf(fpout, "#VERSION %d\n\n", AREA_VERSION);
fprintf(fpout, "#AUTHOR %s~\n\n", tarea->author);
Since the reading in is an if check, it won't crash if VERSION is not there, as opposed to load_objects, where it will.
What I did was did a global declaration for AREA_VERSION in mud.h, and just increment it when you make a code change.
So now, you could go to load_objects, and add something like this pObjIndex->name = fread_string(fp);
pObjIndex->short_descr = fread_string(fp);
pObjIndex->description = fread_string(fp);
pObjIndex->action_desc = fread_string(fp);
if ( tarea->version > 0 )
pObjIndex->creator = fread_string( fp );
pObjIndex->description[0] = UPPER(pObjIndex->description[0]);
This format give you alot of growth room for the future, as now if you need to modify your area files, it will be alot easier. You can even use this to as a marker. I made a function to read in stock SWR areas and convert them to my format, and I was able to find out very easily what I had changed and how I had to modify the stock one.
That should be all you need, hope that helps. |