Changeset 7221 in orxonox.OLD for trunk/src/lib/coord
- Timestamp:
- Mar 15, 2006, 3:10:45 PM (19 years ago)
- Location:
- trunk/src/lib/coord
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.cc
r7193 r7221 540 540 * @param childName the name of the child to add to this PNode 541 541 */ 542 void PNode::addChild (const char*childName)542 void PNode::addChild (const std::string& childName) 543 543 { 544 544 PNode* childNode = dynamic_cast<PNode*>(ClassList::getObject(childName, CL_PARENT_NODE)); … … 624 624 * @param parentName the name of the Parent to set to this PNode 625 625 */ 626 void PNode::setParent (const char*parentName)626 void PNode::setParent (const std::string& parentName) 627 627 { 628 628 PNode* parentNode = dynamic_cast<PNode*>(ClassList::getObject(parentName, CL_PARENT_NODE)); … … 631 631 else 632 632 PRINTF(2)("Not Found PNode's (%s::%s) new Parent by Name: %s\n", 633 this->getClassName(), this->getName(), parentName);633 this->getClassName(), this->getName(), parentName.c_str()); 634 634 } 635 635 … … 680 680 * @param bias the speed to iterate to this new Positions 681 681 */ 682 void PNode::setParentSoft(const char*parentName, float bias)682 void PNode::setParentSoft(const std::string& parentName, float bias) 683 683 { 684 684 PNode* parentNode = dynamic_cast<PNode*>(ClassList::getObject(parentName, CL_PARENT_NODE)); … … 699 699 * @param parentMode a String representing this parentingMode 700 700 */ 701 void PNode::setParentMode (const char*parentingMode)702 { 703 this->setParentMode(PNode:: charToParentingMode(parentingMode));701 void PNode::setParentMode (const std::string& parentingMode) 702 { 703 this->setParentMode(PNode::stringToParentingMode(parentingMode)); 704 704 } 705 705 … … 927 927 this->getAbsDirV().y, 928 928 this->getAbsDirV().z, 929 this->parentingModeTo Char(parentMode),929 this->parentingModeToString(parentMode), 930 930 childNodeCount); 931 931 if (depth >= 2 || depth == 0) … … 1049 1049 * @return the converted string 1050 1050 */ 1051 const char* PNode::parentingModeTo Char(int parentingMode)1051 const char* PNode::parentingModeToString(int parentingMode) 1052 1052 { 1053 1053 if (parentingMode == PNODE_LOCAL_ROTATE) … … 1068 1068 * @return the int corresponding to the named parentingMode 1069 1069 */ 1070 PARENT_MODE PNode:: charToParentingMode(const char*parentingMode)1071 { 1072 if ( !strcmp(parentingMode, "local-rotate"))1070 PARENT_MODE PNode::stringToParentingMode(const std::string& parentingMode) 1071 { 1072 if (parentingMode == "local-rotate") 1073 1073 return (PNODE_LOCAL_ROTATE); 1074 else if ( !strcmp(parentingMode, "rotate-movement"))1074 else if (parentingMode == "rotate-movement") 1075 1075 return (PNODE_ROTATE_MOVEMENT); 1076 else if ( !strcmp(parentingMode, "movement"))1076 else if (parentingMode == "movement") 1077 1077 return (PNODE_MOVEMENT); 1078 else if ( !strcmp(parentingMode, "all"))1078 else if (parentingMode == "all") 1079 1079 return (PNODE_ALL); 1080 else if ( !strcmp(parentingMode, "rotate-and-move"))1080 else if (parentingMode == "rotate-and-move") 1081 1081 return (PNODE_ROTATE_AND_MOVE); 1082 1082 } -
trunk/src/lib/coord/p_node.h
r7076 r7221 143 143 // PARENTING // 144 144 void addChild (PNode* child); 145 void addChild (const char*childName);145 void addChild (const std::string& childName); 146 146 void removeChild (PNode* child); 147 147 void removeNode(); … … 151 151 /** @param parent the new parent of this node */ 152 152 inline void setParent (PNode* parent) { parent->addChild(this); }; 153 void setParent (const char*parentName);153 void setParent (const std::string& parentName); 154 154 /** @returns the parent of this PNode */ 155 155 inline PNode* getParent () const { return this->parent; }; … … 158 158 159 159 void setParentSoft(PNode* parentNode, float bias = 1.0); 160 void setParentSoft(const char*parentName, float bias = 1.0);160 void setParentSoft(const std::string& parentName, float bias = 1.0); 161 161 162 162 // PARENTING_MODE AND OTHER FLAGS // 163 163 void setParentMode (PARENT_MODE parentMode); 164 void setParentMode (const char*parentingMode);164 void setParentMode (const std::string& parentingMode); 165 165 /** @returns the Parenting mode of this node */ 166 166 int getParentMode() const { return 0x000f & this->parentMode; }; … … 183 183 184 184 // HELPER_FUNCTIONS // 185 static const char* parentingModeTo Char(int parentingMode);186 static PARENT_MODE charToParentingMode(const char*parentingMode);185 static const char* parentingModeToString(int parentingMode); 186 static PARENT_MODE stringToParentingMode(const std::string& parentingMode); 187 187 float distance(const PNode* node) const { return (this->getAbsCoor() - node->getAbsCoor()).len(); }; 188 188
Note: See TracChangeset
for help on using the changeset viewer.