1.1 --- a/plugins/rockthevote.sp Mon Oct 08 21:55:20 2007 +0000
1.2 +++ b/plugins/rockthevote.sp Mon Oct 08 22:13:17 2007 +0000
1.3 @@ -340,38 +340,47 @@
1.4 new Handle:MapVoteMenu = CreateMenu(Handler_MapMapVoteMenu, MenuAction:MENU_ACTIONS_ALL);
1.5 SetMenuTitle(MapVoteMenu, "Rock The Vote");
1.6
1.7 - new limit = (GetArraySize(g_RTVMapList) < GetConVarInt(g_Cvar_Maps) ? GetArraySize(g_RTVMapList) : GetConVarInt(g_Cvar_Maps));
1.8 - for (new i = 0; i < limit; i++)
1.9 - {
1.10 - decl String:rtvmap[64];
1.11 - GetArrayString(g_RTVMapList, i, rtvmap, sizeof(rtvmap));
1.12 - AddMenuItem(MapVoteMenu, rtvmap, rtvmap);
1.13 - }
1.14 + new Handle:tempMaps = CreateArray(33);
1.15 + decl String:map[32];
1.16 + for (new i = 0; i < GetArraySize(g_MapList); i++)
1.17 + {
1.18 + GetArrayString(g_MapList, i, map, sizeof(map));
1.19 + PushArrayString(tempMaps, map);
1.20 + }
1.21 +
1.22 + // We assume that g_RTVMapList is within the correct limits, based on the logic for nominations
1.23 + for (new i = 0; i < GetArraySize(g_RTVMapList); i++)
1.24 + {
1.25 + GetArrayString(g_RTVMapList, i, map, sizeofmap));
1.26 + AddMenuItem(MapVoteMenu, map, map);
1.27 +
1.28 + for (new j = 0; j < GetArraySize(tempMaps); j++)
1.29 + {
1.30 + decl String:temp[32];
1.31 + GetArrayString(tempMaps, j, temp, sizeof(temp));
1.32 + if (strcmp(map, temp) == 0)
1.33 + {
1.34 + RemoveFromArray(tempMaps, j);
1.35 + break;
1.36 + }
1.37 + }
1.38 + }
1.39 +
1.40 + new limit = GetConVarInt(g_Cvar_Maps) - GetArraySize(g_RTVMapList);
1.41 + if (limit > GetArraySize(tempMaps))
1.42 + {
1.43 + limit = GetArraySize(tempMaps);
1.44 + }
1.45
1.46 - limit = (GetArraySize(g_MapList) < GetConVarInt(g_Cvar_Maps) ? GetArraySize(g_MapList) : GetConVarInt(g_Cvar_Maps));
1.47 - limit -= GetMenuItemCount(MapVoteMenu);
1.48 -
1.49 - if (limit < 0)
1.50 + for (new i = 0; i < limit; i++)
1.51 {
1.52 - limit = 0;
1.53 - }
1.54 + new b = GetRandomInt(0, GetArraySize(tempMaps) - 1);
1.55 + GetArrayString(tempMaps, b, map, sizeof(map));
1.56 + PushArrayString(g_RTVMapList, map);
1.57 + AddMenuItem(MapVoteMenu, map, map);
1.58 + RemoveFromArray(tempMaps, b);
1.59 + }
1.60
1.61 - for (new i = 0; i < limit; i++)
1.62 - {
1.63 - decl String:map[64];
1.64 - new b = GetRandomInt(0, GetArraySize(g_MapList) - 1);
1.65 - GetArrayString(g_MapList, b, map, sizeof(map));
1.66 -
1.67 - while (IsStringInArray(g_RTVMapList, map))
1.68 - {
1.69 - b = GetRandomInt(0, GetArraySize(g_MapList) - 1);
1.70 - GetArrayString(g_MapList, b, map, sizeof(map));
1.71 - }
1.72 -
1.73 - PushArrayString(g_RTVMapList, map);
1.74 - AddMenuItem(MapVoteMenu, map, map);
1.75 - }
1.76 -
1.77 AddMenuItem(MapVoteMenu, "Don't Change", "Don't Change");
1.78
1.79 SetMenuExitButton(MapVoteMenu, false);