Fixed amb1065 - Votemap clears itself properly after a failed vote
authorMatt Woodrow <pred@alliedmods.net>
Tue Oct 23 20:08:19 2007 +0000 (2007-10-23)
changeset 1641d4a4d08b20f6
parent 1640 a644ed81b457
child 1642 4d3ed2d9d077
Fixed amb1065 - Votemap clears itself properly after a failed vote
plugins/basevotes/votemap.sp
     1.1 --- a/plugins/basevotes/votemap.sp	Mon Oct 22 22:57:08 2007 +0000
     1.2 +++ b/plugins/basevotes/votemap.sp	Tue Oct 23 20:08:19 2007 +0000
     1.3 @@ -31,6 +31,21 @@
     1.4  	VoteMenuToAll(g_hVoteMenu, 20);		
     1.5  }
     1.6  
     1.7 +ResetMenu()
     1.8 +{
     1.9 +	/* Add the removed maps back to the menu */
    1.10 +	new selectedmaps = GetArraySize(g_SelectedMaps);
    1.11 +	decl String:mapname[64];
    1.12 +		
    1.13 +	for (new i=0; i<selectedmaps; i++)
    1.14 +	{
    1.15 +		GetArrayString(g_SelectedMaps, i, mapname, sizeof(mapname))	;
    1.16 +		AddMenuItem(g_MapList, mapname, mapname);
    1.17 +	}
    1.18 +
    1.19 +	g_VoteMapInUse = false;
    1.20 +}
    1.21 +
    1.22  ConfirmVote(client)
    1.23  {
    1.24  	new Handle:menu = CreateMenu(MenuHandler_Confirm);
    1.25 @@ -54,7 +69,8 @@
    1.26  	}
    1.27  	else if (action == MenuAction_Cancel)
    1.28  	{
    1.29 -		g_VoteMapInUse = false;
    1.30 +		ResetMenu();
    1.31 +		
    1.32  		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
    1.33  		{
    1.34  			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
    1.35 @@ -72,25 +88,14 @@
    1.36  		
    1.37  		DisplayVoteMapMenu(param1, selectedmaps, maps);
    1.38  		
    1.39 -		/* Re-enable the menu option */
    1.40 -		g_VoteMapInUse = false;	
    1.41 +		ResetMenu();
    1.42  	}
    1.43  }
    1.44  
    1.45  public MenuHandler_Map(Handle:menu, MenuAction:action, param1, param2)
    1.46  {
    1.47  	if (action == MenuAction_Cancel)
    1.48 -	{
    1.49 -		/* Add the removed maps back to the menu */
    1.50 -		new selectedmaps = GetArraySize(g_SelectedMaps);
    1.51 -		decl String:mapname[64];
    1.52 -			
    1.53 -		for (new i=0; i<selectedmaps; i++)
    1.54 -		{
    1.55 -			GetArrayString(g_SelectedMaps, i, mapname, sizeof(mapname))	;
    1.56 -			AddMenuItem(menu, mapname, mapname);
    1.57 -		}
    1.58 -		
    1.59 +	{		
    1.60  		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
    1.61  		{
    1.62  			ConfirmVote(param1);
    1.63 @@ -98,7 +103,9 @@
    1.64  		else // no action was selected.
    1.65  		{
    1.66  			/* Re-enable the menu option */
    1.67 -			g_VoteMapInUse = false;	
    1.68 +			g_VoteMapInUse = false;
    1.69 +			
    1.70 +			ResetMenu();
    1.71  		}
    1.72  	}
    1.73  	else if (action == MenuAction_Select)
    1.74 @@ -139,8 +146,8 @@
    1.75  	else if (action == TopMenuAction_SelectOption)
    1.76  	{
    1.77  		g_VoteMapInUse = true;
    1.78 +		g_SelectedCount = 0;
    1.79  		ClearArray(g_SelectedMaps);
    1.80 -		g_SelectedCount = 0;
    1.81  		DisplayMenu(g_MapList, param, MENU_TIME_FOREVER);
    1.82  	}
    1.83  	else if (action == TopMenuAction_DrawOption)