[dasher] Fixes for iPhone release



commit bf62ef3b86ff67f30a83bc83d5695073c09f2efb
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Thu Nov 24 18:36:59 2011 +0000

    Fixes for iPhone release
    
    ControlManager makes labels for new actions when BP_CONTROL_HAS_XXX change
    Fix (uninitialized var) bug in ControlParser not reading system control.xml
    GameModule: #ifdef 'abs' to not include on Mac/iPhone;
                change > to >= as "not decreasing"
    Update iPhone bundle version (from 2.0 to 2.5)

 Src/DasherCore/ControlManager.cpp      |   14 +++++++++++---
 Src/DasherCore/ControlManager.h        |    5 +++--
 Src/DasherCore/GameModule.cpp          |    4 +++-
 Src/DasherCore/NodeCreationManager.cpp |    4 ++--
 Src/iPhone/Info.plist                  |    2 +-
 5 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/Src/DasherCore/ControlManager.cpp b/Src/DasherCore/ControlManager.cpp
index ec8555e..70e18c1 100644
--- a/Src/DasherCore/ControlManager.cpp
+++ b/Src/DasherCore/ControlManager.cpp
@@ -37,7 +37,7 @@ static char THIS_FILE[] = __FILE__;
 #endif
 
 CControlBase::CControlBase(CSettingsUser *pCreateFrom, CDasherInterfaceBase *pInterface, CNodeCreationManager *pNCManager)
-  : CSettingsUser(pCreateFrom), m_pInterface(pInterface), m_pNCManager(pNCManager), m_pRoot(NULL) {
+  : CSettingsUser(pCreateFrom), m_pInterface(pInterface), m_pNCManager(pNCManager), m_pScreen(NULL), m_pRoot(NULL) {
 }
 
 CControlBase::NodeTemplate *CControlBase::GetRootTemplate() {
@@ -67,7 +67,9 @@ CDasherNode *CControlBase::GetRoot(CDasherNode *pContext, int iOffset) {
   return pNewNode;
 }
 
-void CControlBase::MakeLabels(CDasherScreen *pScreen) {
+void CControlBase::ChangeScreen(CDasherScreen *pScreen) {
+  if (m_pScreen==pScreen) return;
+  m_pScreen=pScreen;
   deque<NodeTemplate *> templateQueue(1,m_pRoot);
   set<NodeTemplate *> allTemplates(templateQueue.begin(),templateQueue.end());
   while (!templateQueue.empty()) {
@@ -155,7 +157,7 @@ public:
   vector<CControlBase::Action*> actions;
 };
 
-CControlParser::CControlParser(CMessageDisplay *pMsgs) : AbstractXMLParser(pMsgs) {
+CControlParser::CControlParser(CMessageDisplay *pMsgs) : AbstractXMLParser(pMsgs), m_bUser(false) {
 }
 
 bool CControlParser::ParseFile(const string &strFileName, bool bUser) {
@@ -409,4 +411,10 @@ void CControlManager::updateActions() {
 
   //copy anything else (custom) that might have been added...
   while (it != vOldRootSuccessors.end()) vRootSuccessors.push_back(*it++);
+  
+  if (CDasherScreen *pScreen = m_pScreen) {
+    //hack to make ChangeScreen do something
+    m_pScreen = NULL; //i.e. make it think the screen has changed
+    ChangeScreen(pScreen);
+  }
 }
diff --git a/Src/DasherCore/ControlManager.h b/Src/DasherCore/ControlManager.h
index 4743bcf..edab73a 100644
--- a/Src/DasherCore/ControlManager.h
+++ b/Src/DasherCore/ControlManager.h
@@ -120,7 +120,7 @@ namespace Dasher {
     CControlBase(CSettingsUser *pCreateFrom, CDasherInterfaceBase *pInterface, CNodeCreationManager *pNCManager);
 
     ///Make this manager ready to make nodes renderable on the screen by preallocating labels
-    virtual void MakeLabels(CDasherScreen *pScreen);
+    virtual void ChangeScreen(CDasherScreen *pScreen);
     
     ///
     /// Get a new root node owned by this manager
@@ -138,7 +138,8 @@ namespace Dasher {
     CNodeCreationManager *m_pNCManager;
     
     int getColour(NodeTemplate *pTemplate, CDasherNode *pParent);
-
+    CDasherScreen *m_pScreen;
+    
   private:
     NodeTemplate *m_pRoot;
   };
diff --git a/Src/DasherCore/GameModule.cpp b/Src/DasherCore/GameModule.cpp
index 2093eb8..b82eef7 100644
--- a/Src/DasherCore/GameModule.cpp
+++ b/Src/DasherCore/GameModule.cpp
@@ -113,7 +113,9 @@ void CGameModule::StartWriting(unsigned long lTime) {
   }
 }
 
+#if !defined(TARGET_OS_MAC) && !defined(TARGET_OS_IPHONE)
 static myint abs(myint x) { return (x>0)?x:-x; }
+#endif
 
 void CGameModule::DecorateView(unsigned long lTime, CDasherView *pView, CDasherModel *pModel) {
 
@@ -124,7 +126,7 @@ void CGameModule::DecorateView(unsigned long lTime, CDasherView *pView, CDasherM
   m_vTargetY.push_back(iNewTarget);
   bool bDrawHelper=false;
   
-  if (abs(iNewTarget - CDasherModel::ORIGIN_Y) >
+  if (abs(iNewTarget - CDasherModel::ORIGIN_Y) >=
       max(myint(GetLongParameter(LP_GAME_HELP_DIST)),abs(m_iTargetY-CDasherModel::ORIGIN_Y))) {
     //needs help - offscreen and not decreasing
     if (m_uHelpStart==std::numeric_limits<unsigned long>::max())
diff --git a/Src/DasherCore/NodeCreationManager.cpp b/Src/DasherCore/NodeCreationManager.cpp
index ee6ef6e..5f5b82a 100644
--- a/Src/DasherCore/NodeCreationManager.cpp
+++ b/Src/DasherCore/NodeCreationManager.cpp
@@ -128,7 +128,7 @@ void CNodeCreationManager::ChangeScreen(CDasherScreen *pScreen) {
   if (m_pScreen == pScreen) return;
   m_pScreen = pScreen;
   m_pAlphabetManager->MakeLabels(pScreen);
-  if (m_pControlManager) m_pControlManager->MakeLabels(pScreen);
+  if (m_pControlManager) m_pControlManager->ChangeScreen(pScreen);
 }
 
 void CNodeCreationManager::HandleEvent(int iParameter) {
@@ -141,7 +141,7 @@ void CNodeCreationManager::updateControl() {
   //don't allow a control manager during Game Mode 
   if (GetBoolParameter(BP_CONTROL_MODE) && !m_pInterface->GetGameModule()) {
     m_pControlManager = new CControlManager(this, this, m_pInterface);
-    if (m_pScreen) m_pControlManager->MakeLabels(m_pScreen);
+    if (m_pScreen) m_pControlManager->ChangeScreen(m_pScreen);
     iControlSpace = CDasherModel::NORMALIZATION / 20;
   } else {
     m_pControlManager = NULL;
diff --git a/Src/iPhone/Info.plist b/Src/iPhone/Info.plist
index 6729c85..f887ccc 100644
--- a/Src/iPhone/Info.plist
+++ b/Src/iPhone/Info.plist
@@ -21,7 +21,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>2.0</string>
+	<string>2.5</string>
 	<key>LSRequiresIPhoneOS</key>
 	<true/>
 	<key>NSMainNibFile</key>



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