From 52f6439810958dfe6d092c7d2ba1a4aa8b2355be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Thu, 4 Mar 2021 01:16:23 -0500
Subject: [PATCH] Clear battle flag after running a random ref

---
 xtrn/lord2/lord2.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xtrn/lord2/lord2.js b/xtrn/lord2/lord2.js
index 235363121f..bab1fe3cba 100644
--- a/xtrn/lord2/lord2.js
+++ b/xtrn/lord2/lord2.js
@@ -2285,7 +2285,10 @@ function move_player(xoff, yoff) {
 	if (moved && !special && map.battleodds > 0 && map.reffile !== '' && map.refsection !== '') {
 		if (random(map.battleodds) === 0) {
 			run_ref(map.refsection, map.reffile);
-			// TODO: Is this where we clear battle?!?!
+			player.battle = 0;
+			update_update();
+			if (pending_timeout !== undefined)
+				handle_timeout(pending_timeout);
 		}
 	}
 }
-- 
GitLab