Beep if action is unavailable.
authorJeremy Thurgood <firxen@gmail.com>
Tue, 13 May 2014 18:09:48 +0000 (20:09 +0200)
committerJeremy Thurgood <firxen@gmail.com>
Tue, 13 May 2014 18:09:48 +0000 (20:09 +0200)
naja/widgets/info_area.py

index d50c3ad33e2e8a59759190e1b19724ca3ba6984e..40bc75b662a758920a1ccc7855b12cd8571b0aae 100644 (file)
@@ -83,8 +83,11 @@ class InfoAreaWidget(Widget):
             return super(InfoAreaWidget, self).handle_event(ev)
         if ev.type == pgl.KEYDOWN:
             if ev.key in (pgl.K_RETURN, pgl.K_KP_ENTER):
-                self.card.actions[self.chosen].perform_action(
-                    self.state.gameboard, self.card)
+                action = self.card.actions[self.chosen]
+                if not action.check_available(self.state.gameboard.player):
+                    print "BEEP!"
+                    return True
+                action.perform_action(self.state.gameboard, self.card)
                 self.state.gameboard.change_mode()
                 InvalidateTheWorld.post()
                 return True