From 0c660ff29ca9f2915f9aaea31edaed374c7fd7e5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 27 Feb 2017 10:37:47 +0100 Subject: [PATCH] - added an option to add elements to an existing options menu. Note that for list menus this does not exist because they require complete setup to work as intended. --- src/menu/menudef.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index dc4fff1a7..239366dcf 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -871,6 +871,25 @@ static void ParseOptionMenu(FScanner &sc) } +//============================================================================= +// +// +// +//============================================================================= + +static void ParseAddOptionMenu(FScanner &sc) +{ + sc.MustGetString(); + + DMenuDescriptor **pOld = MenuDescriptors.CheckKey(sc.String); + if (pOld == nullptr || *pOld == nullptr || !(*pOld)->IsKindOf(RUNTIME_CLASS(DOptionMenuDescriptor))) + { + sc.ScriptError("%s is not an option menu that can be extended", sc.String); + } + ParseOptionMenuBody(sc, (DOptionMenuDescriptor*)(*pOld)); +} + + //============================================================================= // // @@ -935,6 +954,10 @@ void M_ParseMenuDefs() { ParseOptionMenu(sc); } + else if (sc.Compare("ADDOPTIONMENU")) + { + ParseAddOptionMenu(sc); + } else if (sc.Compare("DEFAULTOPTIONMENU")) { ParseOptionMenuBody(sc, DefaultOptionMenuSettings);