From a5f7478b99a94947d27cf152217aa4a53b38352a Mon Sep 17 00:00:00 2001 From: aMannus Date: Wed, 18 Jan 2023 16:56:32 +0100 Subject: [PATCH 1/2] Fix CC connection bugs (#2367) --- soh/soh/Enhancements/crowd-control/CrowdControl.cpp | 8 +++++--- soh/soh/OTRGlobals.cpp | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/crowd-control/CrowdControl.cpp b/soh/soh/Enhancements/crowd-control/CrowdControl.cpp index 2f5b1a3ac..3fbd24a90 100644 --- a/soh/soh/Enhancements/crowd-control/CrowdControl.cpp +++ b/soh/soh/Enhancements/crowd-control/CrowdControl.cpp @@ -101,7 +101,7 @@ void CrowdControl::Disable() { void CrowdControl::ListenToServer() { while (isEnabled) { - while (!connected) { + while (!connected && isEnabled) { SPDLOG_TRACE("[CrowdControl] Attempting to make connection to server..."); tcpsock = SDLNet_TCP_Open(&ip); @@ -112,8 +112,10 @@ void CrowdControl::ListenToServer() { } } - auto socketSet = SDLNet_AllocSocketSet(1); - SDLNet_TCP_AddSocket(socketSet, tcpsock); + SDLNet_SocketSet socketSet = SDLNet_AllocSocketSet(1); + if (tcpsock) { + SDLNet_TCP_AddSocket(socketSet, tcpsock); + } // Listen to socket messages while (connected && tcpsock && isEnabled) { diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index a5b390870..9011fcc79 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -461,6 +461,11 @@ extern "C" void InitOTR() { #ifdef ENABLE_CROWD_CONTROL CrowdControl::Instance = new CrowdControl(); CrowdControl::Instance->Init(); + if (CVar_GetS32("gCrowdControl", 0)) { + CrowdControl::Instance->Enable(); + } else { + CrowdControl::Instance->Disable(); + } #endif } From 32ad0ab4b8f6fcd7a22c78d3176d4eebcee7950e Mon Sep 17 00:00:00 2001 From: David Chavez Date: Wed, 18 Jan 2023 19:21:38 +0100 Subject: [PATCH 2/2] Bump version --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 84da81a12..0f0f6b8df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,8 @@ set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE) project(Ship LANGUAGES C CXX - VERSION 5.1.3) -set(PROJECT_BUILD_NAME "BRADLEY DELTA" CACHE STRING "") + VERSION 5.1.4) +set(PROJECT_BUILD_NAME "BRADLEY ECHO" CACHE STRING "") set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "") set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT soh)