Mercurial > atc
changeset 17:51bb49991e0c
Added SQUAWK command and squawk number
committer: Jeff Sipek <jeffpc@jeff.(none)> 1120876082 -0400
author | Jeff Sipek <jeffpc@jeff.(none)> |
---|---|
date | Sat, 09 Jul 2005 02:28:02 -0400 |
parents | c28ae64fcb6e |
children | aa0391c55f93 |
files | atc_colors.py atc_plane.py |
diffstat | 2 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/atc_colors.py Sat Jul 09 02:02:31 2005 -0400 +++ b/atc_colors.py Sat Jul 09 02:28:02 2005 -0400 @@ -32,5 +32,6 @@ white = 255, 255, 255 planeinfo_ok = green1 -planeinfo_crashed = red +planeinfo_crashed = brown +planeinfo_emergency = red background = black
--- a/atc_plane.py Sat Jul 09 02:02:31 2005 -0400 +++ b/atc_plane.py Sat Jul 09 02:28:02 2005 -0400 @@ -53,7 +53,7 @@ class Plane(pygame.sprite.Sprite): """ Class to manage one plane's motion """ - def __init__(self,callsign,flightno,pos=(0.0, 0.0, 0.0),vel=(0.0, 0.0, 0.0)): + def __init__(self,callsign,flightno,squawk="1200",pos=(0.0, 0.0, 0.0),vel=(0.0, 0.0, 0.0)): """ Set up everything """ pygame.sprite.Sprite.__init__(self) @@ -70,6 +70,9 @@ # flight number self.flightno = flightno + # squawk code (shoud be octal number digits 0-7 only) + self.squawk = squawk + # position (X, Y, Z) self.pos = { \ "X":pos[0], \ @@ -203,6 +206,9 @@ print "Changing heading to " + str(self.vel["heading"]) self.complete_vel(hac=1) + + if (parts[0] == "SQUAWK"): + self.squawk = parts[1] def display(self,screen): """ Put everything onto the screen """ @@ -216,6 +222,12 @@ if (self.status == plane_CRASHED) or (self.status == plane_DEAD): color = atc_colors.planeinfo_crashed + if (self.squawk == "7700") or \ + (self.squawk == "7600") or \ + (self.squawk == "7500") or \ + (self.squawk == "0000"): + color = atc_colors.planeinfo_emergency + x = int(1024/2+m2pix(self.pos["X"])) + 10 y = int(768/2-m2pix(self.pos["Y"])) - 5