X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=sst.py;h=409ba7aa0bac2375f04a4129c186902ebff14e1f;hp=a9aa1a4b53e005fb82d0c95dd3bd8cd8fd7bd0f8;hb=ec92d2ec2b1f960e6930f86125d81e4ec2f084ab;hpb=ccc699193a1c5d2e649590351ed624aa687d5c24 diff --git a/sst.py b/sst.py index a9aa1a4..409ba7a 100755 --- a/sst.py +++ b/sst.py @@ -319,7 +319,9 @@ class Enemy: else: self.location = Coord() self.kdist = self.kavgd = None - game.enemies.remove(self) + # Guard prevents failure on Tholian or thingy + if self in game.enemies: + game.enemies.remove(self) return motion def __repr__(self): return "<%s,%s.%f>" % (self.type, self.location, self.power) # For debugging @@ -2606,7 +2608,7 @@ def wait(): if key != "IHEOL": break proutn(_("How long? ")) - scanner.chew() + scanner.chew() if key != "IHREAL": huh() return @@ -3431,8 +3433,8 @@ def proutn(proutntline): pause_game() clrscr() # Uncomment this to debug curses problems - if logfp: - logfp.write("#curses: at %s proutn(%s)\n" % ((y, x), repr(proutntline))) + #if logfp: + # logfp.write("#curses: at %s proutn(%s)\n" % ((y, x), repr(proutntline))) curwnd.addstr(proutntline) curwnd.refresh() else: @@ -3504,7 +3506,7 @@ def setwnd(wnd): legend = "prompt" else: legend = "unknown" - logfp.write("#curses: setwnd(%s)\n" % legend) + #logfp.write("#curses: setwnd(%s)\n" % legend) curwnd = wnd # Some curses implementations get confused when you try this. try: @@ -3708,8 +3710,6 @@ def imove(icourse=None, noattack=False): # check for edge of galaxy kinks = 0 while True: - - kink = False if icourse.final.i < 0: icourse.final.i = -icourse.final.i @@ -5208,7 +5208,8 @@ def lrscan(silent): if not silent and game.state.galaxy[x][y].supernova: proutn(" ***") elif not silent: - proutn(" %3d" % (game.state.chart[x][y].klingons*100 + game.state.chart[x][y].starbase * 10 + game.state.chart[x][y].stars)) + cn = " %3d" % (game.state.chart[x][y].klingons*100 + game.state.chart[x][y].starbase * 10 + game.state.chart[x][y].stars) + proutn(((3 - len(cn)) * '.') + cn) if not silent: prout(" ") @@ -6100,6 +6101,9 @@ def newqad(): game.quad[QUADSIZE-1][0] = '.' if game.quad[QUADSIZE-1][QUADSIZE-1]=='X': game.quad[QUADSIZE-1][QUADSIZE-1] = '.' + # This should guarantee that replay games don't lose info about the chart + if (game.options & OPTION_AUTOSCAN) or replayfp: + lrscan(silent=True) def setpassword(): "Set the self-destruct password." @@ -6161,6 +6165,7 @@ commands = [ ("QUIT", 0), ("HELP", 0), ("SCORE", 0), + ("CURSES", 0), ("", 0), ] @@ -6381,6 +6386,9 @@ def makemoves(): helpme() # get help elif cmd == "SCORE": score() # see current score + elif cmd == "CURSES": + game.options |= (OPTION_CURSES | OPTION_COLOR) + iostart() while True: if game.alldone: break # Game has ended