Newmenus: Add MENU_TIMEOUT status code and pass it where necessary

This commit is contained in:
Valentin Grünbacher
2014-05-21 18:45:40 +02:00
parent cd7cb8c1a8
commit 2e8ce87c23
4 changed files with 42 additions and 8 deletions

View File

@@ -794,14 +794,19 @@ static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
break;
}
Menu *pOther = g_NewMenus[menu];
Menu *pOther = g_NewMenus[menu];
int status;
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>(MENU_EXIT));
static_cast<cell>(status));
/* Infinite loop counter */
if (++loops >= 10)
@@ -1047,13 +1052,19 @@ static cell AMX_NATIVE_CALL menu_cancel(AMX *amx, cell *params)
return 0;
Menu *pMenu = g_NewMenus[menu];
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>(MENU_EXIT));
static_cast<cell>(status));
return 1;
}
@@ -1074,13 +1085,19 @@ static cell AMX_NATIVE_CALL menu_destroy(AMX *amx, cell *params)
{
player = GET_PLAYER_POINTER_I(i);
if (player->newmenu == pMenu->thisId)
{
{
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>(i),
static_cast<cell>(pMenu->thisId),
static_cast<cell>(MENU_EXIT));
static_cast<cell>(status));
}
}
g_NewMenus[params[1]] = NULL;