- copied some CCMD improvements from Raze

* no longer uses copystring function.
* ability to dynamically register CCMDs.
This commit is contained in:
Christoph Oelckers 2020-04-11 18:04:07 +02:00
commit b7ff7302e5
4 changed files with 99 additions and 44 deletions

View file

@ -55,6 +55,7 @@
#include "menu/menu.h"
#include "c_cvars.h"
#include "c_bind.h"
#include "c_dispatch.h"
DVector2 AM_GetPosition();
int Net_GetLatency(int *ld, int *ad);
@ -3393,6 +3394,18 @@ DEFINE_ACTION_FUNCTION(FKeyBindings, UnbindACommand)
return 0;
}
// This is only accessible to the special menu item to run CCMDs.
DEFINE_ACTION_FUNCTION(DOptionMenuItemCommand, DoCommand)
{
if (CurrentMenu == nullptr) return 0;
PARAM_PROLOGUE;
PARAM_STRING(cmd);
PARAM_BOOL(unsafe);
UnsafeExecutionScope scope(unsafe);
C_DoCommand(cmd);
return 0;
}