Просмотр исходного кода

add quit command for dev purposes

George C. Privon 8 лет назад
Родитель
Сommit
821c95e2a1
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      cgame.py

+ 3 - 0
cgame.py

@@ -40,6 +40,7 @@ class cgame:
                          ('b', 'additional turn for a player due to a builder (use for the 2nd play by a player)'),
                          ('b', 'additional turn for a player due to a builder (use for the 2nd play by a player)'),
                          ('e', 'end game (or play if already in postgame scoring'),
                          ('e', 'end game (or play if already in postgame scoring'),
                          ('s', '(current) score and game status'),
                          ('s', '(current) score and game status'),
+                         ('q', 'quit (will be removed for real gameplay'),
                          ('?', 'print help')]
                          ('?', 'print help')]
 
 
         self.conn = _sqlite3.connect('CarcassonneScore.db')
         self.conn = _sqlite3.connect('CarcassonneScore.db')
@@ -244,6 +245,8 @@ class cgame:
 
 
             if _re.match('e', cmd, _re.IGNORECASE):
             if _re.match('e', cmd, _re.IGNORECASE):
                 self.advanceState()
                 self.advanceState()
+            elif _re.match('q', cmd, _re.IGNORECASE):
+                _sys.exit(0)
             elif _re.match('s', cmd, _re.IGNORECASE):
             elif _re.match('s', cmd, _re.IGNORECASE):
                 self.printStatus(tilestats=True)
                 self.printStatus(tilestats=True)
             elif _re.match('n', cmd, _re.IGNORECASE):
             elif _re.match('n', cmd, _re.IGNORECASE):