[dasher] AlphabetManager.cpp: Move node creation outside of if statement.



commit 13dbe24935c171ef43e9a3e6e43fcbd56b86c82f
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Sat Aug 22 14:10:35 2009 +0100

    AlphabetManager.cpp: Move node creation outside of if statement.

 ChangeLog                          |    1 +
 Src/DasherCore/AlphabetManager.cpp |   20 ++++++++------------
 2 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ee63085..636f6a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
 	* Move iOffset field into DasherNode (now m_iOffset).
 	* Remove SControlData structure and use its single member directly.
+	* AlphabetManager.cpp: Move node creation outside of if statement.
 
 2009-08-21  Alan Lawrence <acl33 inf phy cam ac uk>
 
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index 8170b82..069bfee 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -415,20 +415,20 @@ CDasherNode *CAlphabetManager::RebuildParent(CDasherNode *pNode) {
     // symbol (eg because it was generated from a different alphabet)
     return NULL;
   }
-  else if(iOffset == 0) {
+
+  CDasherNode::SDisplayInfo *pDisplayInfo = new CDasherNode::SDisplayInfo;
+  pDisplayInfo->bShove = true;
+  pDisplayInfo->bVisible = true;
+  
+  if(iOffset == 0) {
     // TODO: Creating a root node, Shouldn't be a special case
     iNewPhase = 0;
     iNewSymbol = 0;
     strContext = m_pNCManager->GetAlphabet()->GetDefaultContext();
     BuildContext(strContext, true, iContext, iNewSymbol);
 
-    CDasherNode::SDisplayInfo *pDisplayInfo = new CDasherNode::SDisplayInfo;
     pDisplayInfo->iColour = 7; // TODO: Hard coded value
-    pDisplayInfo->bShove = true;
-    pDisplayInfo->bVisible = true;
     pDisplayInfo->strDisplayText = "";
-
-    pNewNode = new CDasherNode(NULL, 0, 0, pDisplayInfo);
   }
   else {
     int iMaxContextLength = m_pLanguageModel->GetContextLength() + 1;
@@ -445,16 +445,12 @@ CDasherNode *CAlphabetManager::RebuildParent(CDasherNode *pNode) {
 
     int iColour(m_pNCManager->GetColour(iNewSymbol, iNewPhase));
 
-    CDasherNode::SDisplayInfo *pDisplayInfo = new CDasherNode::SDisplayInfo;
     pDisplayInfo->iColour = iColour;
-    pDisplayInfo->bShove = true;
-    pDisplayInfo->bVisible = true;
     pDisplayInfo->strDisplayText = m_pNCManager->GetAlphabet()->GetDisplayText(iNewSymbol);
-
-    // TODO: Node creation outside of if statement
-    pNewNode = new CDasherNode(NULL, 0, 0, pDisplayInfo);
   }
 
+  pNewNode = new CDasherNode(NULL, 0, 0, pDisplayInfo);
+  
   // TODO: Some of this context stuff could be consolidated
 
   pNewNode->m_pNodeManager = this;



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