From: Eric S. Raymond Date: Wed, 11 Oct 2006 00:52:25 +0000 (+0000) Subject: Simplify the probe code. X-Git-Tag: 2.0~84 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=b849c5fbc49f1f6752b5879fbe6dbef99f24f921;p=super-star-trek.git Simplify the probe code. --- diff --git a/src/sst.py b/src/sst.py index 1fc4323..94a7184 100644 --- 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 - 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 ")) - 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: - proutn(_("is no longer transmitting")) - prout(".\"") + proutn(_("is no longer transmitting.\"")) 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)