Original Post
Hey guys, it's been a while... but I need help once again. I wrote some code earlier, and it doesn't work, but I can't figure out why for the life of me... I want to write a class that loads in individual, uncompressed bitmaps by reading in the list of file names to open from an editable text file. It's a class, with a vector container inside that holds the loaded bitmaps. Here's the code. If anyone can tell me why this doesn't work, that would be great. A working example would be better, but I won't expect that much.
class skillbitmaploader
{
public:
skillbitmaploader(int a, FILE* b)
{
id = a;
textfile = b;
readstr(textfile, temp);
sscanf(temp, "Number of bitmaps: %d\n", &iteration);
//Resize to contain 9 vectors of 22 members each.
bitmaps.resize(iteration, vector<BITMAP*>(1));
for(int i = 0; i < iteration; i++)
{
readstr(textfile, temp);
strncpy(temp2, temp, (string_length(temp) -1));
bitmaps[0] = load_bitmap(temp2, NULL);
if(bitmaps[0] == NULL)
{
//exit(-1);
}
}
}
~skillbitmaploader()
{
fclose(textfile);
for(int i = 0; i < iteration; i++)
{
destroy_bitmap(bitmaps[0]);
}
}
BITMAP* returnbitmap(int c)
{
return bitmaps[c][0];
}
void* returntemp()
{
return temp2;
}
//Note the extra space between the >'s.
vector< vector<BITMAP*> > bitmaps;
protected:
FILE* textfile;
int iteration;
int id;
char temp[255];
char temp2[255];
};
FILE* fireskillbitmaps = fopen("scripts\\skills\\fireskillbitmaps.zscript", "rt");
skillbitmaploader fireskillloader(1, fireskillbitmaps);