for a while now Ive been struggling to save my maps to a file, but Ive ran into a couple of problems that I havent been able to figure out...
My map file format is as follows:
MAP HEADER
----------
TileSet Filename 1
TileSet Filename 2
.
.
----------
MAP DATA
the problem I have is with the TileSet filenames.. I can save ''em to the file, no problem, but to be able to read them from the file I needed to have the lengths of each filename, so I "solved" this by putting in an array in the map header that stores the lengths of each filename... the problem is, when I load the header, all the values in the array are 0, but everything else in the header is fine... here''s how it looks more or less:
typedef struct
{
int Width;
int Height;
int Layers;
int TileSets;
int *Lengths;
} MapHeader;
(I also tried using a static array, but the same thing happened).
So, when I do:
MapHeader hdr;
file->Read(&hdr, sizeof(MapHeader));
Width, Height, Layers, Tilesets and all those variables load correctly, but the Lengths array is all zero''d out...
any ideas on what to do? (I''ve tried changing the file format several times, but if you have a suggestion on improving the file firmat I''d like to hear it as well).
Thanks!
Luis Sempe
visual@guate.net
http://www.spheregames.com