projects
/
super-star-trek.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e67cf36
)
More nomenclature fixes.
author
Eric S. Raymond
<esr@thyrsus.com>
Tue, 10 Oct 2006 01:14:36 +0000
(
01:14
+0000)
committer
Eric S. Raymond
<esr@thyrsus.com>
Tue, 10 Oct 2006 01:14:36 +0000
(
01:14
+0000)
src/sst.py
patch
|
blob
|
history
diff --git
a/src/sst.py
b/src/sst.py
index 3c40cabcea1d7137a8344bd64f96ecacfd83c259..baaea8c0fa5be65d90d9d912e8254ed678f5693f 100644
(file)
--- a/
src/sst.py
+++ b/
src/sst.py
@@
-795,13
+795,13
@@
def movebaddy(enemy):
# Check if preferred position available
look = next + m
if m.i < 0:
# Check if preferred position available
look = next + m
if m.i < 0:
- krawl
x
= 1
+ krawl
i
= 1
else:
else:
- krawl
x
= -1
+ krawl
i
= -1
if m.j < 0:
if m.j < 0:
- krawl
y
= 1
+ krawl
j
= 1
else:
else:
- krawl
y
= -1
+ krawl
j
= -1
success = False
attempts = 0; # Settle mysterious hang problem
while attempts < 20 and not success:
success = False
attempts = 0; # Settle mysterious hang problem
while attempts < 20 and not success:
@@
-809,29
+809,29
@@
def movebaddy(enemy):
if look.i < 0 or look.i >= QUADSIZE:
if motion < 0 and tryexit(enemy, look, irun):
return
if look.i < 0 or look.i >= QUADSIZE:
if motion < 0 and tryexit(enemy, look, irun):
return
- if krawl
x
== m.i or m.j == 0:
+ if krawl
i
== m.i or m.j == 0:
break
break
- look.i = next.i + krawl
x
- krawl
x = -krawlx
+ look.i = next.i + krawl
i
+ krawl
i = -krawli
elif look.j < 0 or look.j >= QUADSIZE:
if motion < 0 and tryexit(enemy, look, irun):
return
elif look.j < 0 or look.j >= QUADSIZE:
if motion < 0 and tryexit(enemy, look, irun):
return
- if krawl
y
== m.j or m.i == 0:
+ if krawl
j
== m.j or m.i == 0:
break
break
- look.j = next.j + krawl
y
- krawl
y = -krawly
+ look.j = next.j + krawl
j
+ krawl
j = -krawlj
elif (game.options & OPTION_RAMMING) and game.quad[look.i][look.j] != IHDOT:
# See if enemy should ram ship
if game.quad[look.i][look.j] == game.ship and \
(enemy.type == IHC or enemy.type == IHS):
collision(rammed=True, enemy=enemy)
return
elif (game.options & OPTION_RAMMING) and game.quad[look.i][look.j] != IHDOT:
# See if enemy should ram ship
if game.quad[look.i][look.j] == game.ship and \
(enemy.type == IHC or enemy.type == IHS):
collision(rammed=True, enemy=enemy)
return
- if krawl
x
!= m.i and m.j != 0:
- look.i = next.i + krawl
x
- krawl
x = -krawlx
- elif krawl
y
!= m.j and m.i != 0:
- look.j = next.j + krawl
y
- krawl
y = -krawly
+ if krawl
i
!= m.i and m.j != 0:
+ look.i = next.i + krawl
i
+ krawl
i = -krawli
+ elif krawl
j
!= m.j and m.i != 0:
+ look.j = next.j + krawl
j
+ krawl
j = -krawlj
else:
break; # we have failed
else:
else:
break; # we have failed
else:
@@
-2382,7
+2382,7
@@
def events():
game.optime -= xtime
if evcode == FSNOVA: # Supernova
announce()
game.optime -= xtime
if evcode == FSNOVA: # Supernova
announce()
- supernova(
Fals
e)
+ supernova(
Non
e)
schedule(FSNOVA, expran(0.5*game.intime))
if game.state.galaxy[game.quadrant.i][game.quadrant.j].supernova:
return
schedule(FSNOVA, expran(0.5*game.intime))
if game.state.galaxy[game.quadrant.i][game.quadrant.j].supernova:
return
@@
-2518,7
+2518,7
@@
def events():
game.proben -= 1 # One less to travel
if game.proben == 0 and game.isarmed and pdest.stars:
# lets blow the sucker!
game.proben -= 1 # One less to travel
if game.proben == 0 and game.isarmed and pdest.stars:
# lets blow the sucker!
- supernova(
True,
game.probec)
+ supernova(game.probec)
unschedule(FDSPROB)
if game.state.galaxy[game.quadrant.i][game.quadrant.j].supernova:
return
unschedule(FDSPROB)
if game.state.galaxy[game.quadrant.i][game.quadrant.j].supernova:
return
@@
-2682,7
+2682,7
@@
def nova(nov):
newc = coord(); neighbor = coord(); bump = coord(0, 0)
if withprob(0.05):
# Wow! We've supernova'ed
newc = coord(); neighbor = coord(); bump = coord(0, 0)
if withprob(0.05):
# Wow! We've supernova'ed
- supernova(
False, nov
)
+ supernova(
game.quadrant
)
return
# handle initial nova
game.quad[nov.i][nov.j] = IHDOT
return
# handle initial nova
game.quad[nov.i][nov.j] = IHDOT
@@
-2709,7
+2709,7
@@
def nova(nov):
elif iquad == IHSTAR: # Affect another star
if withprob(0.05):
# This star supernovas
elif iquad == IHSTAR: # Affect another star
if withprob(0.05):
# This star supernovas
- supernova(
False
)
+ supernova(
game.quadrant
)
return
else:
hits.append(neighbor)
return
else:
hits.append(neighbor)
@@
-2804,17
+2804,15
@@
def nova(nov):
game.optime = 10.0*game.dist/16.0
return
game.optime = 10.0*game.dist/16.0
return
-def supernova(
induced, w=None
):
+def supernova(
w
):
"Star goes supernova."
num = 0; npdead = 0
"Star goes supernova."
num = 0; npdead = 0
- nq = coord()
if w != None:
if w != None:
- nq =
w
+ nq =
copy.copy(w)
else:
else:
+ # Scheduled supernova -- select star at random.
stars = 0
stars = 0
- # Scheduled supernova -- select star
- # logic changed here so that we won't favor quadrants in top
- # left of universe
+ nq = coord()
for nq.i in range(GALSIZE):
for nq.j in range(GALSIZE):
stars += game.state.galaxy[nq.i][nq.j].stars
for nq.i in range(GALSIZE):
for nq.j in range(GALSIZE):
stars += game.state.galaxy[nq.i][nq.j].stars
@@
-2860,7
+2858,7
@@
def supernova(induced, w=None):
skip(1)
stars()
game.alldone = True
skip(1)
stars()
game.alldone = True
- # destroy any Klingons in supernovaed quadrant
+ # destroy any Klingons in supernovaed quadrant
kldead = game.state.galaxy[nq.i][nq.j].klingons
game.state.galaxy[nq.i][nq.j].klingons = 0
if nq == game.state.kscmdr:
kldead = game.state.galaxy[nq.i][nq.j].klingons
game.state.galaxy[nq.i][nq.j].klingons = 0
if nq == game.state.kscmdr:
@@
-2888,7
+2886,7
@@
def supernova(induced, w=None):
# Destroy any base in supernovaed quadrant
game.state.baseq = filter(lambda x: x != nq, game.state.baseq)
# If starship caused supernova, tally up destruction
# Destroy any base in supernovaed quadrant
game.state.baseq = filter(lambda x: x != nq, game.state.baseq)
# If starship caused supernova, tally up destruction
- if
induced
:
+ if
w != None
:
game.state.starkl += game.state.galaxy[nq.i][nq.j].stars
game.state.basekl += game.state.galaxy[nq.i][nq.j].starbase
game.state.nplankl += npdead
game.state.starkl += game.state.galaxy[nq.i][nq.j].stars
game.state.basekl += game.state.galaxy[nq.i][nq.j].starbase
game.state.nplankl += npdead
@@
-2898,7
+2896,7
@@
def supernova(induced, w=None):
# If supernova destroys last Klingons give special message
if (game.state.remkl + len(game.state.kcmdr) + game.state.nscrem)==0 and not nq == game.quadrant:
skip(2)
# If supernova destroys last Klingons give special message
if (game.state.remkl + len(game.state.kcmdr) + game.state.nscrem)==0 and not nq == game.quadrant:
skip(2)
- if
not induced
:
+ if
w == None
:
prout(_("Lucky you!"))
proutn(_("A supernova in %s has just destroyed the last Klingons.") % nq)
finish(FWON)
prout(_("Lucky you!"))
proutn(_("A supernova in %s has just destroyed the last Klingons.") % nq)
finish(FWON)
@@
-3947,8
+3945,8
@@
def getcourse(isprobe, akey):
xl = int(round(scanner.real))-1
dquad.i = xi
dquad.j = xj
xl = int(round(scanner.real))-1
dquad.i = xi
dquad.j = xj
- dsect.
j
= xk
- dsect.
i
= xl
+ dsect.
i
= xk
+ dsect.
j
= xl
else:
# only one pair of numbers was specified
if isprobe:
else:
# only one pair of numbers was specified
if isprobe:
@@
-3958,10
+3956,10
@@
def getcourse(isprobe, akey):
dsect.j = dsect.i = 4 # preserves 1-origin behavior
else:
# only sector specified
dsect.j = dsect.i = 4 # preserves 1-origin behavior
else:
# only sector specified
- dsect.
j
= xi
- dsect.
i
= xj
+ dsect.
i
= xi
+ dsect.
j
= xj
itemp = "normal"
itemp = "normal"
- if not VALID_QUADRANT(dquad.
j,dquad.i
) or not VALID_SECTOR(dsect.i,dsect.j):
+ if not VALID_QUADRANT(dquad.
i,dquad.j
) or not VALID_SECTOR(dsect.i,dsect.j):
huh()
return False
skip(1)
huh()
return False
skip(1)
@@
-3973,8
+3971,8
@@
def getcourse(isprobe, akey):
prout(_("Ensign Chekov- \"Course laid in, Captain.\""))
# the actual deltas get computed here
delta = coord()
prout(_("Ensign Chekov- \"Course laid in, Captain.\""))
# the actual deltas get computed here
delta = coord()
- delta.i = dquad.j-game.quadrant.j + 0.1*(dsect.
i
-game.sector.j)
- delta.j = game.quadrant.i-dquad.i + 0.1*(game.sector.i-dsect.
j
)
+ delta.i = dquad.j-game.quadrant.j + 0.1*(dsect.
j
-game.sector.j)
+ delta.j = game.quadrant.i-dquad.i + 0.1*(game.sector.i-dsect.
i
)
else: # manual
while key == IHEOL:
proutn(_("X and Y displacements- "))
else: # manual
while key == IHEOL:
proutn(_("X and Y displacements- "))
@@
-6465,11
+6463,11
@@
def ja():
scanner.chew()
while True:
scanner.next()
scanner.chew()
while True:
scanner.next()
- scanner.chew()
if scanner.token == 'y':
return True
if scanner.token == 'n':
return False
if scanner.token == 'y':
return True
if scanner.token == 'n':
return False
+ scanner.chew()
proutn(_("Please answer with \"y\" or \"n\": "))
def huh():
proutn(_("Please answer with \"y\" or \"n\": "))
def huh():