]> thyrsus.com Git - ski.git/commitdiff
Add a pychecker check and fix two small problems it turned up.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 24 Nov 2010 06:02:11 +0000 (01:02 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 24 Nov 2010 06:02:11 +0000 (01:02 -0500)
Makefile
ski

index 21d6ecf552f398da0516ced0ff2e6bdeb6b3335b..71369bb0431bdf2fadbc5ffcbecc611c74fc93eb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,11 @@ ski.html: ski.xml
 clean:
        rm -f *~ *.6 *.html *.rpm *.lsm MANIFEST SHIPPER.*
 
+pychecker:
+       @ln -f ski ski.py
+       @-pychecker --only --limit 50 ski.py
+       @rm -f ski.py*
+
 ski-$(VERS).tar.gz: $(SOURCES)
        @ls $(SOURCES) | sed s:^:ski-$(VERS)/: >MANIFEST
        @(cd ..; ln -s ski ski-$(VERS))
diff --git a/ski b/ski
index 5d5b90c5bdd1d3b049093ed3146789e655645e7e..17f92a2f45a85d5c68d44aaa59a031f965b34efa 100755 (executable)
--- a/ski
+++ b/ski
@@ -152,7 +152,7 @@ class SkiWorld:
         "Return a random location"
         return random.choice(range(len(self.slope)))
 
-    def gen_next_slope(self, next_level):
+    def gen_next_slope(self):
         # Generates the slope of the next level, dependent upon
         # the characteristics of the current level, the probabilities, and the
         # position of the player.
@@ -218,7 +218,7 @@ class SkiWorld:
                         player.player_speed + len(self.slope)) % len(self.slope)
 
         # Generate the updated slope.
-        self.gen_next_slope(self)
+        self.gen_next_slope()
 
         # If there is no Yeti, one might be created.
         if not exists(self.yeti) and percent(self.prob_yeti_appearance):
@@ -374,7 +374,7 @@ class SkiPlayer:
     def check_obstacles(self, world):
        # If we are just landing after a jump, we might fall down.
         if (self.jump_count == 0) and percent(PROB_BAD_LANDING):
-            self.__accident("Whoops!  A bad landing!", LIGHT_INJURY)
+            self.__accident("Whoops!  A bad landing!", SLIGHT_INJURY)
 
        # If there is a tree in our position, we might hit it.
         if (world.terrain() == REP_TREE) and percent(PROB_HIT_TREE):