[MapRotation]: Last fix ever (#980)
This commit is contained in:
parent
a60b06002b
commit
7f67cde8fd
@ -126,7 +126,7 @@ namespace Components
|
|||||||
return mapRotationJson;
|
return mapRotationJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapRotation::LoadRotation(const std::string& data)
|
void MapRotation::ParseRotation(const std::string& data)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -140,6 +140,19 @@ namespace Components
|
|||||||
Logger::Debug("DedicatedRotation size after parsing is '{}'", DedicatedRotation.getEntriesSize());
|
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()
|
void MapRotation::LoadMapRotation()
|
||||||
{
|
{
|
||||||
static auto loaded = false;
|
static auto loaded = false;
|
||||||
@ -156,7 +169,8 @@ namespace Components
|
|||||||
if (!mapRotation.empty())
|
if (!mapRotation.empty())
|
||||||
{
|
{
|
||||||
Logger::Debug("{} is not empty. Parsing...", (*Game::sv_mapRotation)->name);
|
Logger::Debug("{} is not empty. Parsing...", (*Game::sv_mapRotation)->name);
|
||||||
LoadRotation(mapRotation);
|
ParseRotation(mapRotation);
|
||||||
|
RandomizeMapRotation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,19 +355,6 @@ namespace Components
|
|||||||
SVNextMap.set("");
|
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()
|
void MapRotation::SV_MapRotate_f()
|
||||||
{
|
{
|
||||||
if (!ShouldRotate())
|
if (!ShouldRotate())
|
||||||
@ -382,8 +383,6 @@ namespace Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RandomizeMapRotation();
|
|
||||||
|
|
||||||
ApplyRotation(DedicatedRotation);
|
ApplyRotation(DedicatedRotation);
|
||||||
SetNextMap(DedicatedRotation);
|
SetNextMap(DedicatedRotation);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,8 @@ namespace Components
|
|||||||
// Holds the parsed data from sv_mapRotation
|
// Holds the parsed data from sv_mapRotation
|
||||||
static RotationData DedicatedRotation;
|
static RotationData DedicatedRotation;
|
||||||
|
|
||||||
static void LoadRotation(const std::string& data);
|
static void RandomizeMapRotation();
|
||||||
|
static void ParseRotation(const std::string& data);
|
||||||
static void LoadMapRotation();
|
static void LoadMapRotation();
|
||||||
|
|
||||||
// Use these commands before SV_MapRotate_f is called
|
// 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(RotationData& rotation); // Only call this after ApplyRotation
|
||||||
static void SetNextMap(const char* value);
|
static void SetNextMap(const char* value);
|
||||||
static void ClearNextMap();
|
static void ClearNextMap();
|
||||||
static void RandomizeMapRotation();
|
|
||||||
|
|
||||||
static void SV_MapRotate_f();
|
static void SV_MapRotate_f();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user