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:
8490aab
)
status command is almost working. Must resolve the mess with planet pointers.
author
Eric S. Raymond
<esr@thyrsus.com>
Thu, 5 Oct 2006 09:12:06 +0000
(09:12 +0000)
committer
Eric S. Raymond
<esr@thyrsus.com>
Thu, 5 Oct 2006 09:12:06 +0000
(09:12 +0000)
src/sst.py
patch
|
blob
|
history
diff --git
a/src/sst.py
b/src/sst.py
index c006da46d3916b2812738a4fdee8cd156c6ed502..5419624172b8151ae37bbe2eb8d8888e12a4a910 100644
(file)
--- a/
src/sst.py
+++ b/
src/sst.py
@@
-3731,7
+3731,7
@@
def drawmaps(mode):
setwnd(report_window)
report_window.clear()
report_window.move(0, 0)
setwnd(report_window)
report_window.clear()
report_window.move(0, 0)
- status(
0
)
+ status()
setwnd(lrscan_window)
lrscan_window.clear()
lrscan_window.move(0, 0)
setwnd(lrscan_window)
lrscan_window.clear()
lrscan_window.move(0, 0)
@@
-3822,8
+3822,8
@@
def prstat(txt, data):
skip(1)
setwnd(status_window)
else:
skip(1)
setwnd(status_window)
else:
- proutn(" " *
NSYM - len(tx
))
-
v
proutn(data)
+ proutn(" " *
(NSYM - len(txt)
))
+ proutn(data)
skip(1)
if game.options & OPTION_CURSES:
setwnd(report_window)
skip(1)
if game.options & OPTION_CURSES:
setwnd(report_window)
@@
-5484,13
+5484,13
@@
def sectscan(goodScan, i, j):
else:
proutn("- ")
else:
proutn("- ")
-def status(req):
+def status(req
=0
):
# print status report lines
if not req or req == 1:
prstat(_("Stardate"), _("%.1f, Time Left %.2f") \
% (game.state.date, game.state.remtime))
# print status report lines
if not req or req == 1:
prstat(_("Stardate"), _("%.1f, Time Left %.2f") \
% (game.state.date, game.state.remtime))
-
el
if not req or req == 2:
+ if not req or req == 2:
if game.condition != "docked":
newcnd()
dam = 0
if game.condition != "docked":
newcnd()
dam = 0
@@
-5498,40
+5498,40
@@
def status(req):
if game.damage[t]>0:
dam += 1
prstat(_("Condition"), _("%s, %i DAMAGES") % (game.condition.upper(), dam))
if game.damage[t]>0:
dam += 1
prstat(_("Condition"), _("%s, %i DAMAGES") % (game.condition.upper(), dam))
-
el
if not req or req == 3:
+ if not req or req == 3:
prstat(_("Position"), "%s , %s" % (game.quadrant, game.sector))
prstat(_("Position"), "%s , %s" % (game.quadrant, game.sector))
-
el
if not req or req == 4:
+ if not req or req == 4:
if damaged(DLIFSUP):
if game.condition == "docked":
if damaged(DLIFSUP):
if game.condition == "docked":
- s
printf(s, _("DAMAGED, Base provides")
)
+ s
= _("DAMAGED, Base provides"
)
else:
else:
- s
printf(s, _("DAMAGED, reserves=%4.2f") % game.lsupres)
+ s
= _("DAMAGED, reserves=%4.2f") % game.lsupres
else:
else:
- s
printf(s, _("ACTIVE")
)
+ s
= _("ACTIVE"
)
prstat(_("Life Support"), s)
prstat(_("Life Support"), s)
-
el
if not req or req == 5:
- prstat(_("Warp Factor"), "%.1f" %
(game.warpfac)
)
-
el
if not req or req == 6:
+ if not req or req == 5:
+ prstat(_("Warp Factor"), "%.1f" %
game.warpfac
)
+ if not req or req == 6:
extra = ""
if game.icrystl and (game.options & OPTION_SHOWME):
extra = _(" (have crystals)")
extra = ""
if game.icrystl and (game.options & OPTION_SHOWME):
extra = _(" (have crystals)")
- prstat(_("Energy"), "%.2f%s" %
game.energy, extra
)
-
el
if not req or req == 7:
+ prstat(_("Energy"), "%.2f%s" %
(game.energy, extra)
)
+ if not req or req == 7:
prstat(_("Torpedoes"), "%d" % (game.torps))
prstat(_("Torpedoes"), "%d" % (game.torps))
-
el
if not req or req == 8:
+ if not req or req == 8:
if damaged(DSHIELD):
if damaged(DSHIELD):
- s
trcpy(s, _("DAMAGED,")
)
+ s
= _("DAMAGED,"
)
elif game.shldup:
elif game.shldup:
- s
trcpy(s, _("UP,")
)
+ s
= _("UP,"
)
else:
else:
- s
trcpy(s, _("DOWN,")
)
+ s
= _("DOWN,"
)
data = _(" %d%% %.1f units") \
% (int((100.0*game.shield)/game.inshld + 0.5), game.shield)
data = _(" %d%% %.1f units") \
% (int((100.0*game.shield)/game.inshld + 0.5), game.shield)
- prstat(_("Shields"), s)
-
el
if not req or req == 9:
+ prstat(_("Shields"), s
+data
)
+ if not req or req == 9:
prstat(_("Klingons Left"), "%d" \
% (game.state.remkl + game.state.remcom + game.state.nscrem))
prstat(_("Klingons Left"), "%d" \
% (game.state.remkl + game.state.remcom + game.state.nscrem))
-
el
if not req or req == 10:
+ if not req or req == 10:
if game.options & OPTION_WORLDS:
plnet = game.state.galaxy[game.quadrant.x][game.quadrant.y].planet
if plnet != NOPLANET and game.state.planets[plnet].inhabited:
if game.options & OPTION_WORLDS:
plnet = game.state.galaxy[game.quadrant.x][game.quadrant.y].planet
if plnet != NOPLANET and game.state.planets[plnet].inhabited:
@@
-6576,8
+6576,10
@@
def makemoves():
clrscr()
setwnd(message_window)
clrscr()
clrscr()
setwnd(message_window)
clrscr()
- cmd = citem.upper()
- if cmd in commands:
+ candidates = filter(lambda x: x.startswith(citem.upper()),
+ commands)
+ if len(candidates) == 1:
+ cmd = candidates[0]
break
else:
listCommands()
break
else:
listCommands()
@@
-6585,7
+6587,7
@@
def makemoves():
if cmd == "SRSCAN": # srscan
srscan()
elif cmd == "STATUS": # status
if cmd == "SRSCAN": # srscan
srscan()
elif cmd == "STATUS": # status
- status(
0
)
+ status()
elif cmd == "REQUEST": # status request
request()
elif cmd == "LRSCAN": # long range scan
elif cmd == "REQUEST": # status request
request()
elif cmd == "LRSCAN": # long range scan