From 33adc215597b0fd7553661891a3c84ce16f1955e Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 1 Dec 2020 00:57:26 +0100
Subject: [PATCH] Fix intro button display.

---
 rogue_chat.html | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/rogue_chat.html b/rogue_chat.html
index f245644..3825581 100644
--- a/rogue_chat.html
+++ b/rogue_chat.html
@@ -20,7 +20,7 @@ terminal rows: <input id="n_rows" type="number" step=4 min=24 value=24 />
 keyboard input/control: <span id="keyboard_control"></span>
 </div>
 <h3>button controls for mouse players</h3>
-<table style="float: left">
+<table id="move_table" style="float: left">
   <tr>
     <td style="text-align: right"><button id="hex_move_upleft">up-left</button></td>
     <td style="text-align: center"><button id="square_move_up">up</button></td>
@@ -625,15 +625,16 @@ let tui = {
       this.init_keys();
   },
   init_keys: function() {
+    document.getElementById("move_table").hidden = true;
     this.keys = {};
     for (let key_selector of key_selectors) {
         this.keys[key_selector.id.slice(4)] = key_selector.value;
     }
     this.movement_keys = {};
-    if (!game.map_geometry) {
-        return;
+    let geometry_prefix = 'undefinedMapGeometry_';
+    if (game.map_geometry) {
+        geometry_prefix = game.map_geometry.toLowerCase() + '_';
     }
-    let geometry_prefix = game.map_geometry.toLowerCase() + '_';
     for (const key_name of Object.keys(key_descriptions)) {
         if (key_name.startsWith(geometry_prefix)) {
             let direction = key_name.split('_')[2].toUpperCase();
@@ -645,6 +646,7 @@ let tui = {
         move_button.hidden = true;
     };
     for (const move_button of document.querySelectorAll('[id^="' + geometry_prefix + 'move_"]')) {
+        document.getElementById("move_table").hidden = false;
         move_button.hidden = false;
     };
     for (let el of document.getElementsByTagName("button")) {
-- 
2.30.2