Changeset 6695 in orxonox.OLD for trunk/src/lib/coord
- Timestamp:
- Jan 25, 2006, 2:39:53 PM (19 years ago)
- Location:
- trunk/src/lib/coord
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.cc
r6634 r6695 42 42 */ 43 43 PNode::PNode (PNode* parent, long nodeFlags) 44 : Synchronizeable(), BaseObject() 44 45 { 45 46 this->setClassID(CL_PARENT_NODE, "PNode"); … … 487 488 this->children.push_back(child); 488 489 child->parentCoorChanged(); 490 491 // if(this->getUniqueID() == NET_UID_UNASSIGNED) 492 // { 493 // PRINTF(1)("Adding to an UNASSIGNED PNode - looking for next assigned Node\n"); 494 // PNode* node = this->seekNextAssignedPNode(this); 495 // if( node == NULL) 496 // PRINTF(1)(" Got NULL - Is this the NULLParent - uid %i\n", this->getUniqueID()); 497 // else 498 // PRINTF(1)(" Found next assigned node: %i\n", node->getUniqueID()); 499 // } 489 500 } 490 501 else … … 495 506 child->parentCoorChanged(); 496 507 } 508 } 509 510 511 PNode* PNode::seekNextAssignedPNode(PNode* node) const 512 { 513 PNode* tmpNode = node->parent; 514 printf("entering seek PNode loop for name: %s, uid: %i\n", node->getName(), node->getUniqueID()); 515 if(tmpNode) 516 printf(" @node name: %s, uid: %d\n", tmpNode->getName(), tmpNode->getUniqueID()); 517 while( tmpNode != NULL && tmpNode->getUniqueID() == NET_UID_UNASSIGNED) 518 { 519 printf(" @node name: %s, uid: %d\n", tmpNode->getName(), tmpNode->getUniqueID()); 520 tmpNode = tmpNode->parent; 521 } 522 printf("leaving PNode loop\n\n"); 523 524 return tmpNode; 497 525 } 498 526 … … 695 723 { 696 724 PNode::nullParent = new PNode(NULL, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_TO_NULL); 725 PNode::nullParent->setClassID(CL_NULL_PARENT, "NullParent"); 697 726 PNode::nullParent->setName("NullParent"); 727 PNode::nullParent->setSynchronized(true); 698 728 } 699 729 return PNode::nullParent; … … 1049 1079 SYNCHELP_READ_FKT( BaseObject::writeState ); 1050 1080 1051 char * parentName = NULL;1052 SYNCHELP_READ_STRINGM( parentName );1053 1054 if ( strcmp(parentName, "")==0 )1055 {1056 setParent( (char*)NULL );1057 }1058 else1059 {1060 setParent( parentName );1061 }1062 1063 delete[] parentName;1081 // char * parentName = NULL; 1082 // SYNCHELP_READ_STRINGM( parentName ); 1083 // 1084 // if ( strcmp(parentName, "")==0 ) 1085 // { 1086 // setParent( (char*)NULL ); 1087 // } 1088 // else 1089 // { 1090 // setParent( parentName ); 1091 // } 1092 // 1093 // delete[] parentName; 1064 1094 1065 1095 int parentMode; … … 1081 1111 this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) ); 1082 1112 1083 int n;1084 char * childName;1085 1086 PRINTF(0)("JKLO %d %d %d %d\n", data[__synchelp_read_i], data[__synchelp_read_i+1], data[__synchelp_read_i+2], data[__synchelp_read_i+3]);1087 SYNCHELP_READ_INT( n );1088 PRINTF(0)("read %s:n=%d\n", this->getName(), n);1089 1090 for (int i = 0; i<n; i++)1091 {1092 SYNCHELP_READ_STRINGM( childName );1093 PRINTF(0)("RCVD CHILD = %s\n", childName);1094 addChild( childName );1095 delete childName;1096 childName = NULL;1097 }1113 // int n; 1114 // char * childName; 1115 // 1116 // PRINTF(0)("JKLO %d %d %d %d\n", data[__synchelp_read_i], data[__synchelp_read_i+1], data[__synchelp_read_i+2], data[__synchelp_read_i+3]); 1117 // SYNCHELP_READ_INT( n ); 1118 // PRINTF(0)("read %s:n=%d\n", this->getName(), n); 1119 // 1120 // for (int i = 0; i<n; i++) 1121 // { 1122 // SYNCHELP_READ_STRINGM( childName ); 1123 // PRINTF(0)("RCVD CHILD = %s\n", childName); 1124 // addChild( childName ); 1125 // delete childName; 1126 // childName = NULL; 1127 // } 1098 1128 1099 1129 return SYNCHELP_READ_N; … … 1112 1142 SYNCHELP_WRITE_FKT( BaseObject::readState ); 1113 1143 1114 if ( this->parent )1115 {1116 SYNCHELP_WRITE_STRING( parent->getName() );1117 }1118 else1119 {1120 SYNCHELP_WRITE_STRING( "" );1121 }1144 // if ( this->parent ) 1145 // { 1146 // SYNCHELP_WRITE_STRING( parent->getName() ); 1147 // } 1148 // else 1149 // { 1150 // SYNCHELP_WRITE_STRING( "" ); 1151 // } 1122 1152 1123 1153 SYNCHELP_WRITE_INT( this->parentMode ); … … 1132 1162 SYNCHELP_WRITE_FLOAT( this->relDirection.v.z ); 1133 1163 1134 int n = children.size();1135 1136 //check if camera is in children 1137 for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++) 1138 { 1139 if ( (*it)->isA(CL_CAMERA) ) 1140 n--; 1141 } 1142 PRINTF(0)("write %s:n=%d\n", this->getName(), n);1143 SYNCHELP_WRITE_INT( n);1144 PRINTF(0)("ASDF %d %d %d %d\n", data[__synchelp_write_i-4], data[__synchelp_write_i-3], data[__synchelp_write_i-2], data[__synchelp_write_i-1]); 1145 1146 for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)1147 {1148 //dont add camera because there is only one camera attached to local player1149 if ( !(*it)->isA(CL_CAMERA) )1150 {1151 PRINTF(0)("SENDING CHILD: %s\n", (*it)->getName());1152 SYNCHELP_WRITE_STRING( (*it)->getName() );1153 }1154 }1164 // int n = children.size(); 1165 // //check if camera is in children 1166 // for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++) 1167 // { 1168 // if ( (*it)->isA(CL_CAMERA) ) 1169 // n--; 1170 // } 1171 // PRINTF(0)("write %s:n=%d\n", this->getName(), n); 1172 // SYNCHELP_WRITE_INT( n ); 1173 // PRINTF(0)("ASDF %d %d %d %d\n", data[__synchelp_write_i-4], data[__synchelp_write_i-3], data[__synchelp_write_i-2], data[__synchelp_write_i-1]); 1174 // 1175 // 1176 // for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++) 1177 // { 1178 // //dont add camera because there is only one camera attached to local player 1179 // if ( !(*it)->isA(CL_CAMERA) ) 1180 // { 1181 // PRINTF(0)("SENDING CHILD: %s\n", (*it)->getName()); 1182 // SYNCHELP_WRITE_STRING( (*it)->getName() ); 1183 // } 1184 // } 1155 1185 1156 1186 return SYNCHELP_WRITE_N; -
trunk/src/lib/coord/p_node.h
r6634 r6695 147 147 void removeNode(); 148 148 149 PNode* seekNextAssignedPNode(PNode* node) const; 150 149 151 /** @param parent the new parent of this node */ 150 152 inline void setParent (PNode* parent) { parent->addChild(this); };
Note: See TracChangeset
for help on using the changeset viewer.