Prohibit cheats if cheats are disabled,

i.e. developer cheats to control enemy units, revealing the map and
promoting units too.

Open the developer overlay only if cheats are enabled (which is always
the case in singleplayer mode and only the case in multiplayer mode if
explicitly enabled).
(This doesn't make it harder for developers to "debug", since they
previously had to remember to disable the rated game setting too. Also
every bug had to be reproduced with the replay either way)

Reverts 3cbbf31173 which reverted 6e0e607b20 (since as of c288278229,
the autostart gamesetup enables cheats too).

Differential Revision: https://code.wildfiregames.com/D455
Fixes #3551
Reviewed By: echotangoecho
Agreed with Itms and Imarok in the last staff meeting.

This was SVN commit r19558.
This commit is contained in:
elexis
2017-05-11 22:49:54 +00:00
parent c288278229
commit 6e549bfed2
2 changed files with 10 additions and 2 deletions
@@ -1121,8 +1121,7 @@ function openManual()
function toggleDeveloperOverlay()
{
// The developer overlay is disabled in ranked games
if (Engine.HasXmppClient() && Engine.IsRankedGame())
if (!g_GameAttributes.settings.CheatsEnabled)
return;
let devCommands = Engine.GetGUIObjectByName("devCommands");
@@ -114,6 +114,9 @@ var g_Commands = {
"control-all": function(player, cmd, data)
{
if (!data.cmpPlayer.GetCheatsEnabled())
return;
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
cmpGuiInterface.PushNotification({
"type": "aichat",
@@ -126,6 +129,9 @@ var g_Commands = {
"reveal-map": function(player, cmd, data)
{
if (!data.cmpPlayer.GetCheatsEnabled())
return;
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
cmpGuiInterface.PushNotification({
"type": "aichat",
@@ -563,6 +569,9 @@ var g_Commands = {
"promote": function(player, cmd, data)
{
if (!data.cmpPlayer.GetCheatsEnabled())
return;
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
cmpGuiInterface.PushNotification({
"type": "aichat",