mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-02-16 10:41:01 +00:00
Fix various macOS compatibility issues
This commit is contained in:
committed by
Lion
parent
6247061d09
commit
1a2a123d87
@@ -118,7 +118,7 @@ void RegisterThread(const std::string& str) {
|
||||
#ifdef WIN32
|
||||
ThreadId = std::to_string(GetCurrentThreadId());
|
||||
#elif __APPLE__
|
||||
ThreadId = std::to_string(getpid());
|
||||
ThreadId = std::to_string(getpid()); // todo: research if 'getpid()' is a valid, posix compliant alternative to 'gettid()'
|
||||
#else
|
||||
ThreadId = std::to_string(gettid());
|
||||
#endif
|
||||
|
||||
@@ -42,7 +42,7 @@ static std::string LuaToString(const sol::object Value, size_t Indent = 1, bool
|
||||
ss << Value.as<float>();
|
||||
return ss.str();
|
||||
}
|
||||
case sol::type::nil:
|
||||
case sol::type::lua_nil:
|
||||
case sol::type::none:
|
||||
return "<nil>";
|
||||
case sol::type::boolean:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "SignalHandling.h"
|
||||
#include "Common.h"
|
||||
|
||||
#ifdef __unix
|
||||
#if defined(__unix) || defined(__linux) || defined(__APPLE__)
|
||||
#include <csignal>
|
||||
static void UnixSignalHandler(int sig) {
|
||||
switch (sig) {
|
||||
@@ -48,7 +48,7 @@ BOOL WINAPI Win32CtrlC_Handler(DWORD CtrlType) {
|
||||
|
||||
void SetupSignalHandlers() {
|
||||
// signal handlers for unix#include <windows.h>
|
||||
#if defined(__unix) || defined(__linux)
|
||||
#if defined(__unix) || defined(__linux) || defined(__APPLE__)
|
||||
beammp_trace("registering handlers for signals");
|
||||
signal(SIGPIPE, UnixSignalHandler);
|
||||
signal(SIGTERM, UnixSignalHandler);
|
||||
|
||||
@@ -281,7 +281,7 @@ sol::table TLuaEngine::StateThreadData::Lua_TriggerGlobalEvent(const std::string
|
||||
auto Vector = Self.get<std::vector<std::shared_ptr<TLuaResult>>>("ReturnValueImpl");
|
||||
for (const auto& Value : Vector) {
|
||||
if (!Value->Ready) {
|
||||
return sol::nil;
|
||||
return sol::lua_nil;
|
||||
}
|
||||
Result.add(Value->Result);
|
||||
}
|
||||
@@ -313,7 +313,7 @@ sol::table TLuaEngine::StateThreadData::Lua_GetPlayerIdentifiers(int ID) {
|
||||
if (MaybeClient && !MaybeClient.value().expired()) {
|
||||
auto IDs = MaybeClient.value().lock()->GetIdentifiers();
|
||||
if (IDs.empty()) {
|
||||
return sol::nil;
|
||||
return sol::lua_nil;
|
||||
}
|
||||
sol::table Result = mStateView.create_table();
|
||||
for (const auto& Pair : IDs) {
|
||||
@@ -321,7 +321,7 @@ sol::table TLuaEngine::StateThreadData::Lua_GetPlayerIdentifiers(int ID) {
|
||||
}
|
||||
return Result;
|
||||
} else {
|
||||
return sol::nil;
|
||||
return sol::lua_nil;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ sol::table TLuaEngine::StateThreadData::Lua_GetPlayerVehicles(int ID) {
|
||||
VehicleData = *LockedData.VehicleData;
|
||||
} // End Vehicle Data Lock Scope
|
||||
if (VehicleData.empty()) {
|
||||
return sol::nil;
|
||||
return sol::lua_nil;
|
||||
}
|
||||
sol::state_view StateView(mState);
|
||||
sol::table Result = StateView.create_table();
|
||||
@@ -365,7 +365,7 @@ sol::table TLuaEngine::StateThreadData::Lua_GetPlayerVehicles(int ID) {
|
||||
}
|
||||
return Result;
|
||||
} else
|
||||
return sol::nil;
|
||||
return sol::lua_nil;
|
||||
}
|
||||
|
||||
sol::table TLuaEngine::StateThreadData::Lua_HttpCreateConnection(const std::string& host, uint16_t port) {
|
||||
|
||||
Reference in New Issue
Block a user