projects
/
super-star-trek.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make m m .1 work again.
[super-star-trek.git]
/
sst.py
diff --git
a/sst.py
b/sst.py
index 58857746e4b63c47474ffea7e956da28c6ba246c..7c7d075a8c9527a484e089dcfd070ae77badfade 100755
(executable)
--- a/
sst.py
+++ b/
sst.py
@@
-21,6
+21,13
@@
try:
except ImportError:
pass
except ImportError:
pass
+# Prevent lossage under Python 3
+try:
+ my_input = raw_input
+except NameError:
+ my_input = input
+
+
version = "2.1"
docpath = (".", "doc/", "/usr/share/doc/sst/")
version = "2.1"
docpath = (".", "doc/", "/usr/share/doc/sst/")
@@
-2120,20
+2127,22
@@
def capture():
# intelligent design
# x = 300 + 25*skill;
x = game.energy / (weakest.power * len(klingons))
# intelligent design
# x = 300 + 25*skill;
x = game.energy / (weakest.power * len(klingons))
- x *= 2.5; # would originally have been equivalent of 1.4,
+ #prout(_("Stats: energy = %s, kpower = %s, klingons = %s")
+ # % (game.energy, weakest.power, len(klingons)))
+ x *= 2.5 # would originally have been equivalent of 1.4,
# but we want command to work more often, more humanely */
# but we want command to work more often, more humanely */
- #prout(_("Prob = %
d (%.4f)\n", i,
x))
+ #prout(_("Prob = %
.4f" %
x))
# x = 100; // For testing, of course!
# x = 100; // For testing, of course!
- if x
>
randreal(100):
+ if x
<
randreal(100):
# guess what, he surrendered!!! */
prout(_("Klingon captain at %s surrenders.") % weakest.location)
i = randreal(200)
if i > 0:
# guess what, he surrendered!!! */
prout(_("Klingon captain at %s surrenders.") % weakest.location)
i = randreal(200)
if i > 0:
- prout(_("%d Klingons commit suicide rather than be taken captive.") %
200 - i
)
- if i > brigfree:
- prout(_("%d Klingons die because there is no room for them in the brig.") %
i-brigfree
)
- i = brigfree
- brigfree -= i
+ prout(_("%d Klingons commit suicide rather than be taken captive.") %
(200 - i)
)
+ if i >
game.
brigfree:
+ prout(_("%d Klingons die because there is no room for them in the brig.") %
(i-brigfree)
)
+ i =
game.
brigfree
+
game.
brigfree -= i
prout(_("%d captives taken") % i)
deadkl(weakest.location, weakest.type, game.sector)
if (game.state.remkl + len(game.state.kcmdr) + game.state.nscrem)<=0:
prout(_("%d captives taken") % i)
deadkl(weakest.location, weakest.type, game.sector)
if (game.state.remkl + len(game.state.kcmdr) + game.state.nscrem)<=0:
@@
-2141,7
+2150,7
@@
def capture():
return
# big surprise, he refuses to surrender */
return
# big surprise, he refuses to surrender */
-
prout(_("Fat chance, captain!"))
+ prout(_("Fat chance, captain!"))
# Code from events.c begins here.
# Code from events.c begins here.
@@
-3404,7
+3413,7
@@
def pause_game():
sys.stdout.write('\n')
proutn(prompt)
if not replayfp:
sys.stdout.write('\n')
proutn(prompt)
if not replayfp:
- input()
+
my_
input()
sys.stdout.write('\n' * rows)
linecount = 0
sys.stdout.write('\n' * rows)
linecount = 0
@@
-3476,7
+3485,11
@@
def cgetline():
elif linein[0] != "#":
break
else:
elif linein[0] != "#":
break
else:
- linein = eval(input()) + "\n"
+ try:
+ linein = my_input() + "\n"
+ except EOFError:
+ prout("")
+ sys.exit(0)
if logfp:
logfp.write(linein)
return linein
if logfp:
logfp.write(linein)
return linein
@@
-3527,7
+3540,7
@@
def clrscr():
linecount = 0
def textcolor(color=DEFAULT):
linecount = 0
def textcolor(color=DEFAULT):
- if
game.options & OPTION_COLOR
:
+ if
(game.options & OPTION_COLOR) and (game.options & OPTION_CURSES)
:
if color == DEFAULT:
curwnd.attrset(0)
elif color == BLACK:
if color == DEFAULT:
curwnd.attrset(0)
elif color == BLACK:
@@
-3564,7
+3577,7
@@
def textcolor(color=DEFAULT):
curwnd.attron(curses.color_pair(curses.COLOR_WHITE) | curses.A_BOLD)
def highvideo():
curwnd.attron(curses.color_pair(curses.COLOR_WHITE) | curses.A_BOLD)
def highvideo():
- if
game.options & OPTION_COLOR
:
+ if
(game.options & OPTION_COLOR) and (game.options & OPTION_CURSES)
:
curwnd.attron(curses.A_REVERSE)
#
curwnd.attron(curses.A_REVERSE)
#
@@
-3998,15
+4011,16
@@
def getcourse(isprobe):
iprompt = True
key = scanner.nexttok()
itemp = "verbose"
iprompt = True
key = scanner.nexttok()
itemp = "verbose"
- if key != "IHREAL":
+ if key == "IHREAL":
+ delta.j = scanner.real
+ else:
huh()
raise TrekError
huh()
raise TrekError
- delta.j = scanner.real
key = scanner.nexttok()
key = scanner.nexttok()
- if key
!
= "IHREAL":
- huh()
- raise TrekError
- delta.i = scanner.real
+ if key
=
= "IHREAL":
+ delta.i = scanner.real
+ else:
+ delta.i = 0
# Check for zero movement
if delta.i == 0 and delta.j == 0:
scanner.chew()
# Check for zero movement
if delta.i == 0 and delta.j == 0:
scanner.chew()