diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index 1948153e4..618189b4f 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -781,7 +781,15 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc) FString label = sc.String; sc.MustGetStringName(","); sc.MustGetString(); - FOptionMenuItem *it = new FOptionMenuItemSafeCommand(label, sc.String); + FString command = sc.String; + FString prompt; + // Check for optional custom prompt + if (sc.CheckString(",")) + { + sc.MustGetString(); + prompt = sc.String; + } + FOptionMenuItem *it = new FOptionMenuItemSafeCommand(label, command, prompt); desc->mItems.Push(it); } else if (sc.Compare("Control") || sc.Compare("MapControl")) diff --git a/src/menu/optionmenuitems.h b/src/menu/optionmenuitems.h index 3131e35f7..43fb46c1c 100644 --- a/src/menu/optionmenuitems.h +++ b/src/menu/optionmenuitems.h @@ -103,10 +103,23 @@ public: class FOptionMenuItemSafeCommand : public FOptionMenuItemCommand { // action is a CCMD +protected: + char *mPrompt; + public: - FOptionMenuItemSafeCommand(const char *label, const char *menu) + FOptionMenuItemSafeCommand(const char *label, const char *menu, const char *prompt) : FOptionMenuItemCommand(label, menu) + , mPrompt(nullptr) { + if (prompt && *prompt) + { + mPrompt = copystring(prompt); + } + } + + ~FOptionMenuItemSafeCommand() + { + if (mPrompt != NULL) delete[] mPrompt; } bool MenuEvent (int mkey, bool fromcontroller) @@ -121,7 +134,11 @@ public: bool Activate() { - const char *msg = GStrings("SAFEMESSAGE"); + const char *msg = mPrompt ? mPrompt : "$SAFEMESSAGE"; + if (*msg == '$') + { + msg = GStrings(msg + 1); + } const char *actionLabel = mLabel; if (actionLabel != NULL)