Check if map is compatible to avoid script crash

This commit is contained in:
Beu 2022-03-08 17:38:33 +01:00
parent 3124754b1e
commit 405bd533f8

View File

@ -221,6 +221,19 @@ Net_CurrentRoundNb = Map_ValidRoundsNb + 1;
declare Text[] AccountIdsOfPlayers for This = [];
declare CMapLandmark[] Landmarks = Map::GetFinishesAndMultilaps();
declare Boolean MapIsCompatible;
foreach (Landmark in Landmarks) {
if (Map::IsMultilap(Landmark)) {
MapIsCompatible = True;
break;
}
}
if (!MapIsCompatible) {
UIManager.UIAll.QueueMessage(3000, 1, CUIConfig::EMessageDisplay::Big, _("This map is not valid"));
MB_Sleep(3000);
MB_StopMap();
} else {
declare CMapLandmark PlayerLM;
declare Integer LandmarkIndex for This = 0;
AccountIdsOfPlayers = [];
@ -263,6 +276,7 @@ StateMgr::ForcePlayersStates([StateMgr::C_State_Playing]);
CarRank::Update(CarRank::C_SortCriteria_BestRace);
Race::EnableIntroDuringMatch(False);
UIManager.UIAll.SendChat("$<$ff3$> Stay the most time on the structure. $<$ff9GL HF!$>");
}
***
***Match_PlayLoop***