From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 7 Dec 2020 03:07:46 +0000 (+0100)
Subject: Fix bug where MAP height setting would break draw_map.
X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/reset_cookie?a=commitdiff_plain;h=5f77cabba400be428d6d402d9642836e449bd332;p=plomrogue2

Fix bug where MAP height setting would break draw_map.
---

diff --git a/rogue_chat.html b/rogue_chat.html
index d971c9b..f7a97ec 100644
--- a/rogue_chat.html
+++ b/rogue_chat.html
@@ -1066,7 +1066,7 @@ let tui = {
     let term_x = Math.max(0, -this.offset[1]);
     let map_y = Math.max(0, this.offset[0]);
     let map_x = Math.max(0, this.offset[1]);
-    for (; term_y < terminal.rows && map_y < game.map_size[0]; term_y++, map_y++) {
+    for (; term_y < terminal.rows && map_y < this.map_lines.length; term_y++, map_y++) {
         let to_draw = this.map_lines[map_y].slice(map_x, this.window_width + this.offset[1]);
         terminal.write(term_y, term_x, to_draw);
     }
diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py
index 8adbee5..7006027 100755
--- a/rogue_chat_curses.py
+++ b/rogue_chat_curses.py
@@ -896,7 +896,7 @@ class TUI:
             term_x = max(0, -self.offset.x)
             map_y = max(0, self.offset.y)
             map_x = max(0, self.offset.x)
-            while (term_y < self.size.y and map_y < self.game.map_geometry.size.y):
+            while term_y < self.size.y and map_y < len(self.map_lines):
                 to_draw = self.map_lines[map_y][map_x:self.window_width + self.offset.x]
                 safe_addstr(term_y, term_x, to_draw)
                 term_y += 1