Fix some things
This commit is contained in:
parent
b072815407
commit
9ec081fcb1
@ -13,7 +13,7 @@ namespace Components
|
|||||||
|
|
||||||
if (entry.first.bits)
|
if (entry.first.bits)
|
||||||
{
|
{
|
||||||
for (auto& idEntry : list.idList)
|
for (const auto& idEntry : list.idList)
|
||||||
{
|
{
|
||||||
if (idEntry.bits == entry.first.bits)
|
if (idEntry.bits == entry.first.bits)
|
||||||
{
|
{
|
||||||
@ -268,7 +268,7 @@ namespace Components
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Verify the list on startup
|
// Verify the list on startup
|
||||||
Scheduler::OnGameInitialized([]()
|
Scheduler::OnGameInitialized([]
|
||||||
{
|
{
|
||||||
Bans::BanList list;
|
Bans::BanList list;
|
||||||
Bans::LoadBans(&list);
|
Bans::LoadBans(&list);
|
||||||
|
@ -83,7 +83,7 @@ namespace Components
|
|||||||
|
|
||||||
void Bots::Spawn(unsigned int count)
|
void Bots::Spawn(unsigned int count)
|
||||||
{
|
{
|
||||||
for (auto i = 0u; i < count; ++i)
|
for (std::size_t i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
Scheduler::Once([]
|
Scheduler::Once([]
|
||||||
{
|
{
|
||||||
@ -91,13 +91,13 @@ namespace Components
|
|||||||
if (ent == nullptr)
|
if (ent == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Scheduler::Once([ent]()
|
Scheduler::Once([ent]
|
||||||
{
|
{
|
||||||
Game::Scr_AddString("autoassign");
|
Game::Scr_AddString("autoassign");
|
||||||
Game::Scr_AddString("team_marinesopfor");
|
Game::Scr_AddString("team_marinesopfor");
|
||||||
Game::Scr_Notify(ent, Game::SL_GetString("menuresponse", 0), 2);
|
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(Utils::String::VA("class%u", Utils::Cryptography::Rand::GenerateInt() % 5u));
|
||||||
Game::Scr_AddString("changeclass");
|
Game::Scr_AddString("changeclass");
|
||||||
|
@ -289,14 +289,14 @@ namespace Components
|
|||||||
// need to keep the message size below 1404 bytes else recipient will just drop it
|
// need to keep the message size below 1404 bytes else recipient will just drop it
|
||||||
std::vector<std::string> nodeListReponseMessages;
|
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;
|
Proto::Node::List list;
|
||||||
list.set_isnode(Dedicated::IsEnabled());
|
list.set_isnode(Dedicated::IsEnabled());
|
||||||
list.set_protocol(PROTOCOL);
|
list.set_protocol(PROTOCOL);
|
||||||
list.set_port(Node::GetPort());
|
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())
|
if (curNode >= Node::Nodes.size())
|
||||||
break;
|
break;
|
||||||
@ -317,10 +317,10 @@ namespace Components
|
|||||||
nodeListReponseMessages.push_back(list.SerializeAsString());
|
nodeListReponseMessages.push_back(list.SerializeAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t i = 0;
|
auto i = 0;
|
||||||
for (auto& nodeListData : nodeListReponseMessages)
|
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());
|
NODE_LOG("Sending %d nodeListResponse length to %s\n", nodeListData.length(), address.getCString());
|
||||||
Session::Send(address, "nodeListResponse", nodeListData);
|
Session::Send(address, "nodeListResponse", nodeListData);
|
||||||
@ -342,7 +342,7 @@ namespace Components
|
|||||||
Scheduler::Loop([]
|
Scheduler::Loop([]
|
||||||
{
|
{
|
||||||
Node::StoreNodes(false);
|
Node::StoreNodes(false);
|
||||||
}, Scheduler::Pipeline::MAIN);
|
}, Scheduler::Pipeline::ASYNC);
|
||||||
|
|
||||||
Scheduler::Loop(Node::RunFrame, Scheduler::Pipeline::MAIN);
|
Scheduler::Loop(Node::RunFrame, Scheduler::Pipeline::MAIN);
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ namespace Components
|
|||||||
// Constantly draw the mini console
|
// Constantly draw the mini console
|
||||||
Utils::Hook::Set<BYTE>(0x412A45, 0xEB);
|
Utils::Hook::Set<BYTE>(0x412A45, 0xEB);
|
||||||
|
|
||||||
Scheduler::Loop([]()
|
Scheduler::Loop([]
|
||||||
{
|
{
|
||||||
if (*reinterpret_cast<Game::Font_s**>(0x62E4BAC))
|
if (*reinterpret_cast<Game::Font_s**>(0x62E4BAC))
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,7 @@ namespace Components
|
|||||||
|
|
||||||
void Scheduler::Execute(Pipeline type)
|
void Scheduler::Execute(Pipeline type)
|
||||||
{
|
{
|
||||||
AssertCount(type, Pipeline::COUNT);
|
assert(type < Pipeline::COUNT);
|
||||||
Pipelines[type].execute();
|
Pipelines[type].execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ namespace Components
|
|||||||
void Scheduler::Schedule(const std::function<bool()>& callback, const Pipeline type,
|
void Scheduler::Schedule(const std::function<bool()>& callback, const Pipeline type,
|
||||||
const std::chrono::milliseconds delay)
|
const std::chrono::milliseconds delay)
|
||||||
{
|
{
|
||||||
AssertCount(type, Pipeline::COUNT);
|
assert(type < Pipeline::COUNT);
|
||||||
|
|
||||||
Task task;
|
Task task;
|
||||||
task.handler = callback;
|
task.handler = callback;
|
||||||
|
@ -151,7 +151,7 @@ namespace Components
|
|||||||
Scheduler::OnGameInitialized(Toast::Handler, Scheduler::Pipeline::RENDERER);
|
Scheduler::OnGameInitialized(Toast::Handler, Scheduler::Pipeline::RENDERER);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#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);
|
Toast::Show("cardicon_prestige10", "Test", "This is a test toast", 3000);
|
||||||
});
|
});
|
||||||
|
@ -101,9 +101,6 @@ using namespace std::literals;
|
|||||||
static_assert(offsetof(x, y) == (offset), \
|
static_assert(offsetof(x, y) == (offset), \
|
||||||
#x "::" #y " is not at the right offset. Must be at " #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
|
// Protobuf
|
||||||
#include "proto/session.pb.h"
|
#include "proto/session.pb.h"
|
||||||
#include "proto/party.pb.h"
|
#include "proto/party.pb.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user