Changeset 7163 for code/trunk/src/orxonox/Level.cc
- Timestamp:
- Aug 11, 2010, 8:55:13 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/Level.cc
r6746 r7163 49 49 RegisterObject(Level); 50 50 51 51 52 this->registerVariables(); 52 53 this->xmlfilename_ = this->getFilename(); … … 73 74 XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype"); 74 75 76 XMLPortObject(Level, MeshLodInformation, "lodinformation", addLodInfo, getLodInfo, xmlelement, mode); 75 77 XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false); 76 78 } 77 79 78 80 void Level::registerVariables() 79 81 { 80 registerVariable(this->xmlfilename_, VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::networkcallback_applyXMLFile)); 81 registerVariable(this->name_, VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::changedName)); 82 registerVariable(this->description_, VariableDirection::ToClient); 82 registerVariable(this->xmlfilename_, VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::networkcallback_applyXMLFile)); 83 registerVariable(this->name_, VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::changedName)); 84 registerVariable(this->description_, VariableDirection::ToClient); 85 registerVariable(this->networkTemplateNames_, VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::networkCallbackTemplatesChanged)); 83 86 } 84 87 … … 95 98 96 99 Loader::open(this->xmlfile_); 100 } 101 102 void Level::networkCallbackTemplatesChanged() 103 { 104 for( std::set<std::string>::iterator it = this->networkTemplateNames_.begin(); it!=this->networkTemplateNames_.end(); ++it ) 105 { 106 assert(Template::getTemplate(*it)); 107 Template::getTemplate(*it)->applyOn(this); 108 } 97 109 } 98 110 … … 125 137 this->objects_.push_back(object); 126 138 object->setGametype(this->getGametype()); 139 object->setLevel(this); 127 140 } 128 141 … … 136 149 ++i; 137 150 } 151 return 0; 152 } 153 154 void Level::addLodInfo(MeshLodInformation* lodInformation) 155 { 156 std::string meshName = lodInformation->getMeshName(); 157 // this->lodInformation_.insert(std::make_pair(meshName,lodInformation)); 158 if( this->lodInformation_.find(meshName) != this->lodInformation_.end()) 159 CCOUT(4) << "replacing lod information for " << meshName << endl; 160 this->lodInformation_[meshName] = lodInformation; 161 } 162 163 MeshLodInformation* Level::getLodInfo(std::string meshName) const 164 { 165 if(this->lodInformation_.find(meshName)!=this->lodInformation_.end()) 166 return this->lodInformation_.find(meshName)->second; 167 138 168 return 0; 139 169 }
Note: See TracChangeset
for help on using the changeset viewer.