chmod +x sst.py
[super-star-trek.git] / sst.py
diff --git a/sst.py b/sst.py
old mode 100644 (file)
new mode 100755 (executable)
index a576664..9b36285
--- a/sst.py
+++ b/sst.py
@@ -13,6 +13,8 @@ on how to modify (and how not to modify!) this code.
 """
 import os, sys, math, curses, time, readline, cPickle, random, copy, gettext, getpass
 
 """
 import os, sys, math, curses, time, readline, cPickle, random, copy, gettext, getpass
 
+version="2.0"
+
 docpath        = (".", "../doc", "/usr/share/doc/sst")
 
 def _(str): return gettext.gettext(str)
 docpath        = (".", "../doc", "/usr/share/doc/sst")
 
 def _(str): return gettext.gettext(str)
@@ -1575,7 +1577,7 @@ def torps():
        torpedo(game.sector, course[i], dispersion, number=i, nburst=n)
        if game.alldone or game.state.galaxy[game.quadrant.i][game.quadrant.j].supernova:
            return
        torpedo(game.sector, course[i], dispersion, number=i, nburst=n)
        if game.alldone or game.state.galaxy[game.quadrant.i][game.quadrant.j].supernova:
            return
-    if (game.state.remkl + len(game.state.kcmdr) + game.state.nscrem)==0:
+    if (game.state.remkl + len(game.state.kcmdr) + game.state.nscrem)<=0:
        finish(FWON);
 
 def overheat(rpow):
        finish(FWON);
 
 def overheat(rpow):
@@ -6255,7 +6257,7 @@ if __name__ == '__main__':
         else:
             game.options |= OPTION_TTY
         seed = int(time.time())
         else:
             game.options |= OPTION_TTY
         seed = int(time.time())
-        (options, arguments) = getopt.getopt(sys.argv[1:], "r:s:tx")
+        (options, arguments) = getopt.getopt(sys.argv[1:], "r:s:txV")
         for (switch, val) in options:
             if switch == '-r':
                 try:
         for (switch, val) in options:
             if switch == '-r':
                 try:
@@ -6282,6 +6284,9 @@ if __name__ == '__main__':
                 game.options &=~ OPTION_CURSES
             elif switch == '-x':
                 idebug = True
                 game.options &=~ OPTION_CURSES
             elif switch == '-x':
                 idebug = True
+            elif switch == '-V':
+                print "SST2K", version
+                raise SystemExit, 0 
             else:
                 sys.stderr.write("usage: sst [-t] [-x] [startcommand...].\n")
                 raise SystemExit, 1
             else:
                 sys.stderr.write("usage: sst [-t] [-x] [startcommand...].\n")
                 raise SystemExit, 1