diff --git a/src/Components/Modules/Bans.cpp b/src/Components/Modules/Bans.cpp index f4a126c6..27929498 100644 --- a/src/Components/Modules/Bans.cpp +++ b/src/Components/Modules/Bans.cpp @@ -13,7 +13,7 @@ namespace Components if (entry.first.bits) { - for (auto& idEntry : list.idList) + for (const auto& idEntry : list.idList) { if (idEntry.bits == entry.first.bits) { @@ -268,7 +268,7 @@ namespace Components }); // Verify the list on startup - Scheduler::OnGameInitialized([]() + Scheduler::OnGameInitialized([] { Bans::BanList list; Bans::LoadBans(&list); diff --git a/src/Components/Modules/Bots.cpp b/src/Components/Modules/Bots.cpp index d7519f45..a47bccc5 100644 --- a/src/Components/Modules/Bots.cpp +++ b/src/Components/Modules/Bots.cpp @@ -83,7 +83,7 @@ namespace Components void Bots::Spawn(unsigned int count) { - for (auto i = 0u; i < count; ++i) + for (std::size_t i = 0; i < count; ++i) { Scheduler::Once([] { @@ -91,13 +91,13 @@ namespace Components if (ent == nullptr) return; - Scheduler::Once([ent]() + Scheduler::Once([ent] { Game::Scr_AddString("autoassign"); Game::Scr_AddString("team_marinesopfor"); Game::Scr_Notify(ent, Game::SL_GetString("menuresponse", 0), 2); - Scheduler::Once([ent]() + Scheduler::Once([ent] { Game::Scr_AddString(Utils::String::VA("class%u", Utils::Cryptography::Rand::GenerateInt() % 5u)); Game::Scr_AddString("changeclass"); diff --git a/src/Components/Modules/Node.cpp b/src/Components/Modules/Node.cpp index c42c0044..c76e3cd3 100644 --- a/src/Components/Modules/Node.cpp +++ b/src/Components/Modules/Node.cpp @@ -289,14 +289,14 @@ namespace Components // need to keep the message size below 1404 bytes else recipient will just drop it std::vector nodeListReponseMessages; - for (size_t curNode = 0; curNode < Node::Nodes.size();) + for (std::size_t curNode = 0; curNode < Node::Nodes.size();) { Proto::Node::List list; list.set_isnode(Dedicated::IsEnabled()); list.set_protocol(PROTOCOL); list.set_port(Node::GetPort()); - for (size_t i = 0; i < NODE_MAX_NODES_TO_SEND;) + for (std::size_t i = 0; i < NODE_MAX_NODES_TO_SEND;) { if (curNode >= Node::Nodes.size()) break; @@ -317,10 +317,10 @@ namespace Components nodeListReponseMessages.push_back(list.SerializeAsString()); } - size_t i = 0; - for (auto& nodeListData : nodeListReponseMessages) + auto i = 0; + for (const auto& nodeListData : nodeListReponseMessages) { - Scheduler::Once([nodeListData, i, address]() + Scheduler::Once([&] { NODE_LOG("Sending %d nodeListResponse length to %s\n", nodeListData.length(), address.getCString()); Session::Send(address, "nodeListResponse", nodeListData); @@ -342,7 +342,7 @@ namespace Components Scheduler::Loop([] { Node::StoreNodes(false); - }, Scheduler::Pipeline::MAIN); + }, Scheduler::Pipeline::ASYNC); Scheduler::Loop(Node::RunFrame, Scheduler::Pipeline::MAIN); diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index a0823807..84e0cb00 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -709,7 +709,7 @@ namespace Components // Constantly draw the mini console Utils::Hook::Set(0x412A45, 0xEB); - Scheduler::Loop([]() + Scheduler::Loop([] { if (*reinterpret_cast(0x62E4BAC)) { diff --git a/src/Components/Modules/Scheduler.cpp b/src/Components/Modules/Scheduler.cpp index c3cfbf57..858970a4 100644 --- a/src/Components/Modules/Scheduler.cpp +++ b/src/Components/Modules/Scheduler.cpp @@ -63,7 +63,7 @@ namespace Components void Scheduler::Execute(Pipeline type) { - AssertCount(type, Pipeline::COUNT); + assert(type < Pipeline::COUNT); Pipelines[type].execute(); } @@ -100,7 +100,7 @@ namespace Components void Scheduler::Schedule(const std::function& callback, const Pipeline type, const std::chrono::milliseconds delay) { - AssertCount(type, Pipeline::COUNT); + assert(type < Pipeline::COUNT); Task task; task.handler = callback; diff --git a/src/Components/Modules/Toast.cpp b/src/Components/Modules/Toast.cpp index 03276c06..669b5231 100644 --- a/src/Components/Modules/Toast.cpp +++ b/src/Components/Modules/Toast.cpp @@ -151,7 +151,7 @@ namespace Components Scheduler::OnGameInitialized(Toast::Handler, Scheduler::Pipeline::RENDERER); #ifdef _DEBUG - Command::Add("testtoast", [](Command::Params*) + Command::Add("testtoast", []([[maybe_unused]] Command::Params* params) { Toast::Show("cardicon_prestige10", "Test", "This is a test toast", 3000); }); diff --git a/src/STDInclude.hpp b/src/STDInclude.hpp index 37b75112..8b9d29a8 100644 --- a/src/STDInclude.hpp +++ b/src/STDInclude.hpp @@ -101,9 +101,6 @@ using namespace std::literals; static_assert(offsetof(x, y) == (offset), \ #x "::" #y " is not at the right offset. Must be at " #offset) -#define AssertCount(expr, count) \ - assert((#expr " doesn't index " #count, (expr) < (count))) - // Protobuf #include "proto/session.pb.h" #include "proto/party.pb.h" diff --git a/src/Utils/Thread.hpp b/src/Utils/Thread.hpp index 7b6a1314..807633f4 100644 --- a/src/Utils/Thread.hpp +++ b/src/Utils/Thread.hpp @@ -20,4 +20,4 @@ namespace Utils::Thread void suspendOtherThreads(); void resumeOtherThreads(); -} \ No newline at end of file +}