struct zone_data {
ZONE_DATA *next;
ZONE_DATA *prev;
char *name;
AREA_DATA *first_area;
AREA_DATA *last_area;
ZONE_DATA *first_subzone;
ZONE_DATA *last_subzone;
ZONE_DATA *next_subzone;
ZONE_DATA *prev_subzone;
}
in struct area_data {
AREA_DATA *next_area;
AREA_DATA *prev_area;
}
there is no really perfect way to do this, one way i might suggest is as follows.
in your system folder you create a list zone.lst, in it you save it like follows:
#ZONE
AreaName Region of Cows
Area cowcity.are
SubArea cowcity_barn.are
SubArea cowcity_hayshed.are
Area horseville.are
SubArea horseville_racetrack.are
End
AreaName Region of The Devil
Area hell.are
SubArea hell_pits.are
End
#END
Now you fine tune your loading of zone.lst to read/save it like that, read new zones and add them to the list like follows:
LINK( new_zone, first_zone, last_zone, next, prev );
Link in the areas like follows:
LINK( area, new_zone->first_area, new_zone->last_area, next_area, prev_area );
Link in the zones like follows:
LINK( new_sub_zone, new_zone->first_subzone, new_zone->last_subzone, next_subzone, prev_subzone );
any questions ask away, one thing i might mention is that you need to load the zone list after areas have been loaded.
The reason i suggested this, is because if you mess with the area structure only, then you would need to save/load the zones stuff inside the area files, and i don't know about you but i hate messing with the area loading/saving stuff, plus if you want to fine tune your zone code you would need to redo area files over and over until you got it right. Also this way you don't have to add mutliple sub-area variables into the area_data, and this would allow for as many or as little sub_areas as you would like. |