Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit e44f4a1

Browse files
committed
unhide cursor in server mode and prevent server from stealing the cursor on sudden client disconnect while in activity
1 parent 2522d2f commit e44f4a1

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@ int main(int argc, char **argv) {
376376

377377
HandleMainArgs(argc, argv);
378378

379+
if (g_NetworkServer.IsServerModeEnabled()) {
380+
SDL_ShowCursor(SDL_ENABLE);
381+
}
382+
379383
g_PresetMan.LoadAllDataModules();
380384

381385
if (!System::IsInExternalModuleValidationMode()) {

Managers/UInputMan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ namespace RTE {
370370
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
371371

372372
void UInputMan::TrapMousePos(bool trap, int whichPlayer) {
373-
if (whichPlayer == Players::NoPlayer || m_ControlScheme.at(whichPlayer).GetDevice() == InputDevice::DEVICE_MOUSE_KEYB) {
373+
if (!IsInMultiplayerMode() && (whichPlayer == Players::NoPlayer || m_ControlScheme.at(whichPlayer).GetDevice() == InputDevice::DEVICE_MOUSE_KEYB)) {
374374
m_TrapMousePos = trap;
375375
SDL_SetRelativeMouseMode(static_cast<SDL_bool>(trap));
376376
}

Managers/WindowMan.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,9 @@ namespace RTE {
540540
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
541541

542542
void WindowMan::QueueWindowEvent(const SDL_Event &windowEvent) {
543+
if (g_UInputMan.IsInMultiplayerMode()) {
544+
return;
545+
}
543546
m_EventQueue.emplace_back(windowEvent);
544547
}
545548

0 commit comments

Comments
 (0)