From c55400849c2a991d9c10024db0ae697429e91e11 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 6 May 2018 23:46:25 +1000 Subject: [PATCH] Fix crashing on reconnect with C client --- src/Client/Screens.c | 2 +- src/Client/ServerConnection.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Client/Screens.c b/src/Client/Screens.c index d53fd2c85..a4c072fa3 100644 --- a/src/Client/Screens.c +++ b/src/Client/Screens.c @@ -1520,7 +1520,7 @@ bool DisconnectScreen_HandlesMouseDown(GuiElement* elem, Int32 x, Int32 y, Mouse if (!widget->Disabled && Widget_Contains((Widget*)widget, x, y)) { UInt8 connectBuffer[String_BufferSize(STRING_SIZE)]; - String connect = String_FromConst(connectBuffer); + String connect = String_InitAndClearArray(connectBuffer); String empty = String_MakeNull(); String_Format2(&connect, "Connecting to %s: %i..", &Game_IPAddress, &Game_Port); diff --git a/src/Client/ServerConnection.c b/src/Client/ServerConnection.c index 43ca2c89a..6d553955e 100644 --- a/src/Client/ServerConnection.c +++ b/src/Client/ServerConnection.c @@ -492,7 +492,7 @@ void ServerConnection_InitMultiplayer(void) { void MPConnection_OnNewMap(void) { - if (!ServerConnection_IsSinglePlayer) return; + if (ServerConnection_IsSinglePlayer) return; /* wipe all existing entity states */ Int32 i; for (i = 0; i < ENTITIES_MAX_COUNT; i++) { @@ -501,7 +501,7 @@ void MPConnection_OnNewMap(void) { } void MPConnection_Reset(void) { - if (!ServerConnection_IsSinglePlayer) return; + if (ServerConnection_IsSinglePlayer) return; Int32 i; for (i = 0; i < OPCODE_COUNT; i++) { Net_Handlers[i] = NULL;