home · contact · privacy
Augment map display with thing amount info.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 13 Nov 2020 23:49:38 +0000 (00:49 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 13 Nov 2020 23:49:38 +0000 (00:49 +0100)
rogue_chat_curses.py
rogue_chat_nocanvas_monochrome.html

index f69153f1006cb127cf9f25a24bf52e6c2b118330..2207220dda4cf31f69a46c77e14683ff9cf5ca2c 100755 (executable)
@@ -492,18 +492,23 @@ class TUI:
             for y in range(self.game.map_geometry.size.y):
                 start = self.game.map_geometry.size.x * y
                 end = start + self.game.map_geometry.size.x
-                map_lines_split += [list(map_content[start:end])]
+                map_lines_split += [[c + ' ' for c in map_content[start:end]]]
             if self.map_mode == 'terrain':
+                used_positions = []
                 for t in self.game.things:
                     symbol = self.game.thing_types[t.type_]
-                    map_lines_split[t.position.y][t.position.x] = symbol
+                    if t.position in used_positions:
+                        map_lines_split[t.position.y][t.position.x] = symbol + '+'
+                    else:
+                        map_lines_split[t.position.y][t.position.x] = symbol + ' '
+                    used_positions += [t.position]
             if self.mode.shows_info:
-                map_lines_split[self.explorer.y][self.explorer.x] = '?'
+                map_lines_split[self.explorer.y][self.explorer.x] = '??'
             map_lines = []
             if type(self.game.map_geometry) == MapGeometryHex:
                 indent = 0
                 for line in map_lines_split:
-                    map_lines += [indent*' ' + ' '.join(line)]
+                    map_lines += [indent*' ' + ''.join(line)]
                     indent = 0 if indent else 1
             else:
                 for line in map_lines_split:
index f978421590815a40877f704e13001bc72631c6e3..1f2ebe0dcd1865ba8b25e5329c55a9ce8e97aa71 100644 (file)
@@ -446,18 +446,24 @@ let tui = {
             line = [];
             j = 0;
         };
-        line.push(map_content[i]);
+        line.push(map_content[i] + ' ');
     };
     map_lines_split.push(line);
     if (this.map_mode == 'terrain') {
+        let used_positions = [];
         for (const thing_id in game.things) {
             let t = game.things[thing_id];
             let symbol = game.thing_types[t.type_];
-            map_lines_split[t.position[0]][t.position[1]] = symbol;
+            if (used_positions.includes(t.position.toString())) {
+                map_lines_split[t.position[0]][t.position[1]] = symbol + '+';
+            } else {
+                map_lines_split[t.position[0]][t.position[1]] = symbol + ' ';
+            };
+            used_positions.push(t.position.toString());
         };
     }
     if (tui.mode.shows_info) {
-        map_lines_split[explorer.position[0]][explorer.position[1]] = '?';
+        map_lines_split[explorer.position[0]][explorer.position[1]] = '??';
     }
     let map_lines = []
     if (game.map_geometry == 'Square') {
@@ -467,7 +473,7 @@ let tui = {
     } else if (game.map_geometry == 'Hex') {
         let indent = 0
         for (let line_split of map_lines_split) {
-            map_lines.push(' '.repeat(indent) + line_split.join(' '));
+            map_lines.push(' '.repeat(indent) + line_split.join(''));
             if (indent == 0) {
                 indent = 1;
             } else {