From 72677d4b1b14c1f0ccc54cffe60b7f62c80405ed Mon Sep 17 00:00:00 2001 From: Diavolo Date: Wed, 28 Dec 2022 13:37:03 +0100 Subject: [PATCH] [Logger]: Fix pipe, bruh moment --- src/Components/Modules/Logger.cpp | 4 ++-- src/Components/Modules/Logger.hpp | 4 ++-- src/Components/Modules/RCon.cpp | 2 +- src/Game/Structs.hpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Components/Modules/Logger.cpp b/src/Components/Modules/Logger.cpp index b87a7813..e355a95e 100644 --- a/src/Components/Modules/Logger.cpp +++ b/src/Components/Modules/Logger.cpp @@ -7,7 +7,7 @@ namespace Components std::vector Logger::MessageQueue; std::vector Logger::LoggingAddresses[2]; - std::function Logger::PipeCallback; + void(*Logger::PipeCallback)(const std::string&) = nullptr;; bool Logger::IsConsoleReady() { @@ -125,7 +125,7 @@ namespace Components } } - void Logger::PipeOutput(const std::function& callback) + void Logger::PipeOutput(void(*callback)(const std::string&)) { PipeCallback = callback; } diff --git a/src/Components/Modules/Logger.hpp b/src/Components/Modules/Logger.hpp index 2aeace2b..8bc8f454 100644 --- a/src/Components/Modules/Logger.hpp +++ b/src/Components/Modules/Logger.hpp @@ -12,7 +12,7 @@ namespace Components static void Print_Stub(int channel, const char* message, ...); - static void PipeOutput(const std::function& callback); + static void PipeOutput(void(*callback)(const std::string&)); static void PrintInternal(Game::conChannel_t channel, const std::string_view& fmt, std::format_args&& args); static void ErrorInternal(Game::errorParm_t error, const std::string_view& fmt, std::format_args&& args); @@ -112,7 +112,7 @@ namespace Components static std::vector MessageQueue; static std::vector LoggingAddresses[2]; - static std::function PipeCallback; + static void(*PipeCallback)(const std::string&); static void MessagePrint(int channel, const std::string& msg); diff --git a/src/Components/Modules/RCon.cpp b/src/Components/Modules/RCon.cpp index 52e549ce..56cf17ba 100644 --- a/src/Components/Modules/RCon.cpp +++ b/src/Components/Modules/RCon.cpp @@ -76,7 +76,7 @@ namespace Components bool RCon::RateLimitCheck(const Network::Address& address, const int time) { - auto ip = address.getIP(); + const auto ip = address.getIP(); if (!RateLimit.contains(ip.full)) { diff --git a/src/Game/Structs.hpp b/src/Game/Structs.hpp index 8b12092c..f27366c1 100644 --- a/src/Game/Structs.hpp +++ b/src/Game/Structs.hpp @@ -6443,7 +6443,7 @@ namespace Game typedef union { unsigned char bytes[4]; - DWORD full; + std::uint32_t full; } netIP_t; struct netadr_t