Fixed type error, made results rows keyed by color.

This commit is contained in:
Paul S. Ferrell 2009-10-08 09:12:41 -06:00
parent 8e8bad1e3c
commit 30e18ea544
2 changed files with 13 additions and 8 deletions

View File

@ -205,12 +205,17 @@ class Pflanzarr:
'<table><tr><th>Team<th>Kills<th>Cause of Death'] '<table><tr><th>Team<th>Kills<th>Cause of Death']
for tank in tanks: for tank in tanks:
if tank is winner: if tank is winner:
rowStyle = 'style="color:red;"' rowStyle = 'style="font-weight:bold; '\
'background-color:%s"' % tank._color
else: else:
rowStyle = '' rowStyle = 'style="background-color:%s"' % tank._color
if name:
name = xml.sax.saxutils.escape(tank.name)
else:
name = '#default'
html.append('<tr %s><td>%s<td>%d<td>%s' % html.append('<tr %s><td>%s<td>%d<td>%s' %
(rowStyle, (rowStyle,
xml.sax.saxutils.escape(tank.name), name,
len(kills[tank]), len(kills[tank]),
xml.sax.saxutils.escape(tank.deathReason))) xml.sax.saxutils.escape(tank.deathReason)))

View File

@ -75,7 +75,7 @@ class Tank(object):
else: else:
self._tAngle = tAngle self._tAngle = tAngle
self._color = color self.color = color
# You can't fire until fireReady is 0. # You can't fire until fireReady is 0.
self._fireReady = self.FIRE_RATE self._fireReady = self.FIRE_RATE
@ -466,7 +466,7 @@ class Tank(object):
# The base body rectangle. # The base body rectangle.
for poly in gm.displacePoly(hood, self.pos, self._limits): for poly in gm.displacePoly(hood, self.pos, self._limits):
d.polygon( poly, fill=self._color ) d.polygon( poly, fill=self.color )
# The treads # The treads
for poly in gm.displacePoly(tread1, self.pos, self._limits) + \ for poly in gm.displacePoly(tread1, self.pos, self._limits) + \
@ -475,7 +475,7 @@ class Tank(object):
# The turret circle # The turret circle
for poly in gm.displacePoly(self.body, self.pos, self._limits): for poly in gm.displacePoly(self.body, self.pos, self._limits):
d.ellipse( poly, fill=self._color, outline='black') d.ellipse( poly, fill=self.color, outline='black')
self._drawLaser(d) self._drawLaser(d)
@ -491,7 +491,7 @@ class Tank(object):
if self._fired: if self._fired:
laser = gm.rotatePoly( self.laser, self._angle + self._tAngle ) laser = gm.rotatePoly( self.laser, self._angle + self._tAngle )
for poly in gm.displacePoly(laser, self.pos, self._limits): for poly in gm.displacePoly(laser, self.pos, self._limits):
drawing.polygon(poly, fill=self._color) drawing.polygon(poly, fill=self.color)
self._fired = False self._fired = False
@ -522,7 +522,7 @@ class Tank(object):
if self._sensorState[i]: if self._sensorState[i]:
color = '#000000' color = '#000000'
else: else:
color = self._color color = self.color
r, angle, width, tAttached = self._sensors[i] r, angle, width, tAttached = self._sensors[i]
r = int(r) r = int(r)