From 30ae5c93cbd41dd6bfbd5b00ec5c4692cba5e971 Mon Sep 17 00:00:00 2001 From: Olliroxx Date: Fri, 6 Jan 2023 15:17:20 +0100 Subject: [PATCH] Setting the program length limit to zero disables it. --- .../main/java/li/cil/tis3d/common/config/CommonConfig.java | 4 ++-- .../cil/tis3d/common/module/execution/compiler/Compiler.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/li/cil/tis3d/common/config/CommonConfig.java b/common/src/main/java/li/cil/tis3d/common/config/CommonConfig.java index ac27e1eb..f38a783e 100644 --- a/common/src/main/java/li/cil/tis3d/common/config/CommonConfig.java +++ b/common/src/main/java/li/cil/tis3d/common/config/CommonConfig.java @@ -39,8 +39,8 @@ public final class CommonConfig { /** * The maximum number of lines a program may have. */ - @Path("module.execution") @Min(1) @Max(200) - @Comment("The maximum number of lines an ASM program for an execution node may have.") + @Path("module.execution") @Min(0) @Max(200) + @Comment("The maximum number of lines an ASM program for an execution node may have. Use zero to remove the limit.") @Translation("maxLinesPerProgram") public static int maxLinesPerProgram = 40; diff --git a/common/src/main/java/li/cil/tis3d/common/module/execution/compiler/Compiler.java b/common/src/main/java/li/cil/tis3d/common/module/execution/compiler/Compiler.java index acc2ff35..58cc4779 100644 --- a/common/src/main/java/li/cil/tis3d/common/module/execution/compiler/Compiler.java +++ b/common/src/main/java/li/cil/tis3d/common/module/execution/compiler/Compiler.java @@ -32,7 +32,7 @@ public static void compile(final Iterable code, final MachineState state state.clear(); final String[] lines = Iterables.toArray(code, String.class); - if (lines.length > CommonConfig.maxLinesPerProgram) { + if (lines.length > CommonConfig.maxLinesPerProgram && CommonConfig.maxLinesPerProgram > 0) { throw new ParseException(Strings.MESSAGE_TOO_MANY_LINES, CommonConfig.maxLinesPerProgram, 0, 0); } for (int lineNumber = 0; lineNumber < lines.length; lineNumber++) {