collecting stages uniquely
This commit is contained in:
@@ -1389,7 +1389,7 @@ public void OpenStageMenu(int client, const char[] mapName)
|
|||||||
menu.SetTitle("[UNLOZE Racetimer] Stages on: %s", mapName);
|
menu.SetTitle("[UNLOZE Racetimer] Stages on: %s", mapName);
|
||||||
menu.ExitBackButton = true;
|
menu.ExitBackButton = true;
|
||||||
|
|
||||||
int currentStage = -1;
|
ArrayList stages = new ArrayList();
|
||||||
for (int i = 0; i < g_hMapStageCategoryCvars.Length; i++)
|
for (int i = 0; i < g_hMapStageCategoryCvars.Length; i++)
|
||||||
{
|
{
|
||||||
MapStageCategoryCvars entry;
|
MapStageCategoryCvars entry;
|
||||||
@@ -1398,16 +1398,24 @@ public void OpenStageMenu(int client, const char[] mapName)
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (entry.stage != currentStage)
|
if (stages.FindValue(entry.stage) != -1)
|
||||||
{
|
{
|
||||||
currentStage = entry.stage;
|
continue;
|
||||||
|
}
|
||||||
|
stages.Push(entry.stage);
|
||||||
|
}
|
||||||
|
stages.Sort(Sort_Ascending, Sort_Integer);
|
||||||
|
|
||||||
|
for (int i = 0; i < stages.Length; i++)
|
||||||
|
{
|
||||||
|
int stage = stages.Get(i);
|
||||||
char info[16];
|
char info[16];
|
||||||
IntToString(currentStage, info, sizeof(info));
|
IntToString(stage, info, sizeof(info));
|
||||||
char display[32];
|
char display[32];
|
||||||
Format(display, sizeof(display), "Stage %i", currentStage);
|
Format(display, sizeof(display), "Stage %i", stage);
|
||||||
menu.AddItem(info, display);
|
menu.AddItem(info, display);
|
||||||
}
|
}
|
||||||
}
|
delete stages;
|
||||||
|
|
||||||
if (menu.ItemCount == 0)
|
if (menu.ItemCount == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user