#include #include #include "map.h" #include "layer.h" Map::Map(char const *path) : layers(0), nlayers(0) { char tmp[BUFSIZ]; int firstgid = 0, width = 0, height = 0, level = 0, data = 0; FILE *fp = fopen(path, "r"); if (!fp) return; while (!feof(fp)) { char str[1024]; int i, j, k; char a, b; fgets(tmp, BUFSIZ, fp); if (data) { if (--data == 0) { layers[nlayers] = new Layer(width, height, level, tmp); nlayers++; } } else if (sscanf(tmp, " GetZ(); for (int y = 0; y < 32; y++) for (int x = 0; x < 32; x++) tiler->AddTile(layers[i]->GetTile(x, y), x * 32, y * 32, z); } }