map version check for loadents

master
lsalzman 2013-04-24 14:13:27 +03:00
parent 62de5eccf3
commit 79dd64c363
1 changed files with 1 additions and 1 deletions

View File

@ -45,7 +45,7 @@ bool loadents(const char *fname, vector<entity> &ents, uint *crc)
octaheader hdr;
if(f->read(&hdr, 7*sizeof(int))!=int(7*sizeof(int))) { conoutf(CON_ERROR, "map %s has malformatted header", ogzname); delete f; return false; }
lilswap(&hdr.version, 6);
if(memcmp(hdr.magic, "OCTA", 4) || hdr.worldsize <= 0|| hdr.numents < 0) { conoutf(CON_ERROR, "map %s has malformatted header", ogzname); delete f; return false; }
if(memcmp(hdr.magic, "OCTA", 4) || hdr.worldsize <= 0|| hdr.numents < 0 || hdr.version<33) { conoutf(CON_ERROR, "map %s has malformatted header", ogzname); delete f; return false; }
if(hdr.version>MAPVERSION) { conoutf(CON_ERROR, "map %s requires a newer version of Tesseract", ogzname); delete f; return false; }
if(f->read(&hdr.blendmap, sizeof(hdr) - 7*sizeof(int)) != int(sizeof(hdr) - 7*sizeof(int))) { conoutf(CON_ERROR, "map %s has malformatted header", ogzname); delete f; return false; }