Hi again. I'm approaching the end of my project. Before I try to figure out how to build a release version for it I'm attempting to fix all the scenarios that can cause the program to crash.
Most of these issues come from array sizes not matching files.
Currently if I load a map file that doesn't match the dimensions of my current vector<map> it will fail.
This is one of the solutions I've tried:
file = al_fopen(
4 if (al_fsize(
file) == (
std::cout << "success!";
8 for (int
h = 0;
10 for (int
w = 0;
std::cout << "File size does not match map size!\n";
al_fsize(file) Does not equal the number of elements in my array. The manual isn't very clear on this, but I was assuming the al_fsize() gets the amount of data blocks in my file.
Now, the next thing I'm considering (if there is no way to get do this with the previous method).
When I save the map file, write the map's width, and height in the first 2 blocks of the file. Then create a map that size before loading. My issue with doing this is:
If someone wanted to use my map editor files in their own program, they'd have to know about thoes first two blocks of data.
I guess the question is.
Can I get by without adding array sizes to the files?
Is adding this extra data to the files a more practical solution for me and people that are potentually using them?