diff -r 23ff0bc12973 -r b15b5682d181 core/MenuStyle_Base.cpp --- a/core/MenuStyle_Base.cpp Fri Jun 22 18:44:27 2007 +0000 +++ b/core/MenuStyle_Base.cpp Fri Jun 22 21:04:13 2007 +0000 @@ -53,7 +53,7 @@ m_WatchList.remove(client); } -void BaseMenuStyle::_CancelClientMenu(int client, bool bAutoIgnore/* =false */, MenuCancelReason reason/* =MenuCancel_Interrupt */) +void BaseMenuStyle::_CancelClientMenu(int client, MenuCancelReason reason, bool bAutoIgnore/* =false */) { #if defined MENU_DEBUG g_Logger.LogMessage("[SM_MENU] _CancelClientMenu() (client %d) (bAutoIgnore %d) (reason %d)", client, bAutoIgnore, reason); @@ -107,7 +107,7 @@ menu_states_t &states = player->states; if (states.menu == menu) { - _CancelClientMenu(i); + _CancelClientMenu(i, MenuCancel_Interrupted); } } } @@ -129,7 +129,7 @@ return false; } - _CancelClientMenu(client, autoIgnore); + _CancelClientMenu(client, MenuCancel_Interrupted, autoIgnore); return true; } @@ -180,7 +180,7 @@ return; } - _CancelClientMenu(client, true, MenuCancel_Disconnect); + _CancelClientMenu(client, MenuCancel_Disconnected, true); player->bInMenu = false; player->bInExternMenu = false; @@ -232,7 +232,7 @@ } if (curTime > player->menuStartTime + player->menuHoldTime) { - _CancelClientMenu(client, false); + _CancelClientMenu(client, MenuCancel_Timeout, false); } } } @@ -253,6 +253,7 @@ bool cancel = false; unsigned int item = 0; MenuCancelReason reason = MenuCancel_Exit; + MenuEndReason end_reason = MenuEnd_Selected; menu_states_t &states = player->states; assert(states.mh != NULL); @@ -272,6 +273,7 @@ { cancel = true; reason = MenuCancel_NoDisplay; + end_reason = MenuEnd_Cancelled; } else { return; } @@ -280,11 +282,18 @@ { cancel = true; /* I like Saltines. */ reason = MenuCancel_NoDisplay; + end_reason = MenuEnd_Cancelled; } else { return; } } else if (type == ItemSel_Exit || type == ItemSel_None) { cancel = true; + reason = MenuCancel_Exit; + end_reason = MenuEnd_Exit; + } else if (type == ItemSel_ExitBack) { + cancel = true; + reason = MenuCancel_ExitBack; + end_reason = MenuEnd_ExitBack; } else { item = states.slots[key_press].item; } @@ -311,14 +320,6 @@ /* Only fire end for valid menus */ if (menu) { - MenuEndReason end_reason = - (cancel ? - MenuEnd_Selected - : - (reason == MenuCancel_Exit ? - MenuEnd_Exit - : - MenuEnd_Cancelled)); mh->OnMenuEnd(menu, end_reason); } } @@ -355,7 +356,7 @@ menu_states_t &states = player->states; if (player->bInMenu) { - _CancelClientMenu(client, true); + _CancelClientMenu(client, MenuCancel_Interrupted, true); } states.firstItem = 0; @@ -429,7 +430,7 @@ #if defined MENU_DEBUG g_Logger.LogMessage("[SM_MENU] DoClientMenu(): Cancelling old menu to client %d", client); #endif - _CancelClientMenu(client, true); + _CancelClientMenu(client, MenuCancel_Interrupted, true); } states.firstItem = 0; @@ -518,7 +519,7 @@ m_pStyle(pStyle), m_Strings(512), m_Pagination(7), m_ExitButton(true), m_bShouldDelete(false), m_bCancelling(false), m_pOwner(pOwner ? pOwner : g_pCoreIdent), m_bDeleting(false), m_bWillFreeHandle(false), m_hHandle(BAD_HANDLE), m_pHandler(pHandler), -m_pVoteHandler(NULL) +m_pVoteHandler(NULL), m_ExitBackButton(false) { } @@ -789,3 +790,13 @@ { return (m_pVoteHandler && m_pVoteHandler->IsVoteInProgress()); } + +bool CBaseMenu::GetExitBackButton() +{ + return m_ExitBackButton; +} + +void CBaseMenu::SetExitBackButton(bool set) +{ + m_ExitBackButton = set; +}