[General] Small cleanup (#479)

* [General] Small cleanup

* [Bots] Use ZeroMemory
This commit is contained in:
Edo 2022-09-08 17:11:54 +02:00 committed by GitHub
parent 788782903e
commit 2b774b6c41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -132,7 +132,7 @@ namespace Components
return; return;
} }
g_botai[entref.entnum] = {0}; ZeroMemory(&g_botai[entref.entnum], sizeof(BotMovementInfo));
g_botai[entref.entnum].weapon = 1; g_botai[entref.entnum].weapon = 1;
g_botai[entref.entnum].active = true; g_botai[entref.entnum].active = true;
}); });
@ -317,7 +317,7 @@ namespace Components
// Zero the bot command array // Zero the bot command array
for (std::size_t i = 0; i < std::extent_v<decltype(g_botai)>; ++i) for (std::size_t i = 0; i < std::extent_v<decltype(g_botai)>; ++i)
{ {
std::memset(&g_botai[i], 0, sizeof(BotMovementInfo)); ZeroMemory(&g_botai[i], sizeof(BotMovementInfo));
g_botai[i].weapon = 1; // Prevent the bots from defaulting to the 'none' weapon g_botai[i].weapon = 1; // Prevent the bots from defaulting to the 'none' weapon
} }

View File

@ -25,11 +25,11 @@ namespace Components
HKEY hKey = nullptr; HKEY hKey = nullptr;
std::string data; std::string data;
char ownPth[MAX_PATH] = { 0 }; char ownPth[MAX_PATH] = {0};
char workdir[MAX_PATH] = { 0 }; char workdir[MAX_PATH] = {0};
DWORD dwsize = MAX_PATH; DWORD dwsize = MAX_PATH;
HMODULE hModule = GetModuleHandle(nullptr); HMODULE hModule = GetModuleHandleA(nullptr);
if (hModule != nullptr) if (hModule != nullptr)
{ {
@ -44,7 +44,7 @@ namespace Components
} }
else else
{ {
char* endPtr = strstr(workdir, "iw4x.exe"); auto* endPtr = std::strstr(workdir, "iw4x.exe");
if (endPtr != nullptr) if (endPtr != nullptr)
{ {
*endPtr = 0; *endPtr = 0;
@ -183,7 +183,7 @@ namespace Components
if (pos != std::string::npos) if (pos != std::string::npos)
{ {
cmdLine = cmdLine.substr(pos + 7); cmdLine = cmdLine.substr(pos + 7);
pos = cmdLine.find_first_of("/"); pos = cmdLine.find_first_of('/');
if (pos != std::string::npos) if (pos != std::string::npos)
{ {