From 5dd83e7768384fcd0cdea3c3a4a01dd557ee224c Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 20 May 2023 08:36:53 +1000 Subject: [PATCH] Fix a server having \n in its software value not being parsed properly, causing all servers after it in the servers list to not appear --- src/Generator.c | 12 ++++-------- src/LWeb.c | 1 + src/Window_Win.c | 8 +++----- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/Generator.c b/src/Generator.c index 2bab70c23..5a7be402b 100644 --- a/src/Generator.c +++ b/src/Generator.c @@ -489,18 +489,16 @@ static void NotchyGen_CreateSurfaceLayer(void) { } static void NotchyGen_PlantFlowers(void) { - if (Game_Version.Version < VERSION_0023) { - return; - } - int numPatches; BlockRaw block; int patchX, patchZ; int flowerX, flowerY, flowerZ; int i, j, k, index; + if (Game_Version.Version < VERSION_0023) return; numPatches = World.Width * World.Length / 3000; Gen_CurrentState = "Planting flowers"; + for (i = 0; i < numPatches; i++) { Gen_CurrentProgress = (float)i / numPatches; @@ -527,18 +525,16 @@ static void NotchyGen_PlantFlowers(void) { } static void NotchyGen_PlantMushrooms(void) { - if (Game_Version.Version < VERSION_0023) { - return; - } - int numPatches, groundHeight; BlockRaw block; int patchX, patchY, patchZ; int mushX, mushY, mushZ; int i, j, k, index; + if (Game_Version.Version < VERSION_0023) return; numPatches = World.Volume / 2000; Gen_CurrentState = "Planting mushrooms"; + for (i = 0; i < numPatches; i++) { Gen_CurrentProgress = (float)i / numPatches; diff --git a/src/LWeb.c b/src/LWeb.c index 639a54cc3..641b764c0 100644 --- a/src/LWeb.c +++ b/src/LWeb.c @@ -89,6 +89,7 @@ static void Json_ConsumeString(struct JsonContext* ctx, cc_string* str) { if (!ctx->left) break; c = *ctx->cur; JsonContext_Consume(ctx, 1); if (c == '/' || c == '\\' || c == '"') { String_Append(str, c); continue; } + if (c == 'n') { String_Append(str, '\n'); continue; } /* form of \uYYYY */ if (c != 'u' || ctx->left < 4) break; diff --git a/src/Window_Win.c b/src/Window_Win.c index b9890327b..fdd4087dd 100644 --- a/src/Window_Win.c +++ b/src/Window_Win.c @@ -745,14 +745,11 @@ static void GLContext_SelectGraphicsMode(struct GraphicsMode* mode) { pfd.nVersion = 1; pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER; /* TODO: PFD_SUPPORT_COMPOSITION FLAG? CHECK IF IT WORKS ON XP */ + pfd.cColorBits = mode->R + mode->G + mode->B; pfd.cDepthBits = GLCONTEXT_DEFAULT_DEPTH; - pfd.iPixelType = PFD_TYPE_RGBA; - pfd.cRedBits = mode->R; // TODO unnecessary?? - pfd.cGreenBits = mode->G; - pfd.cBlueBits = mode->B; - pfd.cAlphaBits = mode->A; + pfd.cAlphaBits = mode->A; /* TODO not needed? test on Intel */ modeIndex = ChoosePixelFormat(win_DC, &pfd); if (modeIndex == 0) { Logger_Abort("Requested graphics mode not available"); } @@ -761,6 +758,7 @@ static void GLContext_SelectGraphicsMode(struct GraphicsMode* mode) { pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); pfd.nVersion = 1; + /* TODO DescribePixelFormat might be unnecessary? */ DescribePixelFormat(win_DC, modeIndex, pfd.nSize, &pfd); if (!SetPixelFormat(win_DC, modeIndex, &pfd)) { Logger_Abort2(GetLastError(), "SetPixelFormat failed");