diff --git a/MultiversalDiplomacy/Script/AdjudicationQueryScriptHandler.cs b/MultiversalDiplomacy/Script/AdjudicationQueryScriptHandler.cs index 5ed7570..70e2fa2 100644 --- a/MultiversalDiplomacy/Script/AdjudicationQueryScriptHandler.cs +++ b/MultiversalDiplomacy/Script/AdjudicationQueryScriptHandler.cs @@ -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; diff --git a/MultiversalDiplomacy/Script/GameScriptHandler.cs b/MultiversalDiplomacy/Script/GameScriptHandler.cs index 2e84b26..647bb70 100644 --- a/MultiversalDiplomacy/Script/GameScriptHandler.cs +++ b/MultiversalDiplomacy/Script/GameScriptHandler.cs @@ -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 == "---") { diff --git a/MultiversalDiplomacy/Script/ReplScriptHandler.cs b/MultiversalDiplomacy/Script/ReplScriptHandler.cs index 932cb05..ba17760 100644 --- a/MultiversalDiplomacy/Script/ReplScriptHandler.cs +++ b/MultiversalDiplomacy/Script/ReplScriptHandler.cs @@ -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}\""); - } + Console.WriteLine($"Unrecognized command: \"{command}\""); break; } diff --git a/MultiversalDiplomacy/Script/SetupScriptHandler.cs b/MultiversalDiplomacy/Script/SetupScriptHandler.cs index 5981f82..03daa6d 100644 --- a/MultiversalDiplomacy/Script/SetupScriptHandler.cs +++ b/MultiversalDiplomacy/Script/SetupScriptHandler.cs @@ -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;