home · contact · privacy
Don't open think taking menu if carrying something.
[plomrogue2] / rogue_chat.html
index d8d9db7c896535082a37e36ff8ac9bc3b25ebc5c..fe78f6b7118571666775d0f15df731ec3b710193 100644 (file)
@@ -763,22 +763,26 @@ let tui = {
       return game.tasks.includes(this.action_tasks[action]);
   },
   switch_mode: function(mode_name) {
+
+    function fail(msg) {
+        tui.log_msg('? ' + msg);
+        terminal.blink_screen();
+        this.switch_mode('play');
+    }
+
     if (this.mode && this.mode.name == 'control_tile_draw') {
         tui.log_msg('@ finished tile protection drawing.')
     }
     this.tile_draw = false;
       if (mode_name == 'command_thing' && (!game.player.carrying
                                            || !game.player.carrying.commandable)) {
-        this.log_msg('? not carrying anything commandable');
-        terminal.blink_screen();
-        this.switch_mode('play');
-        return;
+        return fail('not carrying anything commandable');
     };
-    if (mode_name == 'drop_thing' && (!game.player.carrying)) {
-        this.log_msg('? not carrying anything droppable');
-        terminal.blink_screen();
-        this.switch_mode('play');
-        return;
+    if (mode_name == 'take_thing' && game.player.carrying) {
+        return fail('already carrying something');
+    };
+    if (mode_name == 'drop_thing' && !game.player.carrying) {
+        return fail('not carrying anything droppable');
     }
     if (mode_name == 'admin_enter' && this.is_admin) {
         mode_name = 'admin';
@@ -796,9 +800,7 @@ let tui = {
             }
         }
         if (!thing_id) {
-            terminal.blink_screen();
-            this.log_msg('? not standing over thing');
-            return;
+            return fail('not standing over thing');
         } else {
             this.selected_thing_id = thing_id;
         }
@@ -1043,8 +1045,9 @@ let tui = {
         };
         map_lines_split.push(line);
         if (this.map_mode == 'terrain + annotations') {
-            for (const coordinate of explorer.info_hints) {
-                map_lines_split[coordinate[0]][coordinate[1]] = 'A ';
+            for (const [coordinate, _] of Object.entries(explorer.annotations)) {
+                const yx = coordinate.split(',')
+                map_lines_split[yx[0]][yx[1]] = 'A ';
             }
         } else if (this.map_mode == 'terrain + things') {
             for (const p in game.portals) {