Merge pull request #150 from Arkshine/add-reset_menu

Allow show_menu native to send empty text + add reset_menu stock (bug 6244)
This commit is contained in:
Vincent Herbet 2014-10-25 12:00:08 +02:00
commit 5f824d64da
2 changed files with 14 additions and 1 deletions

View File

@ -57,7 +57,7 @@ void UTIL_ShowMenu(edict_t* pEdict, int slots, int time, char *menu, int mlen)
if (!gmsgShowMenu) if (!gmsgShowMenu)
return; // some games don't support ShowMenu (Firearms) return; // some games don't support ShowMenu (Firearms)
while (*n) do
{ {
a = mlen; a = mlen;
if (a > 175) a = 175; if (a > 175) a = 175;
@ -74,6 +74,7 @@ void UTIL_ShowMenu(edict_t* pEdict, int slots, int time, char *menu, int mlen)
*n = c; *n = c;
menu = n; menu = n;
} }
while (*n);
} }
/* warning - don't pass here const string */ /* warning - don't pass here const string */

View File

@ -578,3 +578,15 @@ stock has_all_flags(id, const flags[])
new FlagsNumber=read_flags(flags); new FlagsNumber=read_flags(flags);
return ((get_user_flags(id) & FlagsNumber)==FlagsNumber); return ((get_user_flags(id) & FlagsNumber)==FlagsNumber);
} }
/**
* Resets a client's menu.
*
* @note This is just a wrapper around show_menu for the sake of readability.
*
* @param index Client to reset menu to, use 0 to reset to all clients
*/
stock reset_menu(index)
{
show_menu(index, 0, "", 0);
}