projects
/
super-star-trek.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup after the phantom-base-bug fix.
[super-star-trek.git]
/
sst.py
diff --git
a/sst.py
b/sst.py
index f76f1a2f27b395e0c25b91201dc3878eca53d09a..e2bf5c378288421101bbd0fdce810982e122e7e0 100755
(executable)
--- a/
sst.py
+++ b/
sst.py
@@
-159,8
+159,10
@@
class Quadrant:
class Page:
def __init__(self):
self.stars = None
class Page:
def __init__(self):
self.stars = None
- self.starbase =
Non
e
+ self.starbase =
Fals
e
self.klingons = None
self.klingons = None
+ def __repr__(self):
+ return "<%s,%s,%s>" % (self.klingons, self.starbase, self.stars)
def fill2d(size, fillfun):
"Fill an empty list in 2D."
def fill2d(size, fillfun):
"Fill an empty list in 2D."
@@
-1028,7
+1030,7
@@
def randdevice():
return None # we should never get here
def collision(rammed, enemy):
return None # we should never get here
def collision(rammed, enemy):
- "Collision handling fo
t
rammong events."
+ "Collision handling fo
r
rammong events."
prouts(_("***RED ALERT! RED ALERT!"))
skip(1)
prout(_("***COLLISION IMMINENT."))
prouts(_("***RED ALERT! RED ALERT!"))
skip(1)
prout(_("***COLLISION IMMINENT."))
@@
-1179,8
+1181,8
@@
def torpedo(origin, bearing, dispersion, number, nburst):
game.state.baseq = filter(lambda x: x != game.quadrant, game.state.baseq)
game.quad[w.i][w.j] = '.'
game.base.invalidate()
game.state.baseq = filter(lambda x: x != game.quadrant, game.state.baseq)
game.quad[w.i][w.j] = '.'
game.base.invalidate()
- game.state.galaxy[game.quadrant.i][game.quadrant.j].starbase
-= 1
- game.state.chart[game.quadrant.i][game.quadrant.j].starbase
-= 1
+ game.state.galaxy[game.quadrant.i][game.quadrant.j].starbase
= False
+ game.state.chart[game.quadrant.i][game.quadrant.j].starbase
= False
game.state.basekl += 1
newcnd()
return None
game.state.basekl += 1
newcnd()
return None
@@
-5435,10
+5437,14
@@
def setup():
game.instar = 0
for i in range(GALSIZE):
for j in range(GALSIZE):
game.instar = 0
for i in range(GALSIZE):
for j in range(GALSIZE):
- k = randrange(1, QUADSIZE**2/10+1)
+ # Can't have more stars per quadrant than fit in one decimal digit,
+ # if we do the chart representation will break.
+ k = randrange(1, min(10, QUADSIZE**2/10))
game.instar += k
game.state.galaxy[i][j].stars = k
# Locate star bases in galaxy
game.instar += k
game.state.galaxy[i][j].stars = k
# Locate star bases in galaxy
+ if game.idebug:
+ prout("=== Allocating %d bases" % game.inbase)
for i in range(game.inbase):
while True:
while True:
for i in range(game.inbase):
while True:
while True:
@@
-5461,6
+5467,8
@@
def setup():
prout("=== Saving base #%d, close to #%d" % (i, j))
if not contflag:
break
prout("=== Saving base #%d, close to #%d" % (i, j))
if not contflag:
break
+ if game.idebug:
+ prout("=== Placing base #%d in quadrant %s" % (i, w))
game.state.baseq.append(w)
game.state.galaxy[w.i][w.j].starbase = game.state.chart[w.i][w.j].starbase = True
# Position ordinary Klingon Battle Cruisers
game.state.baseq.append(w)
game.state.galaxy[w.i][w.j].starbase = game.state.chart[w.i][w.j].starbase = True
# Position ordinary Klingon Battle Cruisers