X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=sst.py;h=db0ef8c69207ac63242132937541405a26a6c0c5;hp=3a777e1c5ba0f5cbc0a7acba8a6087353b9cecd4;hb=98e7acdbf3a07df71acbd1b81f636d7e9347711f;hpb=6e3f4a22696681b7d782fce97eb3b19a6a52e171 diff --git a/sst.py b/sst.py index 3a777e1..db0ef8c 100755 --- a/sst.py +++ b/sst.py @@ -13,7 +13,7 @@ on how to modify (and how not to modify!) this code. """ import os, sys, math, curses, time, readline, cPickle, random, copy, gettext, getpass -version="2.0" +version="2.1" docpath = (".", "../doc", "/usr/share/doc/sst") @@ -3530,7 +3530,7 @@ def imove(icourse=None, noattack=False): if icourse.origin.quadrant() != icourse.location.quadrant(): newquadrant(noattack) break - elif check_collision(icourse, w): + elif check_collision(w): print "Collision detected" break else: @@ -3901,7 +3901,7 @@ def warp(wcourse, involuntary): twarp = False wcourse.reset() # Activate Warp Engines and pay the cost - imove(course, noattack=False) + imove(wcourse, noattack=False) if game.alldone: return game.energy -= wcourse.power(game.warpfac) @@ -5203,7 +5203,6 @@ def freeze(boss): if key != "IHALPHA": huh() return - scanner.chew() if '.' not in scanner.token: scanner.token += ".trk" try: @@ -5213,6 +5212,7 @@ def freeze(boss): return cPickle.dump(game, fp) fp.close() + scanner.chew() def thaw(): "Retrieve saved game." @@ -5335,10 +5335,21 @@ def setup(): game.nkinks = game.nhelp = game.casual = game.abandoned = 0 game.iscate = game.resting = game.imine = game.icrystl = game.icraft = False game.isatb = game.state.nplankl = 0 - game.state.starkl = game.state.basekl = 0 + game.state.starkl = game.state.basekl = game.state.nworldkl = 0 game.iscraft = "onship" game.landed = False game.alive = True + + # the galaxy + game.state.galaxy = fill2d(GALSIZE, lambda i_unused, j_unused: Quadrant()) + # the starchart + game.state.chart = fill2d(GALSIZE, lambda i_unused, j_unused: Page()) + + game.state.planets = [] # Planet information + game.state.baseq = [] # Base quadrant coordinates + game.state.kcmdr = [] # Commander quadrant coordinates + game.statekscmdr = Coord() # Supercommander quadrant coordinates + # Starchart is functional but we've never seen it game.lastchart = FOREVER # Put stars in the galaxy @@ -5538,7 +5549,7 @@ def choose(): return True if scanner.sees("regular"): break - proutn(_("What is \"%s\"?") % scanner.token) + proutn(_("What is \"%s\"? ") % scanner.token) scanner.chew() while game.length==0 or game.skill==SKILL_NONE: if scanner.next() == "IHALPHA": @@ -5898,8 +5909,13 @@ def makemoves(): clrscr() setwnd(message_window) clrscr() + abandon_passed = False for (cmd, opt) in commands: - if cmd.startswith(scanner.token.upper()): + # commands after ABANDON cannot be abbreviated + if cmd == "ABANDON": + abandon_passed = True + if cmd == scanner.token.upper() or (not abandon_passed \ + and cmd.startswith(scanner.token.upper())): break; if cmd == "": listCommands() @@ -6353,3 +6369,5 @@ if __name__ == '__main__': if logfp: logfp.close() print "" + +# End.