From 9bb648d099de830ba2c3e8e1ddc34531697516ff Mon Sep 17 00:00:00 2001 From: MichaelHinrichs Date: Sat, 27 Jul 2024 16:11:48 -0500 Subject: [PATCH] Refactor GetEvent function. Closes #4. --- GetEvent.cs | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/GetEvent.cs b/GetEvent.cs index abd291d..28e7554 100644 --- a/GetEvent.cs +++ b/GetEvent.cs @@ -34,18 +34,10 @@ namespace RPG_Maker_LDB_Printer break; case 12010://DD 6A case 13310://E7 7E - while (stop == false) - { - GetEvent(); - } - stop = false; + CheckEnd(); if (gotInts[5] == 1) { - while (stop == false) - { - GetEvent(); - } - stop = false; + CheckEnd(); } GetEvent(); break; @@ -53,17 +45,9 @@ namespace RPG_Maker_LDB_Printer if (gotInts[3] == 2 || gotInts[4] == 1) { GetEvent(); - while (stop == false) - { - GetEvent(); - } - stop = false; + CheckEnd(); GetEvent(); - while (stop == false) - { - GetEvent(); - } - stop = false; + CheckEnd(); GetEvent(); } break; @@ -73,17 +57,9 @@ namespace RPG_Maker_LDB_Printer { stop = false; GetEvent(); - while (stop == false) - { - GetEvent(); - } - stop = false; + CheckEnd(); GetEvent(); - while (stop == false) - { - GetEvent(); - } - stop = false; + CheckEnd(); GetEvent(); } break; @@ -99,5 +75,14 @@ namespace RPG_Maker_LDB_Printer Formating.CloseIndent(); Formating.CloseIndent(); } + + static void CheckEnd() + { + while (stop == false) + { + GetEvent(); + } + stop = false; + } } }