projects
/
super-star-trek.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prevent off-by-one error do to real variables.
[super-star-trek.git]
/
sst.py
diff --git
a/sst.py
b/sst.py
index 0bb0a5b430f77751d2d1aed41507fa3aa47ef9a3..77740da60e2dbad43a6608e940e6bca1cdcc527a 100755
(executable)
--- a/
sst.py
+++ b/
sst.py
@@
-1180,7
+1180,7
@@
def collision(rammed, enemy):
game.damage[dev] += game.optime + extradm
game.shldup = False
prout(_("***Shields are down."))
game.damage[dev] += game.optime + extradm
game.shldup = False
prout(_("***Shields are down."))
- if game.
state.remkl + len(game.state.kcmdr) + game.state.nscrem
:
+ if game.
unwon()
:
announce()
damagereport()
else:
announce()
damagereport()
else:
@@
-3506,7
+3506,7
@@
def setwnd(wnd):
legend = "prompt"
else:
legend = "unknown"
legend = "prompt"
else:
legend = "unknown"
- logfp.write("#curses: setwnd(%s)\n" % legend)
+
#
logfp.write("#curses: setwnd(%s)\n" % legend)
curwnd = wnd
# Some curses implementations get confused when you try this.
try:
curwnd = wnd
# Some curses implementations get confused when you try this.
try:
@@
-3710,8
+3710,6
@@
def imove(icourse=None, noattack=False):
# check for edge of galaxy
kinks = 0
while True:
# check for edge of galaxy
kinks = 0
while True:
-
-
kink = False
if icourse.final.i < 0:
icourse.final.i = -icourse.final.i
kink = False
if icourse.final.i < 0:
icourse.final.i = -icourse.final.i
@@
-5210,7
+5208,8
@@
def lrscan(silent):
if not silent and game.state.galaxy[x][y].supernova:
proutn(" ***")
elif not silent:
if not silent and game.state.galaxy[x][y].supernova:
proutn(" ***")
elif not silent:
- proutn(" %3d" % (game.state.chart[x][y].klingons*100 + game.state.chart[x][y].starbase * 10 + game.state.chart[x][y].stars))
+ cn = " %3d" % (game.state.chart[x][y].klingons*100 + game.state.chart[x][y].starbase * 10 + game.state.chart[x][y].stars)
+ proutn(((3 - len(cn)) * '.') + cn)
if not silent:
prout(" ")
if not silent:
prout(" ")
@@
-5734,7
+5733,7
@@
def setup():
klumper = MAXKLQUAD
while True:
r = randreal()
klumper = MAXKLQUAD
while True:
r = randreal()
- klump =
(1.0 - r*r)*klumper
+ klump =
int((1.0 - r*r)*klumper)
if klump > krem:
klump = krem
krem -= klump
if klump > krem:
klump = krem
krem -= klump
@@
-5743,7
+5742,7
@@
def setup():
if not game.state.galaxy[w.i][w.j].supernova and \
game.state.galaxy[w.i][w.j].klingons + klump <= MAXKLQUAD:
break
if not game.state.galaxy[w.i][w.j].supernova and \
game.state.galaxy[w.i][w.j].klingons + klump <= MAXKLQUAD:
break
- game.state.galaxy[w.i][w.j].klingons +=
int(klump)
+ game.state.galaxy[w.i][w.j].klingons +=
klump
if krem <= 0:
break
# Position Klingon Commander Ships
if krem <= 0:
break
# Position Klingon Commander Ships
@@
-6102,6
+6101,9
@@
def newqad():
game.quad[QUADSIZE-1][0] = '.'
if game.quad[QUADSIZE-1][QUADSIZE-1]=='X':
game.quad[QUADSIZE-1][QUADSIZE-1] = '.'
game.quad[QUADSIZE-1][0] = '.'
if game.quad[QUADSIZE-1][QUADSIZE-1]=='X':
game.quad[QUADSIZE-1][QUADSIZE-1] = '.'
+ # This should guarantee that replay games don't lose info about the chart
+ if (game.options & OPTION_AUTOSCAN) or replayfp:
+ lrscan(silent=True)
def setpassword():
"Set the self-destruct password."
def setpassword():
"Set the self-destruct password."