[General] Fix code analysis warning and memory leaks
This commit is contained in:
parent
a15ac958a3
commit
b3f83fe955
@ -27,10 +27,11 @@ namespace Assets
|
||||
Components::Logger::Error("Version %i is too high. I can only handle up to %i.\n", version, 2);
|
||||
}
|
||||
|
||||
Game::FxEditorEffectDef efx;
|
||||
ZeroMemory(&efx, sizeof(efx));
|
||||
Utils::Memory::Allocator allocator;
|
||||
Game::FxEditorEffectDef* efx = allocator.allocate<Game::FxEditorEffectDef>();
|
||||
ZeroMemory(efx, sizeof(efx));
|
||||
|
||||
for (efx.elemCount = 0; ; ++efx.elemCount)
|
||||
for (efx->elemCount = 0; ; ++efx->elemCount)
|
||||
{
|
||||
const char* value = Game::Com_Parse(&session);
|
||||
if (!value) break;
|
||||
@ -39,12 +40,12 @@ namespace Assets
|
||||
Components::Logger::Error("Expected '{' to start a new segment, found '%s' instead.\n", value);
|
||||
}
|
||||
|
||||
if (efx.elemCount >= ARRAYSIZE(efx.elems))
|
||||
if (efx->elemCount >= ARRAYSIZE(efx->elems))
|
||||
{
|
||||
Components::Logger::Error("Cannot have more than %i segments.\n", ARRAYSIZE(efx.elems));
|
||||
Components::Logger::Error("Cannot have more than %i segments.\n", ARRAYSIZE(efx->elems));
|
||||
}
|
||||
|
||||
Game::FxEditorElemDef* element = &efx.elems[efx.elemCount];
|
||||
Game::FxEditorElemDef* element = &efx->elems[efx->elemCount];
|
||||
// TODO: Initialize some stuff here
|
||||
|
||||
while (true)
|
||||
|
@ -432,8 +432,7 @@ namespace Components
|
||||
void Maps::UpdateDlcStatus()
|
||||
{
|
||||
bool hasAllDlcs = true;
|
||||
bool * hasDlc = new bool[DlcPacks.size()];
|
||||
int i = 0;
|
||||
std::vector<bool> hasDlc;
|
||||
for (auto& pack : Maps::DlcPacks)
|
||||
{
|
||||
bool hasAllMaps = true;
|
||||
@ -447,13 +446,13 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
hasDlc[i++] = hasAllMaps;
|
||||
hasDlc.push_back(hasAllMaps);
|
||||
Dvar::Var(Utils::String::VA("isDlcInstalled_%d", pack.index)).setRaw(hasAllMaps ? 1 : 0);
|
||||
}
|
||||
|
||||
// Must have all of dlc 3 to 5 or it causes issues
|
||||
static bool sentMessage = false;
|
||||
if ((hasDlc[2] || hasDlc[3] || hasDlc[4]) && (!hasDlc[2] || !hasDlc[3] || !hasDlc[4]) && !sentMessage)
|
||||
if (hasDlc.size() >= 5 && (hasDlc[2] || hasDlc[3] || hasDlc[4]) && (!hasDlc[2] || !hasDlc[3] || !hasDlc[4]) && !sentMessage)
|
||||
{
|
||||
StartupMessages::AddMessage("Warning:\n You only have some of DLCs 3-5 which are all required to be installed to work. There may be issues with those maps.");
|
||||
sentMessage = true;
|
||||
|
@ -8,6 +8,11 @@ namespace boost
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4091)
|
||||
#pragma warning(disable: 4996)
|
||||
#pragma warning(disable: 6248)
|
||||
#pragma warning(disable: 6282)
|
||||
#pragma warning(disable: 6285)
|
||||
#pragma warning(disable: 6388)
|
||||
#pragma warning(disable: 28159)
|
||||
#define _SCL_SECURE_NO_WARNINGS
|
||||
|
||||
#ifdef sleep
|
||||
|
Loading…
Reference in New Issue
Block a user