diff --git a/.github/workflows/cmake-windows.yml b/.github/workflows/cmake-windows.yml index 9ea76a7..aa9b43b 100644 --- a/.github/workflows/cmake-windows.yml +++ b/.github/workflows/cmake-windows.yml @@ -44,4 +44,15 @@ jobs: name: BeamMP-Server.exe path: ${{github.workspace}}/build-windows/Release/BeamMP-Server.exe + - name: Build debug + working-directory: ${{github.workspace}}/build-windows + shell: bash + run: | + cmake --build . --config Debug + + - name: Archive debug artifacts + uses: actions/upload-artifact@v2 + with: + name: BeamMP-Server-debug.exe + path: ${{github.workspace}}/build-windows/Debug/BeamMP-Server.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index a2bdb67..6a36c83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,9 +41,25 @@ set(SENTRY_BUILD_SHARED_LIBS OFF) if (MSVC) set(SENTRY_BUILD_RUNTIMESTATIC ON) endif() -set(SENTRY_BACKEND breakpad) +message(STATUS "Checking for Sentry URL") +# this is set by the build system. +# IMPORTANT: if you're building from source, just leave this empty +if (NOT DEFINED BEAMMP_SECRET_SENTRY_URL) + message(WARNING "No sentry URL configured. Sentry logging is disabled for this build. \ + This is not an error, and if you're building the BeamMP-Server yourself, this is expected and can be ignored.") + set(BEAMMP_SECRET_SENTRY_URL "") + set(SENTRY_BACKEND none) +else() + string(LENGTH ${BEAMMP_SECRET_SENTRY_URL} URL_LEN) + message(STATUS "Sentry URL is length ${URL_LEN}") + set(SENTRY_BACKEND breakpad) +endif() add_subdirectory("deps/sentry-native") +if (MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") +endif () + message(STATUS "Setting compiler flags") if (WIN32) @@ -61,17 +77,6 @@ elseif (UNIX) endif (SANITIZE) endif () -message(STATUS "Checking for Sentry URL") -# this is set by the build system. -# IMPORTANT: if you're building from source, just leave this empty -if (NOT DEFINED BEAMMP_SECRET_SENTRY_URL) - message(WARNING "No sentry URL configured. Sentry logging is disabled for this build. \ - This is not an error, and if you're building the BeamMP-Server yourself, this is expected and can be ignored.") - set(BEAMMP_SECRET_SENTRY_URL "") -else() - string(LENGTH ${BEAMMP_SECRET_SENTRY_URL} URL_LEN) - message(STATUS "Sentry URL is length ${URL_LEN}") -endif() message(STATUS "Adding local source dependencies") # this has to happen before -DDEBUG since it wont compile properly with -DDEBUG diff --git a/Changelog.md b/Changelog.md index 28fb6cf..982c893 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,8 @@ # v3.0.1 - ADDED Backup URLs to UpdateCheck (will fail less often now) +- ADDED console cursor left and right movement (with arrow keys) and working HOME and END key (via github.com/lionkor/commandline) +- FIXED infinite snowmen / infinite unicycle spawning bug - FIXED a bug where, when run with --working-directory, the Server.log would still be in the original directory - FIXED a bug which could cause the plugin reload thread to spin at 100% if the reloaded plugin's didn't terminate - FIXED an issue which would cause servers to crash on mod download via SIGPIPE on POSIX diff --git a/deps/commandline b/deps/commandline index 0d3e107..71240f6 160000 --- a/deps/commandline +++ b/deps/commandline @@ -1 +1 @@ -Subproject commit 0d3e1073c1005270dfad851c1f8c59f4ce29d8c1 +Subproject commit 71240f634b211d830679e7d2841b897c7c30dad9 diff --git a/src/TConsole.cpp b/src/TConsole.cpp index 827881c..79d30a4 100644 --- a/src/TConsole.cpp +++ b/src/TConsole.cpp @@ -369,10 +369,6 @@ TConsole::TConsole() { mCommandline.set_history_limit(20); mCommandline.set_prompt("> "); BackupOldLog(); - bool success = mCommandline.enable_write_to_file("Server.log"); - if (!success) { - beammp_error("unable to open file for writing: \"Server.log\""); - } mCommandline.on_command = [this](Commandline& c) { try { auto cmd = c.get_command(); diff --git a/src/THeartbeatThread.cpp b/src/THeartbeatThread.cpp index f5be47b..6efdd74 100644 --- a/src/THeartbeatThread.cpp +++ b/src/THeartbeatThread.cpp @@ -121,6 +121,9 @@ void THeartbeatThread::operator()() { beammp_error("Backend REFUSED the auth key. " + Message); } } + if (isAuth) { + Application::SetSubsystemStatus("Heartbeat", Application::Status::Good); + } } } diff --git a/src/TServer.cpp b/src/TServer.cpp index a4328e2..cee40b3 100644 --- a/src/TServer.cpp +++ b/src/TServer.cpp @@ -174,7 +174,7 @@ bool TServer::IsUnicycle(TClient& c, const std::string& CarJson) { try { auto Car = nlohmann::json::parse(CarJson); const std::string jbm = "jbm"; - if (Car.contains(jbm) && Car["jbm"].is_string() && Car["jbm"] == "unicycle") { + if (Car.contains(jbm) && Car[jbm].is_string() && Car[jbm] == "unicycle") { return true; } } catch (const std::exception& e) { @@ -184,17 +184,12 @@ bool TServer::IsUnicycle(TClient& c, const std::string& CarJson) { } bool TServer::ShouldSpawn(TClient& c, const std::string& CarJson, int ID) { - - if (c.GetUnicycleID() > -1 && (c.GetCarCount() - 1) < Application::Settings.MaxCars) { - return true; - } - - if (IsUnicycle(c, CarJson)) { + if (IsUnicycle(c, CarJson) && c.GetUnicycleID() < 0) { c.SetUnicycleID(ID); return true; + } else { + return c.GetCarCount() < Application::Settings.MaxCars; } - - return Application::Settings.MaxCars > c.GetCarCount(); } void TServer::ParseVehicle(TClient& c, const std::string& Pckt, TNetwork& Network) { diff --git a/src/main.cpp b/src/main.cpp index a1c9354..8b2f3c5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -77,6 +77,7 @@ int main(int argc, char** argv) { int BeamMPServerMain(MainArguments Arguments) { setlocale(LC_ALL, "C"); + Application::InitializeConsole(); ArgsParser Parser; Parser.RegisterArgument({ "help" }, ArgsParser::NONE); Parser.RegisterArgument({ "version" }, ArgsParser::NONE); @@ -116,9 +117,12 @@ int BeamMPServerMain(MainArguments Arguments) { } } } - - Application::InitializeConsole(); + Application::SetSubsystemStatus("Main", Application::Status::Starting); + bool Success = Application::Console().Internal().enable_write_to_file("Server.log"); + if (!Success) { + beammp_error("unable to open file for writing: \"Server.log\""); + } SetupSignalHandlers();