MenuAction_Cancel now passes a vote cancellation reason
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401302
This commit is contained in:
		
							parent
							
								
									ddf6726f14
								
							
						
					
					
						commit
						70cfc9395d
					
				@ -258,7 +258,7 @@ void VoteMenuHandler::EndVoting()
 | 
			
		||||
		IBaseMenu *menu = m_pCurMenu;
 | 
			
		||||
		IMenuHandler *handler = m_pHandler;
 | 
			
		||||
		InternalReset();
 | 
			
		||||
		handler->OnMenuVoteCancel(menu);
 | 
			
		||||
		handler->OnMenuVoteCancel(menu, VoteCancel_Generic);
 | 
			
		||||
		handler->OnMenuEnd(menu, MenuEnd_VotingCancelled);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
@ -287,8 +287,8 @@ void VoteMenuHandler::EndVoting()
 | 
			
		||||
		IBaseMenu *menu = m_pCurMenu;
 | 
			
		||||
		IMenuHandler *handler = m_pHandler;
 | 
			
		||||
		InternalReset();
 | 
			
		||||
		handler->OnMenuVoteCancel(menu);
 | 
			
		||||
		handler->OnMenuEnd(menu, MenuEnd_NoVotes);
 | 
			
		||||
		handler->OnMenuVoteCancel(menu, VoteCancel_NoVotes);
 | 
			
		||||
		handler->OnMenuEnd(menu, MenuEnd_VotingCancelled);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -96,7 +96,7 @@ public:
 | 
			
		||||
	void OnMenuDestroy(IBaseMenu *menu);
 | 
			
		||||
	void OnMenuVoteStart(IBaseMenu *menu);
 | 
			
		||||
	void OnMenuVoteResults(IBaseMenu *menu, const menu_vote_result_t *results);
 | 
			
		||||
	void OnMenuVoteCancel(IBaseMenu *menu);
 | 
			
		||||
	void OnMenuVoteCancel(IBaseMenu *menu, VoteCancelReason reason);
 | 
			
		||||
	void OnMenuDrawItem(IBaseMenu *menu, int client, unsigned int item, unsigned int &style);
 | 
			
		||||
	unsigned int OnMenuDisplayItem(IBaseMenu *menu, int client, IMenuPanel *panel, unsigned int item, const ItemDrawInfo &dr);
 | 
			
		||||
	bool OnSetHandlerOption(const char *option, const void *data);
 | 
			
		||||
@ -337,9 +337,9 @@ void CMenuHandler::OnMenuVoteStart(IBaseMenu *menu)
 | 
			
		||||
	DoAction(menu, MenuAction_VoteStart, 0, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CMenuHandler::OnMenuVoteCancel(IBaseMenu *menu)
 | 
			
		||||
void CMenuHandler::OnMenuVoteCancel(IBaseMenu *menu, VoteCancelReason reason)
 | 
			
		||||
{
 | 
			
		||||
	DoAction(menu, MenuAction_VoteCancel, 0, 0);
 | 
			
		||||
	DoAction(menu, MenuAction_VoteCancel, reason, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CMenuHandler::OnMenuDrawItem(IBaseMenu *menu, int client, unsigned int item, unsigned int &style)
 | 
			
		||||
 | 
			
		||||
@ -41,7 +41,7 @@ enum MenuAction
 | 
			
		||||
	MenuAction_VoteEnd = (1<<5),	/**< (VOTE ONLY): A vote sequence has succeeded (param1=chosen item) 
 | 
			
		||||
										 This is not called if SetVoteResultCallback has been used on the menu. */
 | 
			
		||||
	MenuAction_VoteStart = (1<<6), 	/**< (VOTE ONLY): A vote sequence has started (nothing passed) */
 | 
			
		||||
	MenuAction_VoteCancel = (1<<7),	/**< (VOTE ONLY): A vote sequence has been cancelled (nothing passed) */
 | 
			
		||||
	MenuAction_VoteCancel = (1<<7),	/**< (VOTE ONLY): A vote sequence has been cancelled (param1=reason) */
 | 
			
		||||
	MenuAction_DrawItem = (1<<8),	/**< An item is being drawn; return the new style (param1=client, param2=item) */
 | 
			
		||||
	MenuAction_DisplayItem = (1<<9) /**< Item text is being drawn to the display (param1=client, param2=item)
 | 
			
		||||
										  To change the text, use RedrawMenuItem().
 | 
			
		||||
@ -75,7 +75,7 @@ enum MenuAction
 | 
			
		||||
#define VOTEINFO_ITEM_VOTES			1		/**< Number of votes for the item */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Reasons a menu can be cancelled.
 | 
			
		||||
 * Reasons a menu can be cancelled (MenuAction_Cancel).
 | 
			
		||||
 */
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
@ -88,7 +88,16 @@ enum
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Reasons a menu ended.
 | 
			
		||||
 * Reasons a vote can be cancelled (MenuAction_VoteCancel).
 | 
			
		||||
 */
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
	VoteCancel_Generic = -1,		/**< Vote was generically cancelled. */
 | 
			
		||||
	VoteCancel_NoVotes = -2,		/**< Vote did not receive any votes. */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Reasons a menu ended (MenuAction_End).
 | 
			
		||||
 */
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
@ -98,7 +107,6 @@ enum
 | 
			
		||||
	MenuEnd_Cancelled = -3,			/**< Menu was cancelled (reason in param2) */
 | 
			
		||||
	MenuEnd_Exit = -4,				/**< Menu was cleanly exited via "exit" */
 | 
			
		||||
	MenuEnd_ExitBack = -5,			/**< Menu was cleanly exited via "back" */
 | 
			
		||||
	MenuEnd_NoVotes = -6,			/**< A menu received no votes */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@
 | 
			
		||||
#include <IHandleSys.h>
 | 
			
		||||
 | 
			
		||||
#define SMINTERFACE_MENUMANAGER_NAME		"IMenuManager"
 | 
			
		||||
#define SMINTERFACE_MENUMANAGER_VERSION		10
 | 
			
		||||
#define SMINTERFACE_MENUMANAGER_VERSION		11
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file IMenuManager.h
 | 
			
		||||
@ -162,9 +162,16 @@ namespace SourceMod
 | 
			
		||||
		MenuEnd_Cancelled = -3,				/**< Menu was uncleanly cancelled */
 | 
			
		||||
		MenuEnd_Exit = -4,					/**< Menu was cleanly exited via "exit" */
 | 
			
		||||
		MenuEnd_ExitBack = -5,				/**< Menu was cleanly exited via "back" */
 | 
			
		||||
		MenuEnd_NoVotes = -6,				/**< No votes received */
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @brief Reasons a vote can be cancelled.
 | 
			
		||||
	 */
 | 
			
		||||
	enum VoteCancelReason
 | 
			
		||||
	{
 | 
			
		||||
		VoteCancel_Generic = -1,		/**< Vote was generically cancelled. */
 | 
			
		||||
		VoteCancel_NoVotes = -2,		/**< Vote did not receive any votes. */
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	#define MENU_NO_PAGINATION			0		/**< Menu should not be paginated (10 items max) */
 | 
			
		||||
	#define MENU_TIME_FOREVER			0		/**< Menu should be displayed as long as possible */
 | 
			
		||||
@ -701,7 +708,7 @@ namespace SourceMod
 | 
			
		||||
		 *
 | 
			
		||||
		 * @param menu			Menu pointer.
 | 
			
		||||
		 */
 | 
			
		||||
		virtual void OnMenuVoteCancel(IBaseMenu *menu)
 | 
			
		||||
		virtual void OnMenuVoteCancel(IBaseMenu *menu, VoteCancelReason reason)
 | 
			
		||||
		{
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -734,7 +741,7 @@ namespace SourceMod
 | 
			
		||||
		}
 | 
			
		||||
		virtual bool IsVersionCompatible(unsigned int version)
 | 
			
		||||
		{
 | 
			
		||||
			if (version < 9 || version > GetInterfaceVersion())
 | 
			
		||||
			if (version < 11 || version > GetInterfaceVersion())
 | 
			
		||||
			{
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user