[dasher: 25/43] Only use Auto-speed-control if LP_BOOSTFACTOR is 100



commit 3f770499ad0e3e29bd42652e16107aa0c26e7a5e
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Wed Apr 27 17:29:40 2011 +0100

    Only use Auto-speed-control if LP_BOOSTFACTOR is 100
    
    Rather than temporarily disabling it from ControlManager. (This old way would
    e.g. have left ASC permanently off if the user quit within a control node,
    whereas LP_BOOSTFACTOR is non-persistent.)
    
    TODO would be good to avoid using ASC during slow-startup, too...

 Src/DasherCore/ControlManager.cpp |   11 +----------
 Src/DasherCore/ControlManager.h   |    5 -----
 Src/DasherCore/DefaultFilter.cpp  |    3 ++-
 3 files changed, 3 insertions(+), 16 deletions(-)
---
diff --git a/Src/DasherCore/ControlManager.cpp b/Src/DasherCore/ControlManager.cpp
index f8c6d67..7fd77b1 100644
--- a/Src/DasherCore/ControlManager.cpp
+++ b/Src/DasherCore/ControlManager.cpp
@@ -126,23 +126,14 @@ void CControlBase::CContNode::Output() {
 }
 
 void CControlBase::CContNode::Enter() {
-  // Slow down to half the speed we were at
+  // Slow down to half the speed we were at. This also disables auto-speed-control.
   m_pMgr->m_pNCManager->SetLongParameter(LP_BOOSTFACTOR, 50);
-  //Disable auto speed control!
-  m_pMgr->bDisabledSpeedControl = m_pMgr->m_pNCManager->GetBoolParameter(BP_AUTO_SPEEDCONTROL);
-  m_pMgr->m_pNCManager->SetBoolParameter(BP_AUTO_SPEEDCONTROL, 0);
 }
 
 
 void CControlBase::CContNode::Leave() {
   // Now speed back up, by doubling the speed we were at in control mode
   m_pMgr->m_pNCManager->SetLongParameter(LP_BOOSTFACTOR, 100);
-  //Re-enable auto speed control!
-  if (m_pMgr->bDisabledSpeedControl)
-  {
-    m_pMgr->bDisabledSpeedControl = false;
-    m_pMgr->m_pNCManager->SetBoolParameter(BP_AUTO_SPEEDCONTROL, 1);
-  }
 }
 
 const vector<CControlBase::NodeTemplate *> &CControlParser::parsedNodes() {
diff --git a/Src/DasherCore/ControlManager.h b/Src/DasherCore/ControlManager.h
index 222342a..3cf0676 100644
--- a/Src/DasherCore/ControlManager.h
+++ b/Src/DasherCore/ControlManager.h
@@ -134,11 +134,6 @@ namespace Dasher {
 
   private:
     NodeTemplate *m_pRoot;
-
-    ///Whether we'd temporarily disabled Automatic Speed Control
-    ///(if _and only if_ so, should re-enable it when leaving a node)
-    bool bDisabledSpeedControl;
-
   };
 
   ///Class reads node tree definitions from an XML file, linking together the NodeTemplates
diff --git a/Src/DasherCore/DefaultFilter.cpp b/Src/DasherCore/DefaultFilter.cpp
index 6924f92..ee91339 100644
--- a/Src/DasherCore/DefaultFilter.cpp
+++ b/Src/DasherCore/DefaultFilter.cpp
@@ -130,7 +130,8 @@ bool CDefaultFilter::Timer(unsigned long Time, CDasherView *pView, CDasherInput
     m_pDasherModel->OneStepTowards(m_iLastX,m_iLastY, Time);
     bDidSomething = true;
 
-    m_pAutoSpeedControl->SpeedControl(m_iLastX, m_iLastY, pView);
+    if (GetLongParameter(LP_BOOSTFACTOR)==100)
+      m_pAutoSpeedControl->SpeedControl(m_iLastX, m_iLastY, pView);
   }
 
   if(m_pStartHandler)



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