Disable dev and player commands for observers

Fixes #6839
This commit is contained in:
Oliver Brakmann
2014-12-20 19:29:35 +01:00
parent 087a06b3bc
commit a2eddeae40
2 changed files with 7 additions and 2 deletions

View File

@@ -47,6 +47,9 @@ namespace OpenRA.Mods.Common.Commands
public void InvokeCommand(string name, string arg) public void InvokeCommand(string name, string arg)
{ {
if (world.LocalPlayer == null)
return;
if (!world.AllowDevCommands) if (!world.AllowDevCommands)
{ {
Game.Debug("Cheats are disabled."); Game.Debug("Cheats are disabled.");
@@ -91,8 +94,7 @@ namespace OpenRA.Mods.Common.Commands
static void IssueDevCommand(World world, string command) static void IssueDevCommand(World world, string command)
{ {
if (world.LocalPlayer != null) world.IssueOrder(new Order(command, world.LocalPlayer.PlayerActor, false));
world.IssueOrder(new Order(command, world.LocalPlayer.PlayerActor, false));
} }
class DevException : Exception { } class DevException : Exception { }

View File

@@ -34,6 +34,9 @@ namespace OpenRA.Mods.Common.Commands
public void InvokeCommand(string name, string arg) public void InvokeCommand(string name, string arg)
{ {
if (world.LocalPlayer == null)
return;
switch (name) switch (name)
{ {
case "pause": case "pause":