Merge pull request #308 from diamante0018/develop
[MapRotation] Allow people to have empty sv_mapRotation
This commit is contained in:
commit
e8aadc2382
@ -109,13 +109,6 @@ namespace Components
|
||||
|
||||
Logger::DebugInfo("DedicatedRotation size after parsing is '{}'\n", DedicatedRotation.getEntriesSize());
|
||||
|
||||
// Shuffles values
|
||||
if (SVRandomMapRotation.get<bool>())
|
||||
{
|
||||
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<bool>())
|
||||
{
|
||||
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())
|
||||
@ -220,22 +226,22 @@ namespace Components
|
||||
Logger::Print(Game::CON_CHANNEL_SERVER, "Rotating map...\n");
|
||||
const std::string mapRotation = (*SVMapRotation)->current.string;
|
||||
|
||||
if (mapRotation.empty())
|
||||
// People may have sv_mapRotation empty because they only use 'addMap' or 'addMap'
|
||||
if (!mapRotation.empty())
|
||||
{
|
||||
Logger::Print(Game::CON_CHANNEL_SERVER, "No rotation defined (sv_mapRotation is empty), restarting map.\n");
|
||||
RestartCurrentMap();
|
||||
return;
|
||||
Logger::DebugInfo("sv_mapRotation is not empty. Parsing...");
|
||||
LoadRotation(mapRotation);
|
||||
}
|
||||
|
||||
LoadRotation(mapRotation);
|
||||
|
||||
if (DedicatedRotation.getEntriesSize() == 0)
|
||||
{
|
||||
Logger::Print(Game::CON_CHANNEL_SERVER, "sv_mapRotation is empty or contains invalid data, restarting map.\n");
|
||||
Logger::Print(Game::CON_CHANNEL_SERVER, "sv_mapRotation is empty or contains invalid data. Restarting map\n");
|
||||
RestartCurrentMap();
|
||||
return;
|
||||
}
|
||||
|
||||
RandomizeMapRotation();
|
||||
|
||||
ApplyMapRotation();
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,7 @@ namespace Components
|
||||
static bool ShouldRotate();
|
||||
static void RestartCurrentMap();
|
||||
static void ApplyMapRotation();
|
||||
static void RandomizeMapRotation();
|
||||
|
||||
static void SV_MapRotate_f();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user