mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
Menu protection features
- added a '-nocustommenu' command line options. This is for disabling user menus that intentionally or accidentally disable crucial menu features. - do not allow replacement of the main options menu. This menu contains engine-critical settings and may change at any time when new features get added. For now it will be the only one that gets protected but this may soon be extended to some of its submenus as well.
This commit is contained in:
parent
5405625219
commit
8482653bbc
1 changed files with 8 additions and 0 deletions
|
@ -54,6 +54,7 @@
|
|||
#include "vm.h"
|
||||
#include "types.h"
|
||||
#include "gameconfigfile.h"
|
||||
#include "m_argv.h"
|
||||
|
||||
|
||||
|
||||
|
@ -520,6 +521,12 @@ static bool ReplaceMenu(FScanner &sc, DMenuDescriptor *desc)
|
|||
DMenuDescriptor **pOld = MenuDescriptors.CheckKey(desc->mMenuName);
|
||||
if (pOld != nullptr && *pOld != nullptr)
|
||||
{
|
||||
if (desc->mMenuName == NAME_Optionsmenu)
|
||||
{
|
||||
sc.ScriptMessage("Cannot replace the main options menu!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CheckCompatible(desc, *pOld))
|
||||
{
|
||||
sc.ScriptMessage("Tried to replace menu '%s' with a menu of different type", desc->mMenuName.GetChars());
|
||||
|
@ -980,6 +987,7 @@ void M_ParseMenuDefs()
|
|||
sc.ScriptError("Unknown keyword '%s'", sc.String);
|
||||
}
|
||||
}
|
||||
if (Args->CheckParm("-nocustommenu")) break;
|
||||
}
|
||||
DefaultListMenuClass = DefaultListMenuSettings->mClass;
|
||||
DefaultListMenuSettings = nullptr;
|
||||
|
|
Loading…
Reference in a new issue