projects
/
super-star-trek.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0e2cd83
)
Fix the probe bug.
author
Eric S. Raymond
<esr@thyrsus.com>
Wed, 11 Oct 2006 21:22:07 +0000
(21:22 +0000)
committer
Eric S. Raymond
<esr@thyrsus.com>
Wed, 11 Oct 2006 21:22:07 +0000
(21:22 +0000)
src/sst.py
patch
|
blob
|
history
diff --git
a/src/sst.py
b/src/sst.py
index bb1e6f9b4c064eb0b70efb2c5e99ee3f8f7ea53d..a83d6caaf8a53118ef0d039a7c6e61445936d2ad 100644
(file)
--- a/
src/sst.py
+++ b/
src/sst.py
@@
-252,7
+252,9
@@
class coord:
return coord(self.i/other, self.j/other)
def __rdiv__(self, other):
return coord(self.i/other, self.j/other)
return coord(self.i/other, self.j/other)
def __rdiv__(self, other):
return coord(self.i/other, self.j/other)
- def snaptogrid(self):
+ def roundtogrid(self):
+ return coord(int(round(self.i)), int(round(self.j)))
+ def trunctogrid(self):
return coord(int(round(self.i)), int(round(self.j)))
def distance(self, other=None):
if not other: other = coord(0, 0)
return coord(int(round(self.i)), int(round(self.j)))
def distance(self, other=None):
if not other: other = coord(0, 0)
@@
-1277,7
+1279,7
@@
def torpedo(origin, course, dispersion, number, nburst):
# Loop to move a single torpedo
for step in range(1, QUADSIZE*2):
ungridded += delta
# Loop to move a single torpedo
for step in range(1, QUADSIZE*2):
ungridded += delta
- w = ungridded.
snap
togrid()
+ w = ungridded.
round
togrid()
if not VALID_SECTOR(w.i, w.j):
break
iquad=game.quad[w.i][w.j]
if not VALID_SECTOR(w.i, w.j):
break
iquad=game.quad[w.i][w.j]
@@
-2454,7
+2456,7
@@
def events():
supercommander()
elif evcode == FDSPROB: # Move deep space probe
schedule(FDSPROB, 0.01)
supercommander()
elif evcode == FDSPROB: # Move deep space probe
schedule(FDSPROB, 0.01)
- if game.probe.next():
+ if game.probe.next
quad
():
if not VALID_QUADRANT(game.probe.loc.i, game.probe.loc.j) or \
game.state.galaxy[game.probe.loc.i][game.probe.loc.j].supernova:
# Left galaxy or ran into supernova
if not VALID_QUADRANT(game.probe.loc.i, game.probe.loc.j) or \
game.state.galaxy[game.probe.loc.i][game.probe.loc.j].supernova:
# Left galaxy or ran into supernova
@@
-3950,10
+3952,10
@@
class course:
return self.distance*(self.warp**3)*(game.shldup+1)
def time(self):
return 10.0*self.distance/self.warp**2
return self.distance*(self.warp**3)*(game.shldup+1)
def time(self):
return 10.0*self.distance/self.warp**2
- def next(self):
- "Next location on course,
currently only
at quadrant granularity."
+ def next
quad
(self):
+ "Next location on course, at quadrant granularity."
self.location += self.increment
self.location += self.increment
- newloc = (self.location / float(QUADSIZE)).
snap
togrid()
+ newloc = (self.location / float(QUADSIZE)).
trunc
togrid()
if not newloc == self.loc:
self.loc = newloc
return True
if not newloc == self.loc:
self.loc = newloc
return True