From 4f44d0bbb692b90d4caa13ce271c0960f7443a22 Mon Sep 17 00:00:00 2001 From: "Paul S. Ferrell" Date: Thu, 8 Oct 2009 11:15:06 -0600 Subject: [PATCH] I hate neale. --- tanks/lib/GameMath.py | 2 +- tanks/lib/Pflanzarr.py | 6 +++--- tanks/run_tanks.py | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tanks/lib/GameMath.py b/tanks/lib/GameMath.py index ff47880..481bf81 100644 --- a/tanks/lib/GameMath.py +++ b/tanks/lib/GameMath.py @@ -48,7 +48,7 @@ def displacePoly(points, disp, limits, coordSequence=False): maxX, maxY = limits basePoints = [] for point in points: - x,y = point[0] + disp[0], point[1] + disp[1] + x,y = int(point[0] + disp[0]), int(point[1] + disp[1]) # Check if duplication is needed on each axis if x > maxX: diff --git a/tanks/lib/Pflanzarr.py b/tanks/lib/Pflanzarr.py index d7d50e0..8b19777 100644 --- a/tanks/lib/Pflanzarr.py +++ b/tanks/lib/Pflanzarr.py @@ -203,16 +203,16 @@ class Pflanzarr: html = ['', 'Game %d results', - '', + '', '', '', '
TeamKillsCause of Death'] for tank in tanks: if tank is winner: rowStyle = 'style="font-weight:bold; '\ - 'background-color:%s"' % tank._color + 'background-color:%s"' % tank.color else: - rowStyle = 'style="background-color:%s"' % tank._color + rowStyle = 'style="background-color:%s"' % tank.color if name: name = xml.sax.saxutils.escape(tank.name) else: diff --git a/tanks/run_tanks.py b/tanks/run_tanks.py index f680bbe..f8950d1 100755 --- a/tanks/run_tanks.py +++ b/tanks/run_tanks.py @@ -1,10 +1,11 @@ #! /usr/bin/python +import asynchat +import asyncore import optparse import shutil +import socket import time -import asyncore -import asynchat from tanks import Pflanzarr T = 60*5 @@ -41,7 +42,7 @@ class Flagger(asynchat.async_chat): self.flag = team -def run_tanks(): +def run_tanks(args, turns): p = Pflanzarr.Pflanzarr(args[0], args[1]) p.run(turns) @@ -84,7 +85,7 @@ def main(): asyncore.loop(60, count=1) now = time.time() if now - lastrun >= 60: - run_tanks() + run_tanks(args, turns) lastrun = now if __name__ == '__main__':