Explorar o código

add quit command for dev purposes

George C. Privon %!s(int64=8) %!d(string=hai) anos
pai
achega
821c95e2a1
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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):