Add color. Turns out SCORE was implemented already.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 23 Feb 2017 02:15:53 +0000 (21:15 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 23 Feb 2017 02:15:53 +0000 (21:15 -0500)
NEWS
sst.py

diff --git a/NEWS b/NEWS
index 4163fb41a1dc32c6171c6d303d0f35f7b0bf08de..7be2432428992925a9e756e3e641249587b4f973 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,7 @@
                        SST2K project news.
 
 2.2 @
-    Enable GNU readline keys. Added SCORE command.
+    Enable GNU readline keys. Added color.
 
 2.1 @ 2012-02-16
     Packaging fixes, pychecker cleanup, cope with Freshmeat name changes.
diff --git a/sst.py b/sst.py
index 69e963cc42ab032e1bc797a79a0ab04a8fd2bddf..df431649e1c0a0579f0f336a4d4b6ce1aa819130 100755 (executable)
--- a/sst.py
+++ b/sst.py
@@ -23,7 +23,7 @@ except ImportError:
 
 version = "2.1"
 
-docpath        = (".", "../doc", "/usr/share/doc/sst")
+docpath        = (".", "doc/", "/usr/share/doc/sst/")
 
 def _(st):
     return gettext.gettext(st)
@@ -5054,13 +5054,20 @@ def chart():
 def sectscan(goodScan, i, j):
     "Light up an individual dot in a sector."
     if goodScan or (abs(i-game.sector.i)<= 1 and abs(j-game.sector.j) <= 1):
-        textcolor({"green":GREEN,
-                   "yellow":YELLOW,
-                   "red":RED,
-                   "docked":CYAN,
-                   "dead":BROWN}[game.condition])
-        if game.quad[i][j] != game.ship:
-            highvideo()
+        if game.quad[i][j] in ('E', 'F'):
+            textcolor({"green":GREEN,
+                       "yellow":YELLOW,
+                       "red":RED,
+                       "docked":CYAN,
+                       "dead":BROWN}[game.condition])
+        else:
+            textcolor({'?':LIGHTMAGENTA,
+                       'K':LIGHTRED,
+                       'S':LIGHTRED,
+                       'C':LIGHTRED,
+                       'R':LIGHTRED,
+                       'T':LIGHTRED,
+                       }.get(game.quad[i][j], DEFAULT))
         proutn("%c " % game.quad[i][j])
         textcolor(DEFAULT)
     else:
@@ -5698,8 +5705,7 @@ def choose():
         game.options &=~ (OPTION_THINGY | OPTION_BLKHOLE | OPTION_BASE | OPTION_WORLDS | OPTION_COLOR)
         game.options |= OPTION_ALMY
     elif scanner.sees("fancy") or scanner.sees("\n"):
-        # FIXME: color doesn not quite work yet
-        game.options &=~ OPTION_COLOR
+        pass
     elif len(scanner.token):
         proutn(_("What is \"%s\"?") % scanner.token)
     setpassword()
@@ -5900,7 +5906,6 @@ commands = [
     ("IMPULSE",          0),
     ("REST",             0),
     ("WARP",             0),
-    ("SCORE",            0),
     ("SENSORS",          OPTION_PLANETS),
     ("ORBIT",            OPTION_PLANETS),
     ("TRANSPORT",        OPTION_PLANETS),
@@ -6071,8 +6076,6 @@ def makemoves():
                 hitme = True
         elif cmd == "WARP":                # warp
             setwarp()
-        elif cmd == "SCORE":                # score
-            score()
         elif cmd == "SENSORS":                # sensors
             sensor()
         elif cmd == "ORBIT":                # orbit