From 5c34e555526bba18c911b57c6e34577640236cb3 Mon Sep 17 00:00:00 2001 From: FutureRave Date: Tue, 18 Jan 2022 00:21:25 +0000 Subject: [PATCH] Fix some inconsistencies in my code --- src/Components/Modules/Bots.cpp | 16 ++++++++-------- src/Components/Modules/ClientCommand.cpp | 12 ++++++------ src/Components/Modules/Script.cpp | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Components/Modules/Bots.cpp b/src/Components/Modules/Bots.cpp index f056034a..f74b0923 100644 --- a/src/Components/Modules/Bots.cpp +++ b/src/Components/Modules/Bots.cpp @@ -185,8 +185,8 @@ namespace Components return; } - g_botai[gentity->s.number] = {0}; - g_botai[gentity->s.number].weapon = 1; + g_botai[entref.entnum] = {0}; + g_botai[entref.entnum].weapon = 1; }); Script::AddFunction("BotWeapon", [](Game::scr_entref_t entref) // Usage: BotWeapon(); @@ -204,12 +204,12 @@ namespace Components if (weapon[0] == '\0') { - g_botai[gentity->s.number].weapon = 1; + g_botai[entref.entnum].weapon = 1; return; } const auto weapId = Game::G_GetWeaponIndexForName(weapon); - g_botai[gentity->s.number].weapon = static_cast(weapId); + g_botai[entref.entnum].weapon = static_cast(weapId); }); Script::AddFunction("BotAction", [](Game::scr_entref_t entref) // Usage: BotAction(); @@ -237,9 +237,9 @@ namespace Components continue; if (action[0] == '+') - g_botai[gentity->s.number].buttons |= BotActions[i].key; + g_botai[entref.entnum].buttons |= BotActions[i].key; else - g_botai[gentity->s.number].buttons &= ~(BotActions[i].key); + g_botai[entref.entnum].buttons &= ~(BotActions[i].key); return; } @@ -273,8 +273,8 @@ namespace Components if (rightInt < -127) rightInt = -127; - g_botai[gentity->s.number].forward = static_cast(forwardInt); - g_botai[gentity->s.number].right = static_cast(rightInt); + g_botai[entref.entnum].forward = static_cast(forwardInt); + g_botai[entref.entnum].right = static_cast(rightInt); }); } diff --git a/src/Components/Modules/ClientCommand.cpp b/src/Components/Modules/ClientCommand.cpp index d18ecc36..65c0d32b 100644 --- a/src/Components/Modules/ClientCommand.cpp +++ b/src/Components/Modules/ClientCommand.cpp @@ -17,7 +17,7 @@ namespace Components if (ent->health < 1) { - Logger::Print("CheatsOk: entity %u must be alive to use this command!\n", entNum); + Logger::Print("CheatsOk: entity %i must be alive to use this command!\n", entNum); Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"GAME_MUSTBEALIVECOMMAND\"", 0x65)); return false; } @@ -75,7 +75,7 @@ namespace Components ent->client->flags ^= Game::PLAYER_FLAG_NOCLIP; const auto entNum = ent->s.number; - Logger::Print("Noclip toggled for entity %u\n", entNum); + Logger::Print("Noclip toggled for entity %i\n", entNum); Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"%s\"", 0x65, (ent->client->flags & Game::PLAYER_FLAG_NOCLIP) ? "GAME_NOCLIPON" : "GAME_NOCLIPOFF")); @@ -89,7 +89,7 @@ namespace Components ent->client->flags ^= Game::PLAYER_FLAG_UFO; const auto entNum = ent->s.number; - Logger::Print("UFO toggled for entity %u\n", entNum); + Logger::Print("UFO toggled for entity %i\n", entNum); Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"%s\"", 0x65, (ent->client->flags & Game::PLAYER_FLAG_UFO) ? "GAME_UFOON" : "GAME_UFOOFF")); @@ -103,7 +103,7 @@ namespace Components ent->flags ^= Game::FL_GODMODE; const auto entNum = ent->s.number; - Logger::Print("God toggled for entity %u\n", entNum); + Logger::Print("God toggled for entity %i\n", entNum); Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"%s\"", 0x65, (ent->flags & Game::FL_GODMODE) ? "GAME_GODMODE_ON" : "GAME_GODMODE_OFF")); @@ -117,7 +117,7 @@ namespace Components ent->flags ^= Game::FL_DEMI_GODMODE; const auto entNum = ent->s.number; - Logger::Print("Demigod toggled for entity %u\n", entNum); + Logger::Print("Demigod toggled for entity %i\n", entNum); Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"%s\"", 0x65, (ent->flags & Game::FL_DEMI_GODMODE) ? "GAME_DEMI_GODMODE_ON" : "GAME_DEMI_GODMODE_OFF")); @@ -131,7 +131,7 @@ namespace Components ent->flags ^= Game::FL_NOTARGET; const auto entNum = ent->s.number; - Logger::Print("Notarget toggled for entity %u\n", entNum); + Logger::Print("Notarget toggled for entity %i\n", entNum); Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"%s\"", 0x65, (ent->flags & Game::FL_NOTARGET) ? "GAME_NOTARGETON" : "GAME_NOTARGETOFF")); diff --git a/src/Components/Modules/Script.cpp b/src/Components/Modules/Script.cpp index 76e2d1a2..d259dd03 100644 --- a/src/Components/Modules/Script.cpp +++ b/src/Components/Modules/Script.cpp @@ -55,7 +55,7 @@ namespace Components return; // If were are developing let's just print a brief message - // scrVmPub->debugCode seems to be always false + // scrVmPub.debugCode seems to be always false if (Game::scrVmPub->debugCode || Game::scrVarPub->developer_script) { Logger::Print(23, "%s\n", msg);