diff --git a/src/common/console/c_cvars.cpp b/src/common/console/c_cvars.cpp index bb677d90c8..d89bb3da39 100644 --- a/src/common/console/c_cvars.cpp +++ b/src/common/console/c_cvars.cpp @@ -102,16 +102,6 @@ void C_InitCVars(int which) newcvar = new FStringCVar(cvInfo->name, cvInfo->defaultval.String, cvInfo->flags, reinterpret_cast(cvInfo->callbackp), cvInfo->description); break; } - case CVAR_Flag: - { - newcvar = new FFlagCVar(cvInfo->name, *cvInfo->defaultval.Pointer->get(), cvInfo->flags, cvInfo->description); - break; - } - case CVAR_Mask: - { - newcvar = new FMaskCVar(cvInfo->name, *cvInfo->defaultval.Pointer->get(), cvInfo->flags, cvInfo->description); - break; - } case CVAR_Color: { using callbacktype = void (*)(FColorCVar &); @@ -122,6 +112,28 @@ void C_InitCVars(int which) } *(void**)cvInfo->refAddr = newcvar; }); + AutoSegs::CVarDecl.ForEach([](FCVarDecl* cvInfo) + { + FBaseCVar* newcvar; + switch (cvInfo->type) + { + default: + return; + + case CVAR_Flag: + { + newcvar = new FFlagCVar(cvInfo->name, *cvInfo->defaultval.Pointer->get(), cvInfo->flags, cvInfo->description); + break; + } + case CVAR_Mask: + { + newcvar = new FMaskCVar(cvInfo->name, *cvInfo->defaultval.Pointer->get(), cvInfo->flags, cvInfo->description); + break; + } + + } + *(void**)cvInfo->refAddr = newcvar; + }); } void C_UninitCVars() diff --git a/src/common/textures/formats/anmtexture.cpp b/src/common/textures/formats/anmtexture.cpp index 3845bdc676..8e9555b9f1 100644 --- a/src/common/textures/formats/anmtexture.cpp +++ b/src/common/textures/formats/anmtexture.cpp @@ -66,7 +66,8 @@ FImageSource *AnmImage_TryCreate(FileReader & file, int lumpnum) { file.Seek(0, FileReader::SeekSet); char check[4]; - file.Read(check, 4); + auto num = file.Read(check, 4); + if (num < 4) return nullptr; if (memcmp(check, "LPF ", 4)) return nullptr; file.Seek(0, FileReader::SeekSet); auto buffer = file.ReadPadded(1);