Add a -V option.
[super-star-trek.git] / sst.py
diff --git a/sst.py b/sst.py
index caf6b6e855b084b4148c1bf731a4d072f1bd02bd..5bc4bac3fe31fc27db8d0ebf272f251edf5b1611 100644 (file)
--- 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)
@@ -3066,7 +3068,7 @@ def iostart():
     "for some recent versions of python2, the following enables UTF8"
     "for the older ones we probably need to set C locale, and the python3"
     "has no problems at all"
     "for some recent versions of python2, the following enables UTF8"
     "for the older ones we probably need to set C locale, and the python3"
     "has no problems at all"
-    if sys.version_info.major < 3:
+    if sys.version_info[0] < 3:
        import locale
        locale.setlocale(locale.LC_ALL, "")
     gettext.bindtextdomain("sst", "/usr/local/share/locale")
        import locale
        locale.setlocale(locale.LC_ALL, "")
     gettext.bindtextdomain("sst", "/usr/local/share/locale")
@@ -5230,7 +5232,7 @@ def thaw():
     return False
 
 # I used <http://www.memory-alpha.org> to find planets
     return False
 
 # I used <http://www.memory-alpha.org> to find planets
-# with references in ST:TOS.  Eath and the Alpha Centauri
+# with references in ST:TOS.  Earth and the Alpha Centauri
 # Colony have been omitted.
 # 
 # Some planets marked Class G and P here will be displayed as class M
 # Colony have been omitted.
 # 
 # Some planets marked Class G and P here will be displayed as class M
@@ -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