X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fsst.py;h=0a8a7863ac6029c83ba98e407bf6b98553ff8b8a;hp=f6ea2b3cc74def8b17eaad490e7303650f879257;hb=88f1367a7d32b1f5248e88117562781b0c14dc0b;hpb=864fc6f6f8207448aff50762ffc634853b3f5f47 diff --git a/src/sst.py b/src/sst.py index f6ea2b3..0a8a786 100644 --- a/src/sst.py +++ b/src/sst.py @@ -649,7 +649,7 @@ def movescom(iq, avoid): game.state.kscmdr = iq game.state.galaxy[game.state.kscmdr.i][game.state.kscmdr.j].klingons += 1 if game.state.kscmdr==game.quadrant: - # SC has scooted, Remove him from current quadrant + # SC has scooted, remove him from current quadrant game.iscate=False game.isatb=0 game.ientesc = False @@ -970,11 +970,12 @@ def randdevice(): 15, # DCOMPTR: computer 1.5% 20, # NAVCOMP: navigation system 2.0% 75, # DTRANSP: transporter 7.5% - 20, # DSHCTRL: high-speed shield controller 2.0% + 20, # DSHCTRL: high-speed shield controller 2.0% 10, # DDRAY: death ray 1.0% 30, # DDSP: deep-space probes 3.0% ) - idx = randrange(1000) # weights must sum to 1000 + assert(sum(weights) == 1000) + idx = randrange(1000) sum = 0 for (i, w) in enumerate(weights): sum += w @@ -2326,7 +2327,7 @@ def events(): else: prout(_("Uhura- Starfleet reports increased Klingon activity")) if q.planet != None: - proutn(_("near %s") % q.planet) + proutn(_("near %s ") % q.planet) prout(_("in Quadrant %s.") % w) def wait(): @@ -4458,7 +4459,7 @@ def usecrystals(): skip(1) prouts(_("Scotty- \"Keep your fingers crossed, Sir!\"")) skip(1) - if with(game.cryprob): + if random.random() > game.cryprob: prouts(_(" \"Activating now! - - No good! It's***")) skip(2) prouts(_("***RED ALERT! RED A*L********************************")) @@ -6197,8 +6198,12 @@ if __name__ == '__main__': sys.stderr.write("usage: sst [-t] [-x] [startcommand...].\n") raise SystemExit, 1 # where to save the input in case of bugs + if "TMPDIR" in os.environ: + tmpdir = os.environ['TMPDIR'] + else: + tmpdir = "/tmp" try: - logfp = open("/tmp/sst-input.log", "w") + logfp = open(os.path.join(tmpdir, "sst-input.log"), "w") except IOError: sys.stderr.write("sst: warning, can't open logfile\n") sys.exit(1)