Pass menu ID in MPROP_PAGE_CALLBACK function (#885)

Co-authored-by: shel <2@shelru.ru>
This commit is contained in:
shel 2020-07-17 13:05:13 +04:00 committed by GitHub
parent ff2fc19b08
commit 2e3c105c7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -1145,12 +1145,12 @@ void C_ClientCommand(edict_t *pEntity)
if (item == MENU_BACK) if (item == MENU_BACK)
{ {
if (pMenu->pageCallback >= 0) if (pMenu->pageCallback >= 0)
executeForwards(pMenu->pageCallback, static_cast<cell>(pPlayer->index), static_cast<cell>(MENU_BACK)); executeForwards(pMenu->pageCallback, static_cast<cell>(pPlayer->index), static_cast<cell>(MENU_BACK), static_cast<cell>(menu));
pMenu->Display(pPlayer->index, pPlayer->page - 1); pMenu->Display(pPlayer->index, pPlayer->page - 1);
} else if (item == MENU_MORE) { } else if (item == MENU_MORE) {
if (pMenu->pageCallback >= 0) if (pMenu->pageCallback >= 0)
executeForwards(pMenu->pageCallback, static_cast<cell>(pPlayer->index), static_cast<cell>(MENU_MORE)); executeForwards(pMenu->pageCallback, static_cast<cell>(pPlayer->index), static_cast<cell>(MENU_MORE), static_cast<cell>(menu));
pMenu->Display(pPlayer->index, pPlayer->page + 1); pMenu->Display(pPlayer->index, pPlayer->page + 1);
} else { } else {

View File

@ -1083,7 +1083,7 @@ static cell AMX_NATIVE_CALL menu_setprop(AMX *amx, cell *params)
break; break;
} }
int callback = registerSPForwardByName(amx, str, FP_CELL, FP_CELL, FP_DONE); int callback = registerSPForwardByName(amx, str, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
if (callback < 0) if (callback < 0)
{ {
LogError(amx, AMX_ERR_NATIVE, "Function %s not present", str); LogError(amx, AMX_ERR_NATIVE, "Function %s not present", str);

View File

@ -76,7 +76,7 @@
/** /**
* Function to be called on Back and Next (param1 = string) * Function to be called on Back and Next (param1 = string)
* public function(id, status); where status is either MENU_BACK or MENU_MORE * public function(id, status, menu); where status is either MENU_BACK or MENU_MORE
* Pass NULL_STRING to disable the callback * Pass NULL_STRING to disable the callback
*/ */
#define MPROP_PAGE_CALLBACK 11 #define MPROP_PAGE_CALLBACK 11