3 method ;) of predicting colors
authordisplacer
Fri, 02 Feb 2007 21:04:36 +0000
changeset 378 dde4a4a3e0e1
parent 377 d9b88dbdf5a9
child 379 e4cd3cd209c6
3 method ;) of predicting colors
QTfrontend/teamselhelper.cpp
--- a/QTfrontend/teamselhelper.cpp	Thu Feb 01 21:42:11 2007 +0000
+++ b/QTfrontend/teamselhelper.cpp	Fri Feb 02 21:04:36 2007 +0000
@@ -118,7 +118,16 @@
     if(++pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) {
       pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin();
     }
-    color=QColor(*pOurFrameTeams->currentColor);
+    color=*pOurFrameTeams->currentColor;
+  } else {
+    // set according color iterator
+    pOurFrameTeams->currentColor=std::find(pOurFrameTeams->availableColors.begin(), 
+					   pOurFrameTeams->availableColors.end(), color);
+    if(pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) {
+      // error condition
+      throw;
+      pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin();
+    }
   }
 
   QPalette newPalette = palette();