1.1 --- a/core/MenuStyle_Base.cpp Fri Jun 22 18:44:27 2007 +0000
1.2 +++ b/core/MenuStyle_Base.cpp Fri Jun 22 21:04:13 2007 +0000
1.3 @@ -53,7 +53,7 @@
1.4 m_WatchList.remove(client);
1.5 }
1.6
1.7 -void BaseMenuStyle::_CancelClientMenu(int client, bool bAutoIgnore/* =false */, MenuCancelReason reason/* =MenuCancel_Interrupt */)
1.8 +void BaseMenuStyle::_CancelClientMenu(int client, MenuCancelReason reason, bool bAutoIgnore/* =false */)
1.9 {
1.10 #if defined MENU_DEBUG
1.11 g_Logger.LogMessage("[SM_MENU] _CancelClientMenu() (client %d) (bAutoIgnore %d) (reason %d)", client, bAutoIgnore, reason);
1.12 @@ -107,7 +107,7 @@
1.13 menu_states_t &states = player->states;
1.14 if (states.menu == menu)
1.15 {
1.16 - _CancelClientMenu(i);
1.17 + _CancelClientMenu(i, MenuCancel_Interrupted);
1.18 }
1.19 }
1.20 }
1.21 @@ -129,7 +129,7 @@
1.22 return false;
1.23 }
1.24
1.25 - _CancelClientMenu(client, autoIgnore);
1.26 + _CancelClientMenu(client, MenuCancel_Interrupted, autoIgnore);
1.27
1.28 return true;
1.29 }
1.30 @@ -180,7 +180,7 @@
1.31 return;
1.32 }
1.33
1.34 - _CancelClientMenu(client, true, MenuCancel_Disconnect);
1.35 + _CancelClientMenu(client, MenuCancel_Disconnected, true);
1.36
1.37 player->bInMenu = false;
1.38 player->bInExternMenu = false;
1.39 @@ -232,7 +232,7 @@
1.40 }
1.41 if (curTime > player->menuStartTime + player->menuHoldTime)
1.42 {
1.43 - _CancelClientMenu(client, false);
1.44 + _CancelClientMenu(client, MenuCancel_Timeout, false);
1.45 }
1.46 }
1.47 }
1.48 @@ -253,6 +253,7 @@
1.49 bool cancel = false;
1.50 unsigned int item = 0;
1.51 MenuCancelReason reason = MenuCancel_Exit;
1.52 + MenuEndReason end_reason = MenuEnd_Selected;
1.53 menu_states_t &states = player->states;
1.54
1.55 assert(states.mh != NULL);
1.56 @@ -272,6 +273,7 @@
1.57 {
1.58 cancel = true;
1.59 reason = MenuCancel_NoDisplay;
1.60 + end_reason = MenuEnd_Cancelled;
1.61 } else {
1.62 return;
1.63 }
1.64 @@ -280,11 +282,18 @@
1.65 {
1.66 cancel = true; /* I like Saltines. */
1.67 reason = MenuCancel_NoDisplay;
1.68 + end_reason = MenuEnd_Cancelled;
1.69 } else {
1.70 return;
1.71 }
1.72 } else if (type == ItemSel_Exit || type == ItemSel_None) {
1.73 cancel = true;
1.74 + reason = MenuCancel_Exit;
1.75 + end_reason = MenuEnd_Exit;
1.76 + } else if (type == ItemSel_ExitBack) {
1.77 + cancel = true;
1.78 + reason = MenuCancel_ExitBack;
1.79 + end_reason = MenuEnd_ExitBack;
1.80 } else {
1.81 item = states.slots[key_press].item;
1.82 }
1.83 @@ -311,14 +320,6 @@
1.84 /* Only fire end for valid menus */
1.85 if (menu)
1.86 {
1.87 - MenuEndReason end_reason =
1.88 - (cancel ?
1.89 - MenuEnd_Selected
1.90 - :
1.91 - (reason == MenuCancel_Exit ?
1.92 - MenuEnd_Exit
1.93 - :
1.94 - MenuEnd_Cancelled));
1.95 mh->OnMenuEnd(menu, end_reason);
1.96 }
1.97 }
1.98 @@ -355,7 +356,7 @@
1.99 menu_states_t &states = player->states;
1.100 if (player->bInMenu)
1.101 {
1.102 - _CancelClientMenu(client, true);
1.103 + _CancelClientMenu(client, MenuCancel_Interrupted, true);
1.104 }
1.105
1.106 states.firstItem = 0;
1.107 @@ -429,7 +430,7 @@
1.108 #if defined MENU_DEBUG
1.109 g_Logger.LogMessage("[SM_MENU] DoClientMenu(): Cancelling old menu to client %d", client);
1.110 #endif
1.111 - _CancelClientMenu(client, true);
1.112 + _CancelClientMenu(client, MenuCancel_Interrupted, true);
1.113 }
1.114
1.115 states.firstItem = 0;
1.116 @@ -518,7 +519,7 @@
1.117 m_pStyle(pStyle), m_Strings(512), m_Pagination(7), m_ExitButton(true),
1.118 m_bShouldDelete(false), m_bCancelling(false), m_pOwner(pOwner ? pOwner : g_pCoreIdent),
1.119 m_bDeleting(false), m_bWillFreeHandle(false), m_hHandle(BAD_HANDLE), m_pHandler(pHandler),
1.120 -m_pVoteHandler(NULL)
1.121 +m_pVoteHandler(NULL), m_ExitBackButton(false)
1.122 {
1.123 }
1.124
1.125 @@ -789,3 +790,13 @@
1.126 {
1.127 return (m_pVoteHandler && m_pVoteHandler->IsVoteInProgress());
1.128 }
1.129 +
1.130 +bool CBaseMenu::GetExitBackButton()
1.131 +{
1.132 + return m_ExitBackButton;
1.133 +}
1.134 +
1.135 +void CBaseMenu::SetExitBackButton(bool set)
1.136 +{
1.137 + m_ExitBackButton = set;
1.138 +}