Add failure message for unlikely circumstance.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 18 Feb 2017 18:42:41 +0000 (13:42 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 18 Feb 2017 18:42:41 +0000 (13:42 -0500)
sst.py

diff --git a/sst.py b/sst.py
index 9b35fd7e4a0c2ced7d9d32cfc247e929b6df0576..d3c8606665ca02e8f8aa2ace2d9f6c6daf221300 100755 (executable)
--- a/sst.py
+++ b/sst.py
@@ -4247,11 +4247,15 @@ def mayday():
         # There's one in this quadrant
         ddist = (game.base - game.sector).distance()
     else:
         # There's one in this quadrant
         ddist = (game.base - game.sector).distance()
     else:
+        ibq = None     # Force base-quadrant game to persist past loop
         ddist = FOREVER
         for ibq in game.state.baseq:
             xdist = QUADSIZE * (ibq - game.quadrant).distance()
             if xdist < ddist:
                 ddist = xdist
         ddist = FOREVER
         for ibq in game.state.baseq:
             xdist = QUADSIZE * (ibq - game.quadrant).distance()
             if xdist < ddist:
                 ddist = xdist
+        if ibq is None:
+            prout(_("No starbases remain. You are alone in a hostile galaxy."))
+            return
         # Since starbase not in quadrant, set up new quadrant
         game.quadrant = ibq
         newqad()
         # Since starbase not in quadrant, set up new quadrant
         game.quadrant = ibq
         newqad()