summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a64e75f)
raw | patch | inline | side by side (parent: a64e75f)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Tue, 6 Apr 2021 15:56:33 +0000 (18:56 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Tue, 6 Apr 2021 15:56:33 +0000 (18:56 +0300) |
src/tools/png2map/png2map.c | patch | blob | history |
index ee17a6015378494c258e4e8715afdea7c80ae7a8..c0188e20ac981c460fa7b781c43829c703e0aa21 100644 (file)
fwrite(&blk, sizeof(blk), 1, fout);
fwrite(&hdr, sizeof(hdr), 1, fout);
- blk.type = MBLK_TEXTURES;
- blk.size = sizeof(map_texture_t) * map_numtex;
- fwrite(&blk, sizeof(blk), 1, fout);
- for (int i = 0; i < map_numtex; ++i)
- fwrite(map_tex + i, sizeof(map_texture_t), 1, fout);
+ if (map_numtex > 0) {
+ blk.type = MBLK_TEXTURES;
+ blk.size = sizeof(map_texture_t) * map_numtex;
+ fwrite(&blk, sizeof(blk), 1, fout);
+ for (int i = 0; i < map_numtex; ++i)
+ fwrite(map_tex + i, sizeof(map_texture_t), 1, fout);
+ }
- blk.type = MBLK_PANELS;
- blk.size = sizeof(map_panel_t) * map_numpan;
- fwrite(&blk, sizeof(blk), 1, fout);
- for (int i = 0; i < map_numpan; ++i)
- fwrite(map_pan + i, sizeof(map_panel_t), 1, fout);
+ if (map_numpan > 0) {
+ blk.type = MBLK_PANELS;
+ blk.size = sizeof(map_panel_t) * map_numpan;
+ fwrite(&blk, sizeof(blk), 1, fout);
+ for (int i = 0; i < map_numpan; ++i)
+ fwrite(map_pan + i, sizeof(map_panel_t), 1, fout);
+ }
blk.type = MBLK_NONE;
blk.size = 0;