Newmenus: Use Menu::Close everywhere
This commit is contained in:
parent
34337fb959
commit
fa5336cade
@ -65,25 +65,10 @@ void CPlayer::Disconnect()
|
|||||||
authorized = false;
|
authorized = false;
|
||||||
teamIdsInitialized = false;
|
teamIdsInitialized = false;
|
||||||
|
|
||||||
if (newmenu != -1)
|
if (newmenu >= 0 && newmenu < (int)g_NewMenus.size() && g_NewMenus[newmenu])
|
||||||
{
|
{
|
||||||
Menu *pMenu = g_NewMenus[newmenu];
|
Menu *pMenu = g_NewMenus[newmenu];
|
||||||
if (pMenu)
|
pMenu->Close(index);
|
||||||
{
|
|
||||||
int status;
|
|
||||||
if (gpGlobals->time > menuexpire)
|
|
||||||
status = MENU_TIMEOUT;
|
|
||||||
else
|
|
||||||
status = MENU_EXIT;
|
|
||||||
|
|
||||||
//prevent recursion
|
|
||||||
newmenu = -1;
|
|
||||||
menu = 0;
|
|
||||||
executeForwards(pMenu->func,
|
|
||||||
static_cast<cell>(ENTINDEX(pEdict)),
|
|
||||||
static_cast<cell>(pMenu->thisId),
|
|
||||||
static_cast<cell>(status));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ClientCvarQuery_Info *>::iterator iter, end=queries.end();
|
List<ClientCvarQuery_Info *>::iterator iter, end=queries.end();
|
||||||
|
@ -1298,15 +1298,7 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
|
|||||||
if (menu >= 0 && menu < (int)g_NewMenus.size() && g_NewMenus[menu])
|
if (menu >= 0 && menu < (int)g_NewMenus.size() && g_NewMenus[menu])
|
||||||
{
|
{
|
||||||
Menu *pMenu = g_NewMenus[menu];
|
Menu *pMenu = g_NewMenus[menu];
|
||||||
int status;
|
pMenu->Close(pPlayer->index);
|
||||||
if (gpGlobals->time > pPlayer->menuexpire)
|
|
||||||
status = MENU_TIMEOUT;
|
|
||||||
else
|
|
||||||
status = MENU_EXIT;
|
|
||||||
|
|
||||||
pPlayer->newmenu = -1;
|
|
||||||
|
|
||||||
executeForwards(pMenu->func, static_cast<cell>(pPlayer->index), static_cast<cell>(menu), static_cast<cell>(status));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UTIL_FakeClientCommand(pPlayer->pEdict, "menuselect", "10", 0);
|
UTIL_FakeClientCommand(pPlayer->pEdict, "menuselect", "10", 0);
|
||||||
@ -1345,15 +1337,7 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
|
|||||||
if (menu >= 0 && menu < (int)g_NewMenus.size() && g_NewMenus[menu])
|
if (menu >= 0 && menu < (int)g_NewMenus.size() && g_NewMenus[menu])
|
||||||
{
|
{
|
||||||
Menu *pMenu = g_NewMenus[menu];
|
Menu *pMenu = g_NewMenus[menu];
|
||||||
int status;
|
pMenu->Close(pPlayer->index);
|
||||||
if (gpGlobals->time > pPlayer->menuexpire)
|
|
||||||
status = MENU_TIMEOUT;
|
|
||||||
else
|
|
||||||
status = MENU_EXIT;
|
|
||||||
|
|
||||||
pPlayer->newmenu = -1;
|
|
||||||
|
|
||||||
executeForwards(pMenu->func, static_cast<cell>(pPlayer->index), static_cast<cell>(menu), static_cast<cell>(status));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UTIL_FakeClientCommand(pPlayer->pEdict, "menuselect", "10", 0);
|
UTIL_FakeClientCommand(pPlayer->pEdict, "menuselect", "10", 0);
|
||||||
|
@ -967,14 +967,7 @@ void C_ClientCommand(edict_t *pEntity)
|
|||||||
if (menu >= 0 && menu < (int)g_NewMenus.size() && g_NewMenus[menu])
|
if (menu >= 0 && menu < (int)g_NewMenus.size() && g_NewMenus[menu])
|
||||||
{
|
{
|
||||||
Menu *pMenu = g_NewMenus[menu];
|
Menu *pMenu = g_NewMenus[menu];
|
||||||
|
pMenu->Close(pPlayer->index);
|
||||||
pPlayer->newmenu = -1;
|
|
||||||
pPlayer->menu = 0;
|
|
||||||
|
|
||||||
executeForwards(pMenu->func,
|
|
||||||
static_cast<cell>(pPlayer->index),
|
|
||||||
static_cast<cell>(menu),
|
|
||||||
static_cast<cell>(MENU_TIMEOUT));
|
|
||||||
|
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
}
|
}
|
||||||
|
@ -815,18 +815,7 @@ static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Menu *pOther = g_NewMenus[menu];
|
Menu *pOther = g_NewMenus[menu];
|
||||||
int status;
|
pOther->Close(pPlayer->index);
|
||||||
if (gpGlobals->time > pPlayer->menuexpire)
|
|
||||||
status = MENU_TIMEOUT;
|
|
||||||
else
|
|
||||||
status = MENU_EXIT;
|
|
||||||
|
|
||||||
pPlayer->newmenu = -1;
|
|
||||||
pPlayer->menu = 0;
|
|
||||||
executeForwards(pOther->func,
|
|
||||||
static_cast<cell>(player),
|
|
||||||
static_cast<cell>(pOther->thisId),
|
|
||||||
static_cast<cell>(status));
|
|
||||||
|
|
||||||
/* Infinite loop counter */
|
/* Infinite loop counter */
|
||||||
if (++loops >= 10)
|
if (++loops >= 10)
|
||||||
@ -1072,19 +1061,7 @@ static cell AMX_NATIVE_CALL menu_cancel(AMX *amx, cell *params)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Menu *pMenu = g_NewMenus[menu];
|
Menu *pMenu = g_NewMenus[menu];
|
||||||
|
pMenu->Close(player->index);
|
||||||
int status;
|
|
||||||
if (gpGlobals->time > player->menuexpire)
|
|
||||||
status = MENU_TIMEOUT;
|
|
||||||
else
|
|
||||||
status = MENU_EXIT;
|
|
||||||
|
|
||||||
player->newmenu = -1;
|
|
||||||
player->menu = 0;
|
|
||||||
executeForwards(pMenu->func,
|
|
||||||
static_cast<cell>(index),
|
|
||||||
static_cast<cell>(pMenu->thisId),
|
|
||||||
static_cast<cell>(status));
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1106,18 +1083,7 @@ static cell AMX_NATIVE_CALL menu_destroy(AMX *amx, cell *params)
|
|||||||
player = GET_PLAYER_POINTER_I(i);
|
player = GET_PLAYER_POINTER_I(i);
|
||||||
if (player->newmenu == pMenu->thisId)
|
if (player->newmenu == pMenu->thisId)
|
||||||
{
|
{
|
||||||
int status;
|
pMenu->Close(player->index);
|
||||||
if (gpGlobals->time > player->menuexpire)
|
|
||||||
status = MENU_TIMEOUT;
|
|
||||||
else
|
|
||||||
status = MENU_EXIT;
|
|
||||||
|
|
||||||
player->newmenu = -1;
|
|
||||||
player->menu = 0;
|
|
||||||
executeForwards(pMenu->func,
|
|
||||||
static_cast<cell>(i),
|
|
||||||
static_cast<cell>(pMenu->thisId),
|
|
||||||
static_cast<cell>(status));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_NewMenus[params[1]] = NULL;
|
g_NewMenus[params[1]] = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user