[MapRotation]: Fix bug (#977)

This commit is contained in:
Edo 2023-04-26 21:12:21 +01:00 committed by GitHub
parent 6c775ceb20
commit 0a5a585f34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,7 +134,7 @@ namespace Components
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
Logger::PrintError(Game::CON_CHANNEL_ERROR, "{}: {} contains invalid data!\n", ex.what(), (*Game::sv_mapRotation)->name); Logger::PrintError(Game::CON_CHANNEL_ERROR, "{}. {} contains invalid data!\n", ex.what(), (*Game::sv_mapRotation)->name);
} }
Logger::Debug("DedicatedRotation size after parsing is '{}'", DedicatedRotation.getEntriesSize()); Logger::Debug("DedicatedRotation size after parsing is '{}'", DedicatedRotation.getEntriesSize());
@ -286,9 +286,13 @@ namespace Components
assert(!data.empty()); assert(!data.empty());
// Ook, ook, eek // Ook, ook, eek
Logger::Warning(Game::CON_CHANNEL_SERVER, "You are using deprecated {}", (*Game::sv_mapRotationCurrent)->name); Logger::Warning(Game::CON_CHANNEL_SERVER, "You are using deprecated {}\n", (*Game::sv_mapRotationCurrent)->name);
RotationData rotationCurrent; RotationData rotationCurrent;
rotationCurrent.setHandler("map", ApplyMap);
rotationCurrent.setHandler("gametype", ApplyGametype);
rotationCurrent.setHandler("exec", ApplyExec);
try try
{ {
Logger::Debug("Parsing {}", (*Game::sv_mapRotationCurrent)->name); Logger::Debug("Parsing {}", (*Game::sv_mapRotationCurrent)->name);
@ -296,7 +300,7 @@ namespace Components
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
Logger::PrintError(Game::CON_CHANNEL_ERROR, "{}: {} contains invalid data!\n", ex.what(), (*Game::sv_mapRotationCurrent)->name); Logger::PrintError(Game::CON_CHANNEL_ERROR, "{}. {} contains invalid data!\n", ex.what(), (*Game::sv_mapRotationCurrent)->name);
} }
Game::Dvar_SetString(*Game::sv_mapRotationCurrent, ""); Game::Dvar_SetString(*Game::sv_mapRotationCurrent, "");
@ -407,11 +411,16 @@ namespace Components
{ {
Logger::Debug("Testing map rotation parsing..."); Logger::Debug("Testing map rotation parsing...");
const auto* normal = "map mp_highrise map mp_terminal map mp_firingrange map mp_trailerpark gametype dm map mp_shipment_long"; const auto* normal = "exec war.cfg map mp_highrise map mp_terminal map mp_firingrange map mp_trailerpark gametype dm map mp_shipment_long";
RotationData rotation;
rotation.setHandler("map", ApplyMap);
rotation.setHandler("gametype", ApplyGametype);
rotation.setHandler("exec", ApplyExec);
try try
{ {
DedicatedRotation.parse(normal); rotation.parse(normal);
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
@ -419,14 +428,14 @@ namespace Components
return false; return false;
} }
DedicatedRotation.clear(); rotation.clear();
const auto* mistake = "spdevmap mp_dome"; const auto* mistake = "spdevmap mp_dome";
auto success = false; auto success = false;
try try
{ {
DedicatedRotation.parse(mistake); rotation.parse(mistake);
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {