Fix some things

This commit is contained in:
Diavolo 2022-06-04 14:59:14 +02:00
parent b072815407
commit 9ec081fcb1
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5
8 changed files with 16 additions and 19 deletions

View File

@ -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);

View File

@ -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");

View File

@ -289,14 +289,14 @@ namespace Components
// need to keep the message size below 1404 bytes else recipient will just drop it
std::vector<std::string> 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);

View File

@ -709,7 +709,7 @@ namespace Components
// Constantly draw the mini console
Utils::Hook::Set<BYTE>(0x412A45, 0xEB);
Scheduler::Loop([]()
Scheduler::Loop([]
{
if (*reinterpret_cast<Game::Font_s**>(0x62E4BAC))
{

View File

@ -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<bool()>& callback, const Pipeline type,
const std::chrono::milliseconds delay)
{
AssertCount(type, Pipeline::COUNT);
assert(type < Pipeline::COUNT);
Task task;
task.handler = callback;

View File

@ -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);
});

View File

@ -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"