mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-08-17 00:36:55 +00:00
add more compile-time diagnostics, implement fixes for them
Before, a lot of common errors went unnoticed, due to insufficient compiler diagnostics. This commit fixes this by adding a lot of new diagnostics, and fixing the issues found by this.
This commit is contained in:
parent
501fddadc6
commit
24c98eb2b2
@ -26,15 +26,6 @@ endif()
|
|||||||
set(HTTPLIB_REQUIRE_OPENSSL ON)
|
set(HTTPLIB_REQUIRE_OPENSSL ON)
|
||||||
set(SENTRY_BUILD_SHARED_LIBS OFF)
|
set(SENTRY_BUILD_SHARED_LIBS OFF)
|
||||||
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/deps/asio/asio/include")
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/deps/rapidjson/include")
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/deps/websocketpp")
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/deps/commandline")
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/deps/sol2/include")
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/deps/cpp-httplib")
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/deps/json/single_include")
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/deps")
|
|
||||||
|
|
||||||
add_compile_definitions(CPPHTTPLIB_OPENSSL_SUPPORT=1)
|
add_compile_definitions(CPPHTTPLIB_OPENSSL_SUPPORT=1)
|
||||||
|
|
||||||
# ------------------------ APPLE ---------------------------------
|
# ------------------------ APPLE ---------------------------------
|
||||||
@ -62,17 +53,15 @@ elseif (WIN32)
|
|||||||
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||||
# ------------------------ LINUX ---------------------------------
|
# ------------------------ LINUX ---------------------------------
|
||||||
elseif (UNIX)
|
elseif (UNIX)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -static-libstdc++ -static-libgcc")
|
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-builtin")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-builtin")
|
||||||
option(SANITIZE "Turns on thread and UB sanitizers" OFF)
|
option(SANITIZE "Turns on thread and UB sanitizers" OFF)
|
||||||
if (SANITIZE)
|
if (SANITIZE)
|
||||||
message(STATUS "sanitize is ON")
|
message(STATUS "sanitize is ON")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined,thread")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize={address,thread,undefined}")
|
||||||
endif (SANITIZE)
|
endif (SANITIZE)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include_directories("include/sentry-native/include")
|
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
# ------------------------ SENTRY ---------------------------------
|
# ------------------------ SENTRY ---------------------------------
|
||||||
message(STATUS "Checking for Sentry URL")
|
message(STATUS "Checking for Sentry URL")
|
||||||
@ -131,19 +120,57 @@ set(BeamMP_Sources
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(BeamMP_Includes
|
set(BeamMP_Includes
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/commandline"
|
|
||||||
${LUA_INCLUDE_DIR}
|
${LUA_INCLUDE_DIR}
|
||||||
${CURL_INCLUDE_DIRS}
|
${CURL_INCLUDE_DIRS}
|
||||||
"include/tomlplusplus"
|
"${CMAKE_CURRENT_SOURCE_DIR}/deps/cpp-httplib"
|
||||||
"include/sentry-native/include"
|
"${CMAKE_CURRENT_SOURCE_DIR}/deps/commandline"
|
||||||
"include/curl/include"
|
"${CMAKE_CURRENT_SOURCE_DIR}/deps/json/single_include"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/deps/sol2/include"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/deps/rapidjson/include"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/deps/asio/asio/include"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/deps"
|
||||||
)
|
)
|
||||||
|
|
||||||
set(BeamMP_Definitions
|
set(BeamMP_Definitions
|
||||||
SECRET_SENTRY_URL="${BEAMMP_SECRET_SENTRY_URL}"
|
SECRET_SENTRY_URL="${BEAMMP_SECRET_SENTRY_URL}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
set(BeamMP_CompileOptions
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Wpedantic
|
||||||
|
|
||||||
|
-Werror=uninitialized
|
||||||
|
-Werror=float-equal
|
||||||
|
-Werror=pointer-arith
|
||||||
|
-Werror=double-promotion
|
||||||
|
-Werror=write-strings
|
||||||
|
-Werror=cast-qual
|
||||||
|
-Werror=init-self
|
||||||
|
-Werror=cast-align
|
||||||
|
-Werror=unreachable-code
|
||||||
|
-Werror=strict-aliasing -fstrict-aliasing
|
||||||
|
-Werror=redundant-decls
|
||||||
|
-Werror=missing-declarations
|
||||||
|
-Werror=missing-field-initializers
|
||||||
|
-Werror=write-strings
|
||||||
|
-Werror=inline
|
||||||
|
-Werror=disabled-optimization
|
||||||
|
-Werror=ctor-dtor-privacy
|
||||||
|
-Werror=switch-enum
|
||||||
|
-Werror=switch-default
|
||||||
|
-Werror=old-style-cast
|
||||||
|
-Werror=overloaded-virtual
|
||||||
|
-Werror=zero-as-null-pointer-constant
|
||||||
|
-Werror=overloaded-virtual
|
||||||
|
-Werror=missing-include-dirs
|
||||||
|
-Werror=unused-result
|
||||||
|
|
||||||
|
-fstack-protector
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(BeamMP_Libraries
|
set(BeamMP_Libraries
|
||||||
doctest::doctest
|
doctest::doctest
|
||||||
OpenSSL::SSL
|
OpenSSL::SSL
|
||||||
@ -173,7 +200,15 @@ target_compile_definitions(BeamMP-Server PRIVATE
|
|||||||
DOCTEST_CONFIG_DISABLE
|
DOCTEST_CONFIG_DISABLE
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(BeamMP-Server PUBLIC
|
target_compile_options(BeamMP-Server PRIVATE
|
||||||
|
${BeamMP_CompileOptions}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(BeamMP-Server PRIVATE
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(BeamMP-Server SYSTEM PRIVATE
|
||||||
${BeamMP_Includes}
|
${BeamMP_Includes}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -196,7 +231,15 @@ if(BUILD_TESTS)
|
|||||||
${BeamMP_Definitions}
|
${BeamMP_Definitions}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(BeamMP-Server-tests PUBLIC
|
target_compile_options(BeamMP-Server-tests PRIVATE
|
||||||
|
${BeamMP_CompileOptions}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(BeamMP-Server-tests PRIVATE
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(BeamMP-Server-tests SYSTEM PRIVATE
|
||||||
${BeamMP_Includes}
|
${BeamMP_Includes}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
1
deps/CMakeLists.txt
vendored
1
deps/CMakeLists.txt
vendored
@ -1,5 +1,4 @@
|
|||||||
include_directories("${PROJECT_SOURCE_DIR}/deps")
|
include_directories("${PROJECT_SOURCE_DIR}/deps")
|
||||||
include_directories("${PROJECT_SOURCE_DIR}/deps/commandline")
|
|
||||||
|
|
||||||
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/commandline")
|
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/commandline")
|
||||||
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/fmt")
|
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/fmt")
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
extern TSentry Sentry;
|
extern TSentry Sentry;
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <unordered_map>
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
@ -15,14 +14,13 @@ extern TSentry Sentry;
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <shared_mutex>
|
#include <shared_mutex>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <unordered_map>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include <doctest/doctest.h>
|
#include <doctest/doctest.h>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
#include "Compat.h"
|
|
||||||
|
|
||||||
#include "TConsole.h"
|
#include "TConsole.h"
|
||||||
|
|
||||||
struct Version {
|
struct Version {
|
||||||
@ -34,7 +32,7 @@ struct Version {
|
|||||||
std::string AsString();
|
std::string AsString();
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template <typename T>
|
||||||
using SparseArray = std::unordered_map<size_t, T>;
|
using SparseArray = std::unordered_map<size_t, T>;
|
||||||
|
|
||||||
// static class handling application start, shutdown, etc.
|
// static class handling application start, shutdown, etc.
|
||||||
@ -277,11 +275,11 @@ inline T Comp(const T& Data) {
|
|||||||
// obsolete
|
// obsolete
|
||||||
C.fill(0);
|
C.fill(0);
|
||||||
z_stream defstream;
|
z_stream defstream;
|
||||||
defstream.zalloc = Z_NULL;
|
defstream.zalloc = nullptr;
|
||||||
defstream.zfree = Z_NULL;
|
defstream.zfree = nullptr;
|
||||||
defstream.opaque = Z_NULL;
|
defstream.opaque = nullptr;
|
||||||
defstream.avail_in = (uInt)Data.size();
|
defstream.avail_in = uInt(Data.size());
|
||||||
defstream.next_in = (Bytef*)&Data[0];
|
defstream.next_in = const_cast<Bytef*>(reinterpret_cast<const Bytef*>(&Data[0]));
|
||||||
defstream.avail_out = Biggest;
|
defstream.avail_out = Biggest;
|
||||||
defstream.next_out = reinterpret_cast<Bytef*>(C.data());
|
defstream.next_out = reinterpret_cast<Bytef*>(C.data());
|
||||||
deflateInit(&defstream, Z_BEST_COMPRESSION);
|
deflateInit(&defstream, Z_BEST_COMPRESSION);
|
||||||
@ -302,13 +300,13 @@ inline T DeComp(const T& Compressed) {
|
|||||||
// not needed
|
// not needed
|
||||||
C.fill(0);
|
C.fill(0);
|
||||||
z_stream infstream;
|
z_stream infstream;
|
||||||
infstream.zalloc = Z_NULL;
|
infstream.zalloc = nullptr;
|
||||||
infstream.zfree = Z_NULL;
|
infstream.zfree = nullptr;
|
||||||
infstream.opaque = Z_NULL;
|
infstream.opaque = nullptr;
|
||||||
infstream.avail_in = Biggest;
|
infstream.avail_in = Biggest;
|
||||||
infstream.next_in = (Bytef*)(&Compressed[0]);
|
infstream.next_in = const_cast<Bytef*>(reinterpret_cast<const Bytef*>(&Compressed[0]));
|
||||||
infstream.avail_out = Biggest;
|
infstream.avail_out = Biggest;
|
||||||
infstream.next_out = (Bytef*)(C.data());
|
infstream.next_out = const_cast<Bytef*>(reinterpret_cast<const Bytef*>(C.data()));
|
||||||
inflateInit(&infstream);
|
inflateInit(&infstream);
|
||||||
inflate(&infstream, Z_SYNC_FLUSH);
|
inflate(&infstream, Z_SYNC_FLUSH);
|
||||||
inflate(&infstream, Z_FINISH);
|
inflate(&infstream, Z_FINISH);
|
||||||
@ -323,5 +321,3 @@ inline T DeComp(const T& Compressed) {
|
|||||||
|
|
||||||
std::string GetPlatformAgnosticErrorString();
|
std::string GetPlatformAgnosticErrorString();
|
||||||
#define S_DSN SU_RAW
|
#define S_DSN SU_RAW
|
||||||
|
|
||||||
void LogChatMessage(const std::string& name, int id, const std::string& msg);
|
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#if defined(BEAMMP_LINUX)
|
#if defined(BEAMMP_LINUX)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-qual"
|
||||||
|
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||||
#endif
|
#endif
|
||||||
#include <httplib.h>
|
#include <httplib.h>
|
||||||
#if defined(BEAMMP_LINUX)
|
#if defined(BEAMMP_LINUX)
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include "Compat.h"
|
||||||
#include "CustomAssert.h"
|
#include "CustomAssert.h"
|
||||||
#include "Http.h"
|
#include "Http.h"
|
||||||
|
|
||||||
@ -170,6 +171,8 @@ void Application::SetSubsystemStatus(const std::string& Subsystem, Status status
|
|||||||
case Status::Shutdown:
|
case Status::Shutdown:
|
||||||
beammp_trace("Subsystem '" + Subsystem + "': Shutdown");
|
beammp_trace("Subsystem '" + Subsystem + "': Shutdown");
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
beammp_assert_not_reachable();
|
||||||
}
|
}
|
||||||
std::unique_lock Lock(mSystemStatusMapMutex);
|
std::unique_lock Lock(mSystemStatusMapMutex);
|
||||||
mSystemStatusMap[Subsystem] = status;
|
mSystemStatusMap[Subsystem] = status;
|
||||||
@ -347,5 +350,7 @@ std::string GetPlatformAgnosticErrorString() {
|
|||||||
}
|
}
|
||||||
#elif defined(BEAMMP_LINUX) || defined(BEAMMP_APPLE)
|
#elif defined(BEAMMP_LINUX) || defined(BEAMMP_APPLE)
|
||||||
return std::strerror(errno);
|
return std::strerror(errno);
|
||||||
|
#else
|
||||||
|
return "(no human-readable errors on this platform)";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
static struct termios old, current;
|
static struct termios old, current;
|
||||||
|
|
||||||
void initTermios(int echo) {
|
static void initTermios(int echo) {
|
||||||
tcgetattr(0, &old); /* grab old terminal i/o settings */
|
tcgetattr(0, &old); /* grab old terminal i/o settings */
|
||||||
current = old; /* make new settings same as old settings */
|
current = old; /* make new settings same as old settings */
|
||||||
current.c_lflag &= ~ICANON; /* disable buffered i/o */
|
current.c_lflag &= ~ICANON; /* disable buffered i/o */
|
||||||
@ -19,7 +19,7 @@ void initTermios(int echo) {
|
|||||||
tcsetattr(0, TCSANOW, ¤t); /* use these new terminal i/o settings now */
|
tcsetattr(0, TCSANOW, ¤t); /* use these new terminal i/o settings now */
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetTermios(void) {
|
static void resetTermios(void) {
|
||||||
tcsetattr(0, TCSANOW, &old);
|
tcsetattr(0, TCSANOW, &old);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ TEST_CASE("init and reset termios") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char getch_(int echo) {
|
static char getch_(int echo) {
|
||||||
char ch;
|
char ch;
|
||||||
initTermios(echo);
|
initTermios(echo);
|
||||||
read(STDIN_FILENO, &ch, 1);
|
read(STDIN_FILENO, &ch, 1);
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "CustomAssert.h"
|
#include "CustomAssert.h"
|
||||||
#include "LuaAPI.h"
|
#include "LuaAPI.h"
|
||||||
#include "httplib.h"
|
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
@ -177,6 +176,8 @@ void Http::Server::THttpServerInstance::operator()() try {
|
|||||||
case Application::Status::Bad:
|
case Application::Status::Bad:
|
||||||
SystemsBad++;
|
SystemsBad++;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
beammp_assert_not_reachable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.set_content(
|
res.set_content(
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "LuaAPI.h"
|
#include "LuaAPI.h"
|
||||||
#include "Client.h"
|
#include "Client.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "CustomAssert.h"
|
||||||
#include "TLuaEngine.h"
|
#include "TLuaEngine.h"
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
@ -74,8 +75,10 @@ std::string LuaAPI::LuaToString(const sol::object Value, size_t Indent, bool Quo
|
|||||||
ss << "[[function: " << Value.as<sol::function>().pointer() << "]]";
|
ss << "[[function: " << Value.as<sol::function>().pointer() << "]]";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
case sol::type::poly:
|
||||||
|
return "<poly>";
|
||||||
default:
|
default:
|
||||||
return "((unprintable type))";
|
return "<unprintable type>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,21 +117,20 @@ static inline std::pair<bool, std::string> InternalTriggerClientEvent(int Player
|
|||||||
std::string Packet = "E:" + EventName + ":" + Data;
|
std::string Packet = "E:" + EventName + ":" + Data;
|
||||||
if (PlayerID == -1) {
|
if (PlayerID == -1) {
|
||||||
LuaAPI::MP::Engine->Network().SendToAll(nullptr, Packet, true, true);
|
LuaAPI::MP::Engine->Network().SendToAll(nullptr, Packet, true, true);
|
||||||
return {true, ""};
|
return { true, "" };
|
||||||
} else {
|
} else {
|
||||||
auto MaybeClient = GetClient(LuaAPI::MP::Engine->Server(), PlayerID);
|
auto MaybeClient = GetClient(LuaAPI::MP::Engine->Server(), PlayerID);
|
||||||
if (!MaybeClient || MaybeClient.value().expired()) {
|
if (!MaybeClient || MaybeClient.value().expired()) {
|
||||||
beammp_lua_errorf("TriggerClientEvent invalid Player ID '{}'", PlayerID);
|
beammp_lua_errorf("TriggerClientEvent invalid Player ID '{}'", PlayerID);
|
||||||
return {false, "Invalid Player ID"};
|
return { false, "Invalid Player ID" };
|
||||||
}
|
}
|
||||||
auto c = MaybeClient.value().lock();
|
auto c = MaybeClient.value().lock();
|
||||||
if (!LuaAPI::MP::Engine->Network().Respond(*c, Packet, true)) {
|
if (!LuaAPI::MP::Engine->Network().Respond(*c, Packet, true)) {
|
||||||
beammp_lua_errorf("Respond failed, dropping client {}", PlayerID);
|
beammp_lua_errorf("Respond failed, dropping client {}", PlayerID);
|
||||||
LuaAPI::MP::Engine->Network().ClientKick(*c, "Disconnected after failing to receive packets");
|
LuaAPI::MP::Engine->Network().ClientKick(*c, "Disconnected after failing to receive packets");
|
||||||
return {false, "Respond failed, dropping client"};
|
return { false, "Respond failed, dropping client" };
|
||||||
|
|
||||||
}
|
}
|
||||||
return {true, ""};
|
return { true, "" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,11 +143,11 @@ std::pair<bool, std::string> LuaAPI::MP::DropPlayer(int ID, std::optional<std::s
|
|||||||
auto MaybeClient = GetClient(Engine->Server(), ID);
|
auto MaybeClient = GetClient(Engine->Server(), ID);
|
||||||
if (!MaybeClient || MaybeClient.value().expired()) {
|
if (!MaybeClient || MaybeClient.value().expired()) {
|
||||||
beammp_lua_errorf("Tried to drop client with id {}, who doesn't exist", ID);
|
beammp_lua_errorf("Tried to drop client with id {}, who doesn't exist", ID);
|
||||||
return {false, "Player does not exist"};
|
return { false, "Player does not exist" };
|
||||||
}
|
}
|
||||||
auto c = MaybeClient.value().lock();
|
auto c = MaybeClient.value().lock();
|
||||||
LuaAPI::MP::Engine->Network().ClientKick(*c, MaybeReason.value_or("No reason"));
|
LuaAPI::MP::Engine->Network().ClientKick(*c, MaybeReason.value_or("No reason"));
|
||||||
return {true, ""};
|
return { true, "" };
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<bool, std::string> LuaAPI::MP::SendChatMessage(int ID, const std::string& Message) {
|
std::pair<bool, std::string> LuaAPI::MP::SendChatMessage(int ID, const std::string& Message) {
|
||||||
@ -165,7 +167,10 @@ std::pair<bool, std::string> LuaAPI::MP::SendChatMessage(int ID, const std::stri
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
LogChatMessage("<Server> (to \"" + c->GetName() + "\")", -1, Message);
|
LogChatMessage("<Server> (to \"" + c->GetName() + "\")", -1, Message);
|
||||||
Engine->Network().Respond(*c, Packet, true);
|
if (!Engine->Network().Respond(*c, Packet, true)) {
|
||||||
|
beammp_errorf("Failed to send chat message back to sender (id {}) - did the sender disconnect?", ID);
|
||||||
|
// TODO: should we return an error here?
|
||||||
|
}
|
||||||
Result.first = true;
|
Result.first = true;
|
||||||
} else {
|
} else {
|
||||||
beammp_lua_error("SendChatMessage invalid argument [1] invalid ID");
|
beammp_lua_error("SendChatMessage invalid argument [1] invalid ID");
|
||||||
@ -521,7 +526,7 @@ static void JsonEncodeRecursive(nlohmann::json& json, const sol::object& left, c
|
|||||||
beammp_lua_error("json serialize will not go deeper than 100 nested tables, internal references assumed, aborted this path");
|
beammp_lua_error("json serialize will not go deeper than 100 nested tables, internal references assumed, aborted this path");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::string key;
|
std::string key{};
|
||||||
switch (left.get_type()) {
|
switch (left.get_type()) {
|
||||||
case sol::type::lua_nil:
|
case sol::type::lua_nil:
|
||||||
case sol::type::none:
|
case sol::type::none:
|
||||||
@ -540,6 +545,8 @@ static void JsonEncodeRecursive(nlohmann::json& json, const sol::object& left, c
|
|||||||
case sol::type::number:
|
case sol::type::number:
|
||||||
key = std::to_string(left.as<double>());
|
key = std::to_string(left.as<double>());
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
beammp_assert_not_reachable();
|
||||||
}
|
}
|
||||||
nlohmann::json value;
|
nlohmann::json value;
|
||||||
switch (right.get_type()) {
|
switch (right.get_type()) {
|
||||||
@ -582,6 +589,8 @@ static void JsonEncodeRecursive(nlohmann::json& json, const sol::object& left, c
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
beammp_assert_not_reachable();
|
||||||
}
|
}
|
||||||
if (is_array) {
|
if (is_array) {
|
||||||
json.push_back(value);
|
json.push_back(value);
|
||||||
|
@ -167,7 +167,7 @@ void TConfig::TryReadValue(toml::value& Table, const std::string& Category, cons
|
|||||||
|
|
||||||
void TConfig::TryReadValue(toml::value& Table, const std::string& Category, const std::string_view& Key, int& OutValue) {
|
void TConfig::TryReadValue(toml::value& Table, const std::string& Category, const std::string_view& Key, int& OutValue) {
|
||||||
if (Table[Category.c_str()][Key.data()].is_integer()) {
|
if (Table[Category.c_str()][Key.data()].is_integer()) {
|
||||||
OutValue = Table[Category.c_str()][Key.data()].as_integer();
|
OutValue = int(Table[Category.c_str()][Key.data()].as_integer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +62,7 @@ static inline void SplitString(std::string const& str, const char delim, std::ve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string GetDate() {
|
||||||
std::string GetDate() {
|
|
||||||
std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
|
std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
|
||||||
time_t tt = std::chrono::system_clock::to_time_t(now);
|
time_t tt = std::chrono::system_clock::to_time_t(now);
|
||||||
auto local_tm = std::localtime(&tt);
|
auto local_tm = std::localtime(&tt);
|
||||||
@ -156,10 +155,10 @@ void TConsole::ChangeToLuaConsole(const std::string& LuaStateId) {
|
|||||||
mStateId = LuaStateId;
|
mStateId = LuaStateId;
|
||||||
mIsLuaConsole = true;
|
mIsLuaConsole = true;
|
||||||
if (mStateId != mDefaultStateId) {
|
if (mStateId != mDefaultStateId) {
|
||||||
Application::Console().WriteRaw("Attached to Lua state '" + mStateId + "'. For help, type `:help`. To detach, type `:detach`");
|
Application::Console().WriteRaw("Attached to Lua state '" + mStateId + "'. For help, type `:help`. To detach, type `:exit`");
|
||||||
mCommandline.set_prompt("lua @" + LuaStateId + "> ");
|
mCommandline.set_prompt("lua @" + LuaStateId + "> ");
|
||||||
} else {
|
} else {
|
||||||
Application::Console().WriteRaw("Attached to Lua. For help, type `:help`. To detach, type `:detach`");
|
Application::Console().WriteRaw("Attached to Lua. For help, type `:help`. To detach, type `:exit`");
|
||||||
mCommandline.set_prompt("lua> ");
|
mCommandline.set_prompt("lua> ");
|
||||||
}
|
}
|
||||||
mCachedRegularHistory = mCommandline.history();
|
mCachedRegularHistory = mCommandline.history();
|
||||||
@ -271,9 +270,10 @@ void TConsole::Command_Kick(const std::string&, const std::vector<std::string>&
|
|||||||
}
|
}
|
||||||
beammp_trace("attempt to kick '" + Name + "' for '" + Reason + "'");
|
beammp_trace("attempt to kick '" + Name + "' for '" + Reason + "'");
|
||||||
bool Kicked = false;
|
bool Kicked = false;
|
||||||
|
// TODO: this sucks, tolower is locale-dependent.
|
||||||
auto NameCompare = [](std::string Name1, std::string Name2) -> bool {
|
auto NameCompare = [](std::string Name1, std::string Name2) -> bool {
|
||||||
std::for_each(Name1.begin(), Name1.end(), [](char& c) { c = tolower(c); });
|
std::for_each(Name1.begin(), Name1.end(), [](char& c) { c = char(std::tolower(char(c))); });
|
||||||
std::for_each(Name2.begin(), Name2.end(), [](char& c) { c = tolower(c); });
|
std::for_each(Name2.begin(), Name2.end(), [](char& c) { c = char(std::tolower(char(c))); });
|
||||||
return StringStartsWith(Name1, Name2) || StringStartsWith(Name2, Name1);
|
return StringStartsWith(Name1, Name2) || StringStartsWith(Name2, Name1);
|
||||||
};
|
};
|
||||||
mLuaEngine->Server().ForEachClient([&](std::weak_ptr<TClient> Client) -> bool {
|
mLuaEngine->Server().ForEachClient([&](std::weak_ptr<TClient> Client) -> bool {
|
||||||
@ -332,7 +332,9 @@ std::tuple<std::string, std::vector<std::string>> TConsole::ParseCommand(const s
|
|||||||
}
|
}
|
||||||
++Ptr;
|
++Ptr;
|
||||||
}
|
}
|
||||||
Arg = std::string(PrevPtr, Ptr - PrevPtr);
|
// this is required, otherwise we get negative int to unsigned cast in the next operations
|
||||||
|
beammp_assert(PrevPtr <= Ptr);
|
||||||
|
Arg = std::string(PrevPtr, std::string::size_type(Ptr - PrevPtr));
|
||||||
// remove quotes if enclosed in quotes
|
// remove quotes if enclosed in quotes
|
||||||
for (char Quote : { '"', '\'', '`' }) {
|
for (char Quote : { '"', '\'', '`' }) {
|
||||||
if (!Arg.empty() && Arg.at(0) == Quote && Arg.at(Arg.size() - 1) == Quote) {
|
if (!Arg.empty() && Arg.at(0) == Quote && Arg.at(Arg.size() - 1) == Quote) {
|
||||||
@ -448,6 +450,8 @@ void TConsole::Command_Status(const std::string&, const std::vector<std::string>
|
|||||||
SystemsShutdown++;
|
SystemsShutdown++;
|
||||||
SystemsShutdownList += NameStatusPair.first + ", ";
|
SystemsShutdownList += NameStatusPair.first + ", ";
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
beammp_assert_not_reachable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// remove ", " at the end
|
// remove ", " at the end
|
||||||
@ -466,7 +470,7 @@ void TConsole::Command_Status(const std::string&, const std::vector<std::string>
|
|||||||
<< "\tConnected Players: " << ConnectedCount << "\n"
|
<< "\tConnected Players: " << ConnectedCount << "\n"
|
||||||
<< "\tGuests: " << GuestCount << "\n"
|
<< "\tGuests: " << GuestCount << "\n"
|
||||||
<< "\tCars: " << CarCount << "\n"
|
<< "\tCars: " << CarCount << "\n"
|
||||||
<< "\tUptime: " << ElapsedTime << "ms (~" << size_t(ElapsedTime / 1000.0 / 60.0 / 60.0) << "h) \n"
|
<< "\tUptime: " << ElapsedTime << "ms (~" << size_t(double(ElapsedTime) / 1000.0 / 60.0 / 60.0) << "h) \n"
|
||||||
<< "\tLua:\n"
|
<< "\tLua:\n"
|
||||||
<< "\t\tQueued results to check: " << mLuaEngine->GetResultsToCheckSize() << "\n"
|
<< "\t\tQueued results to check: " << mLuaEngine->GetResultsToCheckSize() << "\n"
|
||||||
<< "\t\tStates: " << mLuaEngine->GetLuaStateCount() << "\n"
|
<< "\t\tStates: " << mLuaEngine->GetLuaStateCount() << "\n"
|
||||||
@ -630,7 +634,7 @@ TConsole::TConsole() {
|
|||||||
beammp_error("Console died with: " + std::string(e.what()) + ". This could be a fatal error and could cause the server to terminate.");
|
beammp_error("Console died with: " + std::string(e.what()) + ". This could be a fatal error and could cause the server to terminate.");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mCommandline.on_autocomplete = [this](Commandline& c, std::string stub, int cursorPos) {
|
mCommandline.on_autocomplete = [this](Commandline&, std::string stub, int) {
|
||||||
std::vector<std::string> suggestions;
|
std::vector<std::string> suggestions;
|
||||||
try {
|
try {
|
||||||
if (mIsLuaConsole) { // if lua
|
if (mIsLuaConsole) { // if lua
|
||||||
@ -638,7 +642,7 @@ TConsole::TConsole() {
|
|||||||
beammp_info("Lua not started yet, please try again in a second");
|
beammp_info("Lua not started yet, please try again in a second");
|
||||||
} else {
|
} else {
|
||||||
std::string prefix {}; // stores non-table part of input
|
std::string prefix {}; // stores non-table part of input
|
||||||
for (size_t i = stub.length(); i > 0; i--) { //separate table from input
|
for (size_t i = stub.length(); i > 0; i--) { // separate table from input
|
||||||
if (!std::isalnum(stub[i - 1]) && stub[i - 1] != '_' && stub[i - 1] != '.') {
|
if (!std::isalnum(stub[i - 1]) && stub[i - 1] != '_' && stub[i - 1] != '.') {
|
||||||
prefix = stub.substr(0, i);
|
prefix = stub.substr(0, i);
|
||||||
stub = stub.substr(i);
|
stub = stub.substr(i);
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <httplib.h>
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@ -679,6 +678,8 @@ static void JsonDecodeRecursive(sol::state_view& StateView, sol::table& table, c
|
|||||||
return;
|
return;
|
||||||
case nlohmann::detail::value_t::discarded:
|
case nlohmann::detail::value_t::discarded:
|
||||||
return;
|
return;
|
||||||
|
default:
|
||||||
|
beammp_assert_not_reachable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ void TNetwork::UDPServerMain() {
|
|||||||
serverAddr.sin_port = htons(uint16_t(Application::Settings.Port)); // Convert from little to big endian
|
serverAddr.sin_port = htons(uint16_t(Application::Settings.Port)); // Convert from little to big endian
|
||||||
|
|
||||||
// Try and bind the socket to the IP and port
|
// Try and bind the socket to the IP and port
|
||||||
if (bind(mUDPSock, (sockaddr*)&serverAddr, sizeof(serverAddr)) != 0) {
|
if (bind(mUDPSock, reinterpret_cast<struct sockaddr*>(&serverAddr), sizeof(serverAddr)) != 0) {
|
||||||
beammp_error("bind() failed: " + GetPlatformAgnosticErrorString());
|
beammp_error("bind() failed: " + GetPlatformAgnosticErrorString());
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(5));
|
std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||||
exit(-1); // TODO: Wtf.
|
exit(-1); // TODO: Wtf.
|
||||||
@ -134,7 +134,7 @@ void TNetwork::TCPServerMain() {
|
|||||||
addr.sin_addr.s_addr = INADDR_ANY;
|
addr.sin_addr.s_addr = INADDR_ANY;
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
addr.sin_port = htons(uint16_t(Application::Settings.Port));
|
addr.sin_port = htons(uint16_t(Application::Settings.Port));
|
||||||
if (bind(Listener, (sockaddr*)&addr, sizeof(addr)) < 0) {
|
if (bind(Listener, reinterpret_cast<struct sockaddr*>(&addr), sizeof(addr)) < 0) {
|
||||||
beammp_error("bind() failed, the server cannot operate and will shut down now. "
|
beammp_error("bind() failed, the server cannot operate and will shut down now. "
|
||||||
"Error: "
|
"Error: "
|
||||||
+ GetPlatformAgnosticErrorString());
|
+ GetPlatformAgnosticErrorString());
|
||||||
@ -166,7 +166,7 @@ void TNetwork::TCPServerMain() {
|
|||||||
int ret = ::setsockopt(client.Socket, SOL_SOCKET, SO_SNDTIMEO, reinterpret_cast<const char*>(&SendTimeoutMS), sizeof(SendTimeoutMS));
|
int ret = ::setsockopt(client.Socket, SOL_SOCKET, SO_SNDTIMEO, reinterpret_cast<const char*>(&SendTimeoutMS), sizeof(SendTimeoutMS));
|
||||||
#else // POSIX
|
#else // POSIX
|
||||||
struct timeval optval;
|
struct timeval optval;
|
||||||
optval.tv_sec = (int)(SendTimeoutMS / 1000);
|
optval.tv_sec = int(SendTimeoutMS / 1000);
|
||||||
optval.tv_usec = (SendTimeoutMS % 1000) * 1000;
|
optval.tv_usec = (SendTimeoutMS % 1000) * 1000;
|
||||||
ret = ::setsockopt(client.Socket, SOL_SOCKET, SO_SNDTIMEO, reinterpret_cast<void*>(&optval), sizeof(optval));
|
ret = ::setsockopt(client.Socket, SOL_SOCKET, SO_SNDTIMEO, reinterpret_cast<void*>(&optval), sizeof(optval));
|
||||||
#endif
|
#endif
|
||||||
@ -237,13 +237,13 @@ void TNetwork::HandleDownload(SOCKET TCPSock) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_ip_str(const struct sockaddr* sa, char* strBuf, size_t strBufSize) {
|
static int get_ip_str(const struct sockaddr* sa, char* strBuf, socklen_t strBufSize) {
|
||||||
switch (sa->sa_family) {
|
switch (sa->sa_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
inet_ntop(AF_INET, &(((struct sockaddr_in*)sa)->sin_addr), strBuf, strBufSize);
|
inet_ntop(AF_INET, &reinterpret_cast<const struct sockaddr_in*>(sa)->sin_addr, strBuf, strBufSize);
|
||||||
break;
|
break;
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
inet_ntop(AF_INET6, &(((struct sockaddr_in6*)sa)->sin6_addr), strBuf, strBufSize);
|
inet_ntop(AF_INET6, &reinterpret_cast<const struct sockaddr_in6*>(sa)->sin6_addr, strBuf, strBufSize);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 1;
|
return 1;
|
||||||
@ -453,7 +453,7 @@ bool TNetwork::CheckBytes(TClient& c, int32_t BytesRcv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string TNetwork::TCPRcv(TClient& c) {
|
std::string TNetwork::TCPRcv(TClient& c) {
|
||||||
int32_t Header, BytesRcv = 0, Temp;
|
int32_t Header {}, BytesRcv = 0, Temp {};
|
||||||
if (c.GetStatus() < 0)
|
if (c.GetStatus() < 0)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ std::string TNetwork::TCPRcv(TClient& c) {
|
|||||||
if (!CheckBytes(c, BytesRcv)) {
|
if (!CheckBytes(c, BytesRcv)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if (Header < 100 * MB) {
|
if (Header < int32_t(100 * MB)) {
|
||||||
Data.resize(Header);
|
Data.resize(Header);
|
||||||
} else {
|
} else {
|
||||||
ClientKick(c, "Header size limit exceeded");
|
ClientKick(c, "Header size limit exceeded");
|
||||||
@ -822,7 +822,6 @@ uint8_t* /* end ptr */ TNetwork::SendSplit(TClient& c, SOCKET Socket, uint8_t* D
|
|||||||
|
|
||||||
void TNetwork::SplitLoad(TClient& c, size_t Sent, size_t Size, bool D, const std::string& Name) {
|
void TNetwork::SplitLoad(TClient& c, size_t Sent, size_t Size, bool D, const std::string& Name) {
|
||||||
std::ifstream f(Name.c_str(), std::ios::binary);
|
std::ifstream f(Name.c_str(), std::ios::binary);
|
||||||
auto Buf = f.rdbuf();
|
|
||||||
uint32_t Split = 125 * MB;
|
uint32_t Split = 125 * MB;
|
||||||
std::vector<uint8_t> Data;
|
std::vector<uint8_t> Data;
|
||||||
if (Size > Split)
|
if (Size > Split)
|
||||||
@ -1018,7 +1017,7 @@ bool TNetwork::UDPSend(TClient& Client, std::string Data) const {
|
|||||||
size_t len = Data.size();
|
size_t len = Data.size();
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
sendOk = sendto(mUDPSock, Data.c_str(), len, 0, (sockaddr*)&Addr, int(AddrSize));
|
sendOk = sendto(mUDPSock, Data.c_str(), len, 0, reinterpret_cast<struct sockaddr*>(&Addr), int(AddrSize));
|
||||||
if (sendOk == -1) {
|
if (sendOk == -1) {
|
||||||
beammp_debug("(UDP) sendto() failed: " + GetPlatformAgnosticErrorString());
|
beammp_debug("(UDP) sendto() failed: " + GetPlatformAgnosticErrorString());
|
||||||
if (Client.GetStatus() > -1)
|
if (Client.GetStatus() > -1)
|
||||||
@ -1039,7 +1038,7 @@ std::string TNetwork::UDPRcvFromClient(sockaddr_in& client) const {
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
auto Rcv = recvfrom(mUDPSock, Ret.data(), int(Ret.size()), 0, (sockaddr*)&client, (int*)&clientLength);
|
auto Rcv = recvfrom(mUDPSock, Ret.data(), int(Ret.size()), 0, (sockaddr*)&client, (int*)&clientLength);
|
||||||
#else // unix
|
#else // unix
|
||||||
int64_t Rcv = recvfrom(mUDPSock, Ret.data(), Ret.size(), 0, (sockaddr*)&client, (socklen_t*)&clientLength);
|
int64_t Rcv = recvfrom(mUDPSock, Ret.data(), Ret.size(), 0, reinterpret_cast<struct sockaddr*>(&client), reinterpret_cast<socklen_t*>(&clientLength));
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
if (Rcv == -1) {
|
if (Rcv == -1) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
TSentry::TSentry() {
|
TSentry::TSentry() {
|
||||||
if (std::strlen(S_DSN) == 0) {
|
if (std::strlen(S_DSN) == /* DISABLES CODE */ (0)) {
|
||||||
mValid = false;
|
mValid = false;
|
||||||
} else {
|
} else {
|
||||||
mValid = true;
|
mValid = true;
|
||||||
|
@ -24,8 +24,8 @@ static std::optional<std::pair<int, int>> GetPidVid(const std::string& str) {
|
|||||||
try {
|
try {
|
||||||
int PID = stoi(pid);
|
int PID = stoi(pid);
|
||||||
int VID = stoi(vid);
|
int VID = stoi(vid);
|
||||||
return {{ PID, VID }};
|
return { { PID, VID } };
|
||||||
} catch(const std::exception&) {
|
} catch (const std::exception&) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +75,6 @@ TEST_CASE("GetPidVid") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TServer::TServer(const std::vector<std::string_view>& Arguments) {
|
TServer::TServer(const std::vector<std::string_view>& Arguments) {
|
||||||
beammp_info("BeamMP Server v" + Application::ServerVersionString());
|
beammp_info("BeamMP Server v" + Application::ServerVersionString());
|
||||||
Application::SetSubsystemStatus("Server", Application::Status::Starting);
|
Application::SetSubsystemStatus("Server", Application::Status::Starting);
|
||||||
@ -256,7 +255,7 @@ void TServer::ParseVehicle(TClient& c, const std::string& Pckt, TNetwork& Networ
|
|||||||
std::string Packet = Pckt;
|
std::string Packet = Pckt;
|
||||||
char Code = Packet.at(1);
|
char Code = Packet.at(1);
|
||||||
int PID = -1;
|
int PID = -1;
|
||||||
int VID = -1, Pos;
|
int VID = -1;
|
||||||
std::string Data = Packet.substr(3), pid, vid;
|
std::string Data = Packet.substr(3), pid, vid;
|
||||||
switch (Code) { // Spawned Destroyed Switched/Moved NotFound Reset
|
switch (Code) { // Spawned Destroyed Switched/Moved NotFound Reset
|
||||||
case 's':
|
case 's':
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include "ArgsParser.h"
|
#include "ArgsParser.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "CustomAssert.h"
|
|
||||||
#include "Http.h"
|
#include "Http.h"
|
||||||
#include "LuaAPI.h"
|
#include "LuaAPI.h"
|
||||||
#include "SignalHandling.h"
|
#include "SignalHandling.h"
|
||||||
@ -13,7 +12,6 @@
|
|||||||
#include "TPPSMonitor.h"
|
#include "TPPSMonitor.h"
|
||||||
#include "TPluginMonitor.h"
|
#include "TPluginMonitor.h"
|
||||||
#include "TResourceManager.h"
|
#include "TResourceManager.h"
|
||||||
#include "TScopedTimer.h"
|
|
||||||
#include "TServer.h"
|
#include "TServer.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -56,7 +54,7 @@ int BeamMPServerMain(MainArguments Arguments);
|
|||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
MainArguments Args { argc, argv, {}, argv[0] };
|
MainArguments Args { argc, argv, {}, argv[0] };
|
||||||
Args.List.reserve(argc);
|
Args.List.reserve(size_t(argc));
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
Args.List.push_back(argv[i]);
|
Args.List.push_back(argv[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user