Early-out on comments
This commit is contained in:
parent
e9c4d3d2d3
commit
55dfe0ca99
|
@ -18,7 +18,7 @@ public class AdjudicationQueryScriptHandler(World world, bool strict = false) :
|
|||
public IScriptHandler? HandleInput(string input)
|
||||
{
|
||||
var args = input.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||
if (args.Length == 0)
|
||||
if (args.Length == 0 || input.StartsWith('#'))
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
@ -51,8 +51,6 @@ public class AdjudicationQueryScriptHandler(World world, bool strict = false) :
|
|||
throw new NotImplementedException();
|
||||
|
||||
default:
|
||||
// noop on comments that begin with #
|
||||
if (command.StartsWith('#')) break;
|
||||
Console.WriteLine($"Unrecognized command: \"{command}\"");
|
||||
if (Strict) return null;
|
||||
break;
|
||||
|
|
|
@ -24,6 +24,7 @@ public class GameScriptHandler(World world, bool strict = false) : IScriptHandle
|
|||
CurrentPower = null;
|
||||
return this;
|
||||
}
|
||||
if (input.StartsWith('#')) return this;
|
||||
|
||||
// "---" submits the orders and allows queries about the outcome
|
||||
if (input == "---") {
|
||||
|
|
|
@ -12,7 +12,7 @@ public class ReplScriptHandler : IScriptHandler
|
|||
public IScriptHandler? HandleInput(string input)
|
||||
{
|
||||
var args = input.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||
if (args.Length == 0)
|
||||
if (args.Length == 0 || input.StartsWith('#'))
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
@ -52,10 +52,7 @@ public class ReplScriptHandler : IScriptHandler
|
|||
return new SetupScriptHandler(world);
|
||||
|
||||
default:
|
||||
// noop on comments that begin with #
|
||||
if (!command.StartsWith('#')) {
|
||||
Console.WriteLine($"Unrecognized command: \"{command}\"");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public class SetupScriptHandler(World world, bool strict = false) : IScriptHandl
|
|||
public IScriptHandler? HandleInput(string input)
|
||||
{
|
||||
var args = input.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||
if (args.Length == 0)
|
||||
if (args.Length == 0 || input.StartsWith('#'))
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
@ -88,8 +88,6 @@ public class SetupScriptHandler(World world, bool strict = false) : IScriptHandl
|
|||
break;
|
||||
|
||||
default:
|
||||
// noop on comments that begin with #
|
||||
if (command.StartsWith('#')) break;
|
||||
Console.WriteLine($"Unrecognized command: \"{command}\"");
|
||||
if (Strict) return null;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue