From c6ab1b546834e2cf6f472b7ccb57d550cdd7e254 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 19 Aug 2024 06:25:03 -0400 Subject: [PATCH] More PowerEntry work. --- src/engine/wpak/PowersParser.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/engine/wpak/PowersParser.java b/src/engine/wpak/PowersParser.java index b935bacc..1a218ae4 100644 --- a/src/engine/wpak/PowersParser.java +++ b/src/engine/wpak/PowersParser.java @@ -55,10 +55,6 @@ public class PowersParser { try { - // Remove all lines that contain a # and leading/trailing blank lines - - powerData = powerData.replaceAll("(?m)^.*#.*\r?\n?", ""); - StringBuilder conditionString = new StringBuilder(); StringBuilder powerString = new StringBuilder(); @@ -74,6 +70,13 @@ public class PowersParser { powerString.append(powerData.substring(endPos)); + // Cleanup dangling tags and lines that contain a # and leading/trailing blank lines + + powerString = new StringBuilder(powerString.toString().replaceAll("CONDITIONBEGINCONDITIONEND", "") + .replaceAll("(?m)^.*#.*\r?\n?", "")); + + conditionString = new StringBuilder(conditionString.toString().replaceAll("(?m)^.*#.*\r?\n?", "")); + String[] lineData = powerString.toString().trim().split("\n"); ArrayList powerHeader = new ArrayList<>();