From d7e9ff19ee9d30d92845285770f43f2ee4c79ea3 Mon Sep 17 00:00:00 2001 From: Diavolo Date: Thu, 16 Jun 2022 18:19:51 +0200 Subject: [PATCH] [MapRotation] Fix SVRandomMapRotation --- src/Components/Modules/MapRotation.cpp | 22 +++++++++++++++------- src/Components/Modules/MapRotation.hpp | 1 + 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Components/Modules/MapRotation.cpp b/src/Components/Modules/MapRotation.cpp index b420832c..006b4d2b 100644 --- a/src/Components/Modules/MapRotation.cpp +++ b/src/Components/Modules/MapRotation.cpp @@ -109,13 +109,6 @@ namespace Components Logger::DebugInfo("DedicatedRotation size after parsing is '{}'\n", DedicatedRotation.getEntriesSize()); - // Shuffles values - if (SVRandomMapRotation.get()) - { - Logger::Print(Game::CON_CHANNEL_SERVER, "Randomizing the map rotation\n"); - DedicatedRotation.randomize(); - } - loaded = true; } @@ -210,6 +203,19 @@ namespace Components } } + void MapRotation::RandomizeMapRotation() + { + if (SVRandomMapRotation.get()) + { + Logger::Print(Game::CON_CHANNEL_SERVER, "Randomizing the map rotation\n"); + DedicatedRotation.randomize(); + } + else + { + Logger::DebugInfo("Map rotation was not randomized"); + } + } + void MapRotation::SV_MapRotate_f() { if (!ShouldRotate()) @@ -234,6 +240,8 @@ namespace Components return; } + RandomizeMapRotation(); + ApplyMapRotation(); } diff --git a/src/Components/Modules/MapRotation.hpp b/src/Components/Modules/MapRotation.hpp index bf9a1cca..7cee6255 100644 --- a/src/Components/Modules/MapRotation.hpp +++ b/src/Components/Modules/MapRotation.hpp @@ -60,6 +60,7 @@ namespace Components static bool ShouldRotate(); static void RestartCurrentMap(); static void ApplyMapRotation(); + static void RandomizeMapRotation(); static void SV_MapRotate_f(); };