[MapRotation]: Last fix ever (#980)

This commit is contained in:
Edo 2023-04-26 23:02:17 +01:00 committed by GitHub
parent a60b06002b
commit 7f67cde8fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 19 deletions

View File

@ -126,7 +126,7 @@ namespace Components
return mapRotationJson;
}
void MapRotation::LoadRotation(const std::string& data)
void MapRotation::ParseRotation(const std::string& data)
{
try
{
@ -140,6 +140,19 @@ namespace Components
Logger::Debug("DedicatedRotation size after parsing is '{}'", DedicatedRotation.getEntriesSize());
}
void MapRotation::RandomizeMapRotation()
{
if (SVRandomMapRotation.get<bool>())
{
Logger::Print(Game::CON_CHANNEL_SERVER, "Randomizing the map rotation\n");
DedicatedRotation.randomize();
}
else
{
Logger::Debug("Map rotation was not randomized");
}
}
void MapRotation::LoadMapRotation()
{
static auto loaded = false;
@ -156,7 +169,8 @@ namespace Components
if (!mapRotation.empty())
{
Logger::Debug("{} is not empty. Parsing...", (*Game::sv_mapRotation)->name);
LoadRotation(mapRotation);
ParseRotation(mapRotation);
RandomizeMapRotation();
}
}
@ -341,19 +355,6 @@ namespace Components
SVNextMap.set("");
}
void MapRotation::RandomizeMapRotation()
{
if (SVRandomMapRotation.get<bool>())
{
Logger::Print(Game::CON_CHANNEL_SERVER, "Randomizing the map rotation\n");
DedicatedRotation.randomize();
}
else
{
Logger::Debug("Map rotation was not randomized");
}
}
void MapRotation::SV_MapRotate_f()
{
if (!ShouldRotate())
@ -382,8 +383,6 @@ namespace Components
return;
}
RandomizeMapRotation();
ApplyRotation(DedicatedRotation);
SetNextMap(DedicatedRotation);
}

View File

@ -84,7 +84,8 @@ namespace Components
// Holds the parsed data from sv_mapRotation
static RotationData DedicatedRotation;
static void LoadRotation(const std::string& data);
static void RandomizeMapRotation();
static void ParseRotation(const std::string& data);
static void LoadMapRotation();
// Use these commands before SV_MapRotate_f is called
@ -103,7 +104,6 @@ namespace Components
static void SetNextMap(RotationData& rotation); // Only call this after ApplyRotation
static void SetNextMap(const char* value);
static void ClearNextMap();
static void RandomizeMapRotation();
static void SV_MapRotate_f();
};