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 (from parent 1:
4617c9b
)
Simplify the probe code.
author
Eric S. Raymond
<esr@thyrsus.com>
Wed, 11 Oct 2006 00:52:25 +0000
(
00:52
+0000)
committer
Eric S. Raymond
<esr@thyrsus.com>
Wed, 11 Oct 2006 00:52:25 +0000
(
00:52
+0000)
src/sst.py
patch
|
blob
|
history
diff --git
a/src/sst.py
b/src/sst.py
index 1fc432384991f5e232b05cb2e78a59ae3210a046..94a7184d417628d66659dc6be2a2bf526a34d6af 100644
(file)
--- a/
src/sst.py
+++ b/
src/sst.py
@@
-2455,26
+2455,23
@@
def events():
elif evcode == FDSPROB: # Move deep space probe
schedule(FDSPROB, 0.01)
game.probe += game.probein
elif evcode == FDSPROB: # Move deep space probe
schedule(FDSPROB, 0.01)
game.probe += game.probein
- i = int(round(game.probe.i/float(QUADSIZE)))
- j = int(round(game.probe.j/float(QUADSIZE)))
- if game.probec.i != i or game.probec.j != j:
- game.probec.i = i
- game.probec.j = j
- if not VALID_QUADRANT(i, j) or \
+ newloc = (game.probe / float(QUADSIZE)).snaptogrid()
+ if newloc != game.probec:
+ game.probec = newloc
+ if not VALID_QUADRANT(game.probec.i, game.probec.j) or \
game.state.galaxy[game.probec.i][game.probec.j].supernova:
# Left galaxy or ran into supernova
if communicating():
announce()
skip(1)
proutn(_("Lt. Uhura- \"The deep space probe "))
game.state.galaxy[game.probec.i][game.probec.j].supernova:
# Left galaxy or ran into supernova
if communicating():
announce()
skip(1)
proutn(_("Lt. Uhura- \"The deep space probe "))
- if not VALID_QUADRANT(
i,
j):
- proutn(_("has left the galaxy"))
+ if not VALID_QUADRANT(
game.probec.i, game.probec.
j):
+ proutn(_("has left the galaxy
.\"
"))
else:
else:
- proutn(_("is no longer transmitting"))
- prout(".\"")
+ proutn(_("is no longer transmitting.\""))
unschedule(FDSPROB)
continue
unschedule(FDSPROB)
continue
- if
not
communicating():
+ if communicating():
announce()
skip(1)
proutn(_("Lt. Uhura- \"The deep space probe is now in Quadrant %s.\"") % game.probec)
announce()
skip(1)
proutn(_("Lt. Uhura- \"The deep space probe is now in Quadrant %s.\"") % game.probec)