From: George F. <geo...@me...> - 1999-08-29 16:55:54
|
On Fri, Aug 27, 1999 at 06:30:53PM -0700, Dan Gold wrote: > I have gotten load_datafile_object() working without using a nested > datafile but I think I have a hold on that aswell. I wanted to keep a > record saved to disk about which datafile index was used for each tile in a > map. If I then modify the datafile after saving the map the header file > indexes will have changed, my data will not correspond correctly to the > right index, is there some way around this? If you're using `load_datafile_object' then there shouldn't be a problem, because you're specifying the name of the object. For example: sprintf (name_buffer, "level%d", level_number); level_data = load_datafile_object ("datafile.dat", name_buffer); The indices themselves are not useful, IMHO, unless the datafile is a static one which doesn't change between compilations. You might be interested to see what I did in a Repton game I wrote. For the most part I wasn't using datafile routines -- when I wrote it, either the datafile routines didn't exist, or weren't as good as they are now, or I just didn't understand them. My routines load data using the packfile routines, and using the # notation they can load from datafiles. When you ask to load a level, you can specify a raw map file, which is then loaded as a single level, or specify a level set. A level set is described by a text file which states the names of the levels and the order they are played in, along with passwords and some other options. The text file basically contains the names of the map objects within the datafile. With the # notation, these are just like filenames -- in fact I wrote this system without datafiles in mind, to begin with. George |