From b2ade117ec5dbed501a55d33b15724b57c84729c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 17 Aug 2005 16:12:45 +0000 Subject: [PATCH] Added bug fix at17218 (Freecode) --- amxmodx/msvc/amxmodx_mm.vcproj | 3 +- amxmodx/natives.cpp | 2 -- amxmodx/newmenus.cpp | 55 ++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/amxmodx/msvc/amxmodx_mm.vcproj b/amxmodx/msvc/amxmodx_mm.vcproj index bf686ac9..449e8fa8 100755 --- a/amxmodx/msvc/amxmodx_mm.vcproj +++ b/amxmodx/msvc/amxmodx_mm.vcproj @@ -179,12 +179,13 @@ -#include #include "CStack.h" #include "natives.h" diff --git a/amxmodx/newmenus.cpp b/amxmodx/newmenus.cpp index 6871b41a..b81f1569 100755 --- a/amxmodx/newmenus.cpp +++ b/amxmodx/newmenus.cpp @@ -363,6 +363,58 @@ static cell AMX_NATIVE_CALL menu_makecallback(AMX *amx, cell *params) return id; } +static cell AMX_NATIVE_CALL menu_item_setname(AMX *amx, cell *params) +{ + GETMENU(params[1]); + + menuitem *pItem = pMenu->GetMenuItem(static_cast(params[2])); + + if (!pItem) + return 0; + + int len; + char *name; + + name = get_amxstring(amx, params[3], 0, len); + + pItem->name.assign(name); + + return 1; +} + +static cell AMX_NATIVE_CALL menu_item_setcmd(AMX *amx, cell *params) +{ + GETMENU(params[1]); + + menuitem *pItem = pMenu->GetMenuItem(static_cast(params[2])); + + if (!pItem) + return 0; + + int len; + char *cmd; + + cmd = get_amxstring(amx, params[3], 0, len); + + pItem->cmd.assign(cmd); + + return 1; +} + +static cell AMX_NATIVE_CALL menu_item_setcall(AMX *amx, cell *params) +{ + GETMENU(params[1]); + + menuitem *pItem = pMenu->GetMenuItem(static_cast(params[2])); + + if (!pItem) + return 0; + + pItem->handler = params[3]; + + return 1; +} + AMX_NATIVE_INFO g_NewMenuNatives[] = { {"menu_create", menu_create}, @@ -373,5 +425,8 @@ AMX_NATIVE_INFO g_NewMenuNatives[] = {"menu_find_id", menu_find_id}, {"menu_item_getinfo", menu_item_getinfo}, {"menu_makecallback", menu_makecallback}, + {"menu_item_setcall", menu_item_setcall}, + {"menu_item_setcmd", menu_item_setcmd}, + {"menu_item_setname", menu_item_setname}, {NULL, NULL}, };