- # This code was moved from the probe() routine
- if isprobe:
- angle = ((15.0 - self.bearing) * 0.5235988)
- self.increment = coord(-math.sin(angle), math.cos(angle))
- bigger = max(abs(self.increment.i), abs(self.increment.j))
- self.increment /= bigger
- self.location = coord(game.quadrant.i*QUADSIZE + game.sector.i,
- game.quadrant.j*QUADSIZE + game.sector.j)
- self.loc = copy.copy(game.quadrant)
- self.moves = 10.0*self.distance*bigger +0.5
- def power(self):
- return self.distance*(self.warp**3)*(game.shldup+1)
- def time(self):
- return 10.0*self.distance/self.warp**2
- def nextquad(self):
- "Next location on course, at quadrant granularity."
- self.location += self.increment
- newloc = (self.location / float(QUADSIZE)).trunctogrid()
- if not newloc == self.loc:
- self.loc = newloc
+ self.angle = ((15.0 - self.bearing) * 0.5235988)
+ if origin is None:
+ self.location = cartesian(game.quadrant, game.sector)
+ self.increment = coord(-math.sin(self.angle), math.cos(self.angle))
+ bigger = max(abs(self.increment.i), abs(self.increment.j))
+ self.increment /= bigger
+ self.moves = 10*self.distance*bigger +0.5
+ def next(self, grain=1):
+ "Next step on course."
+ self.moves -=1
+ self.nextlocation = self.location + self.increment
+ oldloc = (self.location/grain).roundtogrid()
+ newloc = (self.nextlocation/grain).roundtogrid()
+ self.location = self.nextlocation
+ if newloc != oldloc: