diff pytouhou/game/laser.pyx @ 491:2276229282fd

Fix gcc’s warnings with -Wall -Wextra.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 04 Oct 2013 14:32:28 +0200
parents 8038f1957b71
children b32cef75df59
line wrap: on
line diff
--- a/pytouhou/game/laser.pyx
+++ b/pytouhou/game/laser.pyx
@@ -166,20 +166,20 @@ cdef class Laser(Element):
         self.end_offset += self.speed
 
         length = <double>min(self.end_offset - self.start_offset, self.max_length) # TODO
+        width = 0.
         if self.state == STARTING:
             if self.frame == self.start_duration:
                 self.frame = 0
                 self.state = STARTED
             else:
                 width = self.width * float(self.frame) / self.start_duration #TODO
-        if self.state == STARTED:
+        elif self.state == STARTED:
             width = self.width #TODO
             if self.frame == self.duration:
                 self.frame = 0
                 self.state = STOPPING
-        if self.state == STOPPING:
+        elif self.state == STOPPING:
             if self.frame == self.stop_duration:
-                width = 0.
                 self.removed = True
             else:
                 width = self.width * (1. - float(self.frame) / self.stop_duration) #TODO