home · contact · privacy
Minor refactor.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 25 Nov 2020 02:51:06 +0000 (03:51 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 25 Nov 2020 02:51:06 +0000 (03:51 +0100)
rogue_chat_curses.py

index a6e05ab1bf98eb0b02ab2bf12b60678bec576ddc..562c9c703b201162ae4687487f21890187c4b75b 100755 (executable)
@@ -533,6 +533,7 @@ class TUI:
             self.log_msg('@ enter tile control password for "%s":' % self.tile_control_char)
         elif self.mode.name == 'control_tile_draw':
             self.log_msg('@ can draw tile control character "%s", turn drawing on/off with [%s], finish with [%s].' % (self.tile_control_char, self.keys['toggle_tile_draw'], self.keys['switch_to_admin_enter']))
+        self.input_ = ""
         self.restore_input_values()
 
     def loop(self, stdscr):
@@ -855,35 +856,28 @@ class TUI:
                     self.log_msg('@ aborted')
                 else:
                     self.send('SET_MAP_CONTROL_PASSWORD ' + quote(self.tile_control_char) + ' ' + quote(self.input_))
-                    self.input_ = ""
                 self.switch_mode('admin')
             elif self.mode.name == 'password' and key == '\n':
                 if self.input_ == '':
                     self.input_ = ' '
                 self.password = self.input_
-                self.input_ = ""
                 self.switch_mode('edit')
             elif self.mode.name == 'admin_enter' and key == '\n':
                 self.send('BECOME_ADMIN ' + quote(self.input_))
-                self.input_ = ""
                 self.switch_mode('play')
             elif self.mode.name == 'control_pw_type' and key == '\n':
                 if len(self.input_) != 1:
                     self.log_msg('@ entered non-single-char, therefore aborted')
                     self.switch_mode('admin')
-                    self.input_ = ""
                 else:
                     self.tile_control_char = self.input_
-                    self.input_ = ""
                     self.switch_mode('control_pw_pw')
             elif self.mode.name == 'control_tile_type' and key == '\n':
                 if len(self.input_) != 1:
                     self.log_msg('@ entered non-single-char, therefore aborted')
                     self.switch_mode('admin')
-                    self.input_ = ""
                 else:
                     self.tile_control_char = self.input_
-                    self.input_ = ""
                     self.switch_mode('control_tile_draw')
             elif self.mode.name == 'chat' and key == '\n':
                 if self.input_ == '':
@@ -913,14 +907,12 @@ class TUI:
                     self.input_ = ' '
                 self.send('ANNOTATE %s %s %s' % (self.explorer, quote(self.input_),
                                                  quote(self.password)))
-                self.input_ = ""
                 self.switch_mode('edit')
             elif self.mode.name == 'portal' and key == '\n':
                 if self.input_ == '':
                     self.input_ = ' '
                 self.send('PORTAL %s %s %s' % (self.explorer, quote(self.input_),
                                                quote(self.password)))
-                self.input_ = ""
                 self.switch_mode('edit')
             elif self.mode.name == 'study':
                 if self.mode.mode_switch_on_key(self, key):