[dasher] Windows build fix: unroll iterator loops



commit dda53656cded206cff8f442099a4eba4071adefb
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Fri Feb 1 18:17:22 2013 +0000

    Windows build fix: unroll iterator loops
    
    VS2010 gets confused by the iterator games played to run through
    the two lists of messages, modal and non-modal, in the same loop.

 Src/DasherCore/DashIntfScreenMsgs.cpp |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/Src/DasherCore/DashIntfScreenMsgs.cpp b/Src/DasherCore/DashIntfScreenMsgs.cpp
index c5a5482..19653a5 100644
--- a/Src/DasherCore/DashIntfScreenMsgs.cpp
+++ b/Src/DasherCore/DashIntfScreenMsgs.cpp
@@ -56,9 +56,17 @@ bool CDashIntfScreenMsgs::FinishRender(unsigned long ulTime) {
     }
     //Now render messages proceeding downwards - non-modal first, then oldest first
     bool bModal(false);
-    for (deque<pair<CDasherScreen::Label*, unsigned long> >::iterator it = m_dqAsyncMessages.begin(); ; it++) {
-      if (it==m_dqAsyncMessages.end()) {it=m_dqModalMessages.begin(); bModal=true;}
-      if (it==m_dqModalMessages.end()) break;
+    for (deque<pair<CDasherScreen::Label*, unsigned long> >::const_iterator it = m_dqAsyncMessages.begin(); it != m_dqAsyncMessages.end(); it++) {
+      if (it->second==0) continue;
+      pair<screenint,screenint> textDims = pScreen->TextSize(it->first, GetLongParameter(LP_MESSAGE_FONTSIZE));
+      //black (5) rectangle:
+      pScreen->DrawRectangle((iSW - textDims.first)/2, iY, (iSW+textDims.first)/2, iY+textDims.second, 5, -1, -1);
+      //white (0) text for non-modal, yellow (111) for modal
+      pScreen->DrawString(it->first, (iSW-textDims.first)/2, iY, GetLongParameter(LP_MESSAGE_FONTSIZE), bModal ? 111 : 0);
+      iY+=textDims.second;
+    }
+    bModal=true;
+    for (deque<pair<CDasherScreen::Label*, unsigned long> >::const_iterator it = m_dqModalMessages.begin(); it != m_dqModalMessages.end(); it++) {
       if (it->second==0) continue;
       pair<screenint,screenint> textDims = pScreen->TextSize(it->first, GetLongParameter(LP_MESSAGE_FONTSIZE));
       //black (5) rectangle:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]