- added restrictions to CVAR and CCMD access functions for the menus. CVAR changes are only allowed when the menu is open or for mod-CVARs. The CCMD execution function is now private to the control requiring it and heavily guarded against improper access from the outside so that abuse is mostly impossible.

This also means that the remaining scriptification of the menu is on hold. The player menu would require even more access to critical game data, which is a no-go, and the other remaining menus offer little benefit from getting scriptified.
This commit is contained in:
Christoph Oelckers 2017-02-13 19:18:45 +01:00
commit 6525e04118
5 changed files with 25 additions and 5 deletions

View file

@ -54,6 +54,7 @@
#include "d_net.h"
#include "d_main.h"
#include "serializer.h"
#include "menu/menu.h"
// MACROS ------------------------------------------------------------------
@ -662,8 +663,10 @@ void C_DoCommand (const char *cmd, int keynum)
}
}
DEFINE_ACTION_FUNCTION(_Console, DoCommand)
// This is only accessible to the special menu item to run CCMDs.
DEFINE_ACTION_FUNCTION(DOptionMenuItemCommand, DoCommand)
{
if (DMenu::CurrentMenu == nullptr) return 0;
PARAM_PROLOGUE;
PARAM_STRING(cmd);
C_DoCommand(cmd);