From 609e9016160864971ad933eca0ab990aac012df4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Wed, 24 Feb 2021 01:34:47 -0500
Subject: [PATCH] Fix issue with multiple fights in a single script loop.

If the script called from winning a battle (such as in training)
ended up having a battle (such as leveling multiple times in one
visit), weird bits of map would be displayed.
---
 xtrn/lord2/lord2.js | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/xtrn/lord2/lord2.js b/xtrn/lord2/lord2.js
index 5b3888f992..e04cbab363 100644
--- a/xtrn/lord2/lord2.js
+++ b/xtrn/lord2/lord2.js
@@ -886,7 +886,6 @@ function lord_to_ansi(str)
 					bright = false;
 					break;
 				case '^':
-					// TODO: This may not do 41...
 					if (bright)
 						ret += '\x1b[0;30'+bg+'m';
 					else
@@ -3801,10 +3800,6 @@ function offline_battle()
 	var enm = enemy;
 	var supr;
 
-	// TODO Something weird happens when you do multiple training fights...
-	// A small map is shown you can move one square on during the battle.
-	// (Seen after swamp)
-	// Seen with swamp dago in SKY WORLD... which was DEAD when I moved at all
 	enemy = undefined;
 	switch(enm.sex) {
 		case 1:
@@ -4534,8 +4529,10 @@ function do_map()
 
 	ch = ''
 	while (ch != 'Q') {
-		if (enemy !== undefined)
+		if (enemy !== undefined) {
 			offline_battle();
+			continue;
+		}
 		while (!dk.console.waitkey(game.delay)) {
 			update();
 		};
-- 
GitLab