X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fsst.py;h=920fbd13b66c5d24165a92a3d415f69bb3a0315e;hp=99daaa7199a72536fef9d115dbc95069906e70a9;hb=e27dfc4666b7e243b895518efac276833621e49e;hpb=3bfedb00b0cc477d38ea1d8e842d96440540f7e6 diff --git a/src/sst.py b/src/sst.py index 99daaa7..920fbd1 100644 --- a/src/sst.py +++ b/src/sst.py @@ -18,20 +18,20 @@ DOC_NAME = "sst.doc" def _(str): return gettext.gettext(str) -PHASEFAC = 2.0 -GALSIZE = 8 -NINHAB = (GALSIZE * GALSIZE / 2) -MAXUNINHAB = 10 -PLNETMAX = (NINHAB + MAXUNINHAB) -QUADSIZE = 10 -BASEMIN = 2 -BASEMAX = (GALSIZE * GALSIZE / 12) -MAXKLGAME = 127 -MAXKLQUAD = 9 -FULLCREW = 428 # BSD Trek was 387, that's wrong -FOREVER = 1e30 -MAXBURST = 3 -MINCMDR = 10 +GALSIZE = 8 # Galaxy size in quadrants +NINHAB = (GALSIZE * GALSIZE / 2) # Number of inhabited worlds +MAXUNINHAB = 10 # Maximum uninhabited worlds +QUADSIZE = 10 # Quadrant size in sectors +BASEMIN = 2 # Minimum starbases +BASEMAX = (GALSIZE * GALSIZE / 12) # Maximum starbases +MAXKLGAME = 127 # Maximum Klingons per game +MAXKLQUAD = 9 # Maximum Klingons per quadrant +FULLCREW = 428 # Crew size. BSD Trek was 387, that's wrong +FOREVER = 1e30 # Time for the indefinite future +MAXBURST = 3 # Max # of torps you can launch in one turn +MINCMDR = 10 # Minimum number of Klingon commanders +DOCKFAC = 0.25 # Repair faster when docked +PHASEFAC = 2.0 # Unclear what this is, it was in the C version class TrekError: pass @@ -331,10 +331,8 @@ class gamestate: self.energy = 0.0 # energy level self.shield = 0.0 # shield level self.warpfac = 0.0 # warp speed - self.wfacsq = 0.0 # squared warp factor self.lsupres = 0.0 # life support reserves self.optime = 0.0 # time taken by current operation - self.docfac = 0.0 # repair factor when docking (constant?) self.damfac = 0.0 # damage factor self.lastchart = 0.0 # time star chart was last updated self.cryprob = 0.0 # probability that crystal will work @@ -2079,7 +2077,7 @@ def events(): # Fix devices repair = xtime if game.condition == "docked": - repair /= game.docfac + repair /= DOCKFAC # Don't fix Deathray here for l in range(NDEVICES): if game.damage[l] > 0.0 and l != DDRAY: @@ -3995,7 +3993,7 @@ def timwrp(): prout(_("Spock has reconstructed a correct star chart from memory")) else: # Go forward in time - game.optime = -0.5*game.intime*math.log(randreal()) + game.optime = expran(0.5*game.intime) prout(_("You are traveling forward in time %d stardates.") % int(game.optime)) # cheat to make sure no tractor beams occur during time warp postpone(FTBEAM, game.optime) @@ -4816,7 +4814,7 @@ def damagereport(): jdam = True prout(" %-26s\t%8.2f\t\t%8.2f" % (device[i], game.damage[i]+0.05, - game.docfac*game.damage[i]+0.005)) + DOCKFAC*game.damage[i]+0.005)) if not jdam: prout(_("All devices functional.")) @@ -5246,7 +5244,6 @@ def setup(): game.iscraft = "onship" game.landed = False game.alive = True - game.docfac = 0.25 # Starchart is functional but we've never seen it game.lastchart = FOREVER # Put stars in the galaxy @@ -5412,12 +5409,10 @@ def setup(): def choose(): "Choose your game type." - global thing while True: - game.tourn = 0 + game.tourn = game.length = 0 game.thawed = False game.skill = SKILL_NONE - game.length = 0 if not scanner.inqueue: # Can start with command line options proutn(_("Would you like a regular, tournament, or saved game? ")) scanner.next() @@ -5785,8 +5780,7 @@ def makemoves(): drawmaps(1) while True: # get a command hitme = False - game.justin = False - game.optime = 0.0 + game.optime = game.justin = False scanner.chew() setwnd(prompt_window) clrscr() @@ -6206,9 +6200,10 @@ if __name__ == '__main__': raise SystemExit, 1 # where to save the input in case of bugs try: - logfp = open("/usr/tmp/sst-input.log", "w") + logfp = open("/tmp/sst-input.log", "w") except IOError: sys.stderr.write("sst: warning, can't open logfile\n") + sys.exit(1) if logfp: logfp.write("# seed %s\n" % seed) logfp.write("# options %s\n" % " ".join(arguments))