slotUI/slotCli.py

changeset 120
049478896193
parent 118
9d5456cf6dad
child 121
6ea0dff10e78
--- a/slotUI/slotCli.py	Sat Dec 15 16:16:18 2012 +0100
+++ b/slotUI/slotCli.py	Sat Dec 15 16:32:08 2012 +0100
@@ -150,7 +150,7 @@
         for tst in order2:
             self.slot[tst["car"]]["position"] = idx
             # check if first position changed
-            if self.firstpos != tst["car"]:
+            if (self.firstpos != tst["car"]) and (idx == 1):
                 self.firstpos = tst["car"]
                 trigger_event("first_position", tst["car"] + 1)
             idx += 1
@@ -495,7 +495,8 @@
                         if (self.slot[slot]["best"] > t) or (self.slot[slot]["best"] == 0):
                             self.slot[slot]["best"] = t
                         if self.bestlap > t:
-                            trigger_event("lap_record", slot + 1)
+                            if self.freerun:
+                                trigger_event("lap_record", slot + 1)
                             self.bestlap = t
 
                         self.slot[slot]["status"] = "IN-RACE"
@@ -608,15 +609,21 @@
                         for slot in self.slots:
                             if slot["position"] == 1:
                                 slot["status"] = "WINNER!"
-                	self.render_slots()
+                        self.render_slots()
                     self.sysclk_last = self.sysclk
-    
+
 
 
                     self.scr.addstr(17,31,
                         "Race Timer: %7.3f min" % (self.sysclk / 60),
                         curses.color_pair(2))
 
+                    tmpmode = "RACE MODE (LAPS)"
+                    if self.freerun:
+                        tmpmode = "FREERUN (BEST)"
+                    self.scr.addstr(18,31,
+                        "%19s" % tmpmode, curses.color_pair(2))
+
                     self.scr.refresh()
 
                 except Exception:

mercurial