1.1 --- a/plugins/mapchooser.sp Fri Nov 09 18:08:09 2007 +0000
1.2 +++ b/plugins/mapchooser.sp Fri Nov 09 23:46:05 2007 +0000
1.3 @@ -83,9 +83,10 @@
1.4 {
1.5 LoadTranslations("mapchooser.phrases");
1.6
1.7 - g_MapList = CreateArray(33);
1.8 - g_OldMapList = CreateArray(33);
1.9 - g_NextMapList = CreateArray(33);
1.10 + new arraySize = ByteCountToCells(33);
1.11 + g_MapList = CreateArray(arraySize);
1.12 + g_OldMapList = CreateArray(arraySize);
1.13 + g_NextMapList = CreateArray(arraySize);
1.14 g_TeamScores = CreateArray(2);
1.15
1.16 g_Cvar_StartTime = CreateConVar("sm_mapvote_start", "3.0", "Specifies when to start the vote based on time remaining.", _, true, 1.0);
1.17 @@ -512,31 +513,31 @@
1.18 ClearArray(g_NextMapList);
1.19 }
1.20
1.21 - new Handle:tempMaps = CreateArray(33);
1.22 decl String:map[32];
1.23 - for (new i = 0; i < GetArraySize(g_MapList); i++)
1.24 - {
1.25 - GetArrayString(g_MapList, i, map, sizeof(map));
1.26 - PushArrayString(tempMaps, map);
1.27 - }
1.28 + new Handle:tempMaps = CloneArray(g_MapList);
1.29
1.30 - if (GetArraySize(tempMaps) > GetConVarInt(g_Cvar_ExcludeMaps))
1.31 + if (GetConVarInt(g_Cvar_ExcludeMaps) && GetArraySize(tempMaps) > GetConVarInt(g_Cvar_ExcludeMaps))
1.32 {
1.33 for (new i = 0; i < GetArraySize(g_OldMapList); i++)
1.34 {
1.35 GetArrayString(g_OldMapList, i, map, sizeof(map));
1.36 - for (new j = 0; j < GetArraySize(tempMaps); j++)
1.37 + new index = FindStringInArray(tempMaps, map);
1.38 + if (index != -1)
1.39 {
1.40 - decl String:temp[32];
1.41 - GetArrayString(tempMaps, j, temp, sizeof(temp));
1.42 - if (strcmp(temp, map) == 0)
1.43 - {
1.44 - RemoveFromArray(tempMaps, j);
1.45 - break;
1.46 - }
1.47 + RemoveFromArray(tempMaps, index);
1.48 }
1.49 }
1.50 }
1.51 + else
1.52 + {
1.53 + // If we didn't check against ExcludeMaps, we have to remove the current map.
1.54 + GetCurrentMap(map, sizeof(map));
1.55 + new index = FindStringInArray(tempMaps, map);
1.56 + if (index != -1)
1.57 + {
1.58 + RemoveFromArray(tempMaps, index);
1.59 + }
1.60 + }
1.61
1.62 new limit = (GetConVarInt(g_Cvar_IncludeMaps) < GetArraySize(tempMaps) ? GetConVarInt(g_Cvar_IncludeMaps) : GetArraySize(tempMaps));
1.63 for (new i = 0; i < limit; i++)