From da61ab42ec3040e9f6dbb456b47a09702e091d7a Mon Sep 17 00:00:00 2001 From: Diavolo Date: Thu, 21 Jul 2022 18:56:16 +0200 Subject: [PATCH] Fix some justified warnings & more --- src/Components/Modules/ClientCommand.cpp | 10 +++++----- src/Components/Modules/GSC/Script.cpp | 2 +- src/Components/Modules/GSC/ScriptExtension.cpp | 8 ++++---- src/Components/Modules/Theatre.cpp | 2 +- src/Components/Modules/UserInfo.cpp | 2 ++ 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Components/Modules/ClientCommand.cpp b/src/Components/Modules/ClientCommand.cpp index 1b39fa3f..cc552799 100644 --- a/src/Components/Modules/ClientCommand.cpp +++ b/src/Components/Modules/ClientCommand.cpp @@ -355,7 +355,7 @@ namespace Components { const auto* ent = Game::GetPlayerEntity(entref); - if (Game::Scr_GetNumParam() >= 1u) + if (Game::Scr_GetNumParam() >= 1) { if (Game::Scr_GetInt(0)) { @@ -376,7 +376,7 @@ namespace Components { const auto* ent = Game::GetPlayerEntity(entref); - if (Game::Scr_GetNumParam() >= 1u) + if (Game::Scr_GetNumParam() >= 1) { if (Game::Scr_GetInt(0)) { @@ -397,7 +397,7 @@ namespace Components { auto* ent = Game::GetEntity(entref); - if (Game::Scr_GetNumParam() >= 1u) + if (Game::Scr_GetNumParam() >= 1) { if (Game::Scr_GetInt(0)) { @@ -418,7 +418,7 @@ namespace Components { auto* ent = Game::GetEntity(entref); - if (Game::Scr_GetNumParam() >= 1u) + if (Game::Scr_GetNumParam() >= 1) { if (Game::Scr_GetInt(0)) { @@ -439,7 +439,7 @@ namespace Components { auto* ent = Game::GetEntity(entref); - if (Game::Scr_GetNumParam() >= 1u) + if (Game::Scr_GetNumParam() >= 1) { if (Game::Scr_GetInt(0)) { diff --git a/src/Components/Modules/GSC/Script.cpp b/src/Components/Modules/GSC/Script.cpp index 9f8680c8..85ae8602 100644 --- a/src/Components/Modules/GSC/Script.cpp +++ b/src/Components/Modules/GSC/Script.cpp @@ -495,7 +495,7 @@ namespace Components return ""; } - const auto value = &Game::scrVmPub->top[-index]; + const auto* value = &Game::scrVmPub->top[-index]; if (value->type != Game::scrParamType_t::VAR_FUNCTION) { diff --git a/src/Components/Modules/GSC/ScriptExtension.cpp b/src/Components/Modules/GSC/ScriptExtension.cpp index f6551e27..411282dc 100644 --- a/src/Components/Modules/GSC/ScriptExtension.cpp +++ b/src/Components/Modules/GSC/ScriptExtension.cpp @@ -189,14 +189,14 @@ namespace Components Script::AddFunction("IsArray", [] // gsc: iw4x_IsArray() { - const auto type = Game::Scr_GetType(0); + auto type = Game::Scr_GetType(0); bool result; if (type == Game::VAR_POINTER) { - const auto ptr_type = Game::Scr_GetPointerType(0); - assert(ptr_type >= Game::FIRST_OBJECT); - result = (ptr_type == Game::VAR_ARRAY); + type = Game::Scr_GetPointerType(0); + assert(type >= Game::FIRST_OBJECT); + result = (type == Game::VAR_ARRAY); } else { diff --git a/src/Components/Modules/Theatre.cpp b/src/Components/Modules/Theatre.cpp index 46285135..56e7ba05 100644 --- a/src/Components/Modules/Theatre.cpp +++ b/src/Components/Modules/Theatre.cpp @@ -73,7 +73,7 @@ namespace Components if (i + size >= sizeof(cmpData)) { - Logger::Print("Error: Writing compressed demo baseline exceeded buffer\n"); + Logger::PrintError(Game::CON_CHANNEL_ERROR, "Writing compressed demo baseline exceeded buffer\n"); break; } diff --git a/src/Components/Modules/UserInfo.cpp b/src/Components/Modules/UserInfo.cpp index c7fbbd04..39b6cd63 100644 --- a/src/Components/Modules/UserInfo.cpp +++ b/src/Components/Modules/UserInfo.cpp @@ -52,6 +52,7 @@ namespace Components if (name == nullptr) { Game::Scr_ParamError(0, "^1SetName: Illegal parameter!\n"); + return; } Logger::Debug("Setting name of {} to {}", ent->s.number, name); @@ -76,6 +77,7 @@ namespace Components if (clanName == nullptr) { Game::Scr_ParamError(0, "^1SetClanTag: Illegal parameter!\n"); + return; } Logger::Debug("Setting clanName of {} to {}", ent->s.number, clanName);