Basically this makes sure numwadfiles is updated before loading the SOC/Lua scripts, so if a Lua script calls COM_BufInsertText with the contents "addfile scr_mysticrealm.wad" it can't overwrite the last written wadfile slot! Not that COM_BufInsertText really should be used like that to begin with
This commit is contained in:
Monster Iestyn 2016-06-02 20:16:25 +01:00
parent 919e3ed0e2
commit 83c4dba4ce

View file

@ -475,11 +475,11 @@ UINT16 W_LoadWadFile(const char *filename)
// //
CONS_Printf(M_GetText("Added file %s (%u lumps)\n"), filename, numlumps); CONS_Printf(M_GetText("Added file %s (%u lumps)\n"), filename, numlumps);
wadfiles[numwadfiles] = wadfile; wadfiles[numwadfiles] = wadfile;
W_LoadDehackedLumps(numwadfiles); numwadfiles++; // must come BEFORE W_LoadDehackedLumps, so any addfile called by COM_BufInsertText called by Lua doesn't overwrite what we just loaded
W_LoadDehackedLumps(numwadfiles-1);
W_InvalidateLumpnumCache(); W_InvalidateLumpnumCache();
numwadfiles++;
return wadfile->numlumps; return wadfile->numlumps;
} }