Changeset 4253 in orxonox.OLD for orxonox/branches/levelLoader/src/story_entities/world.cc
- Timestamp:
- May 21, 2005, 11:58:49 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelLoader/src/story_entities/world.cc
r4248 r4253 121 121 CREATE_FACTORY(World); 122 122 123 World::World( TiXmlElement* root)123 World::World(const TiXmlElement* root) 124 124 { 125 125 this->constuctorInit("", -1); 126 126 this->path = NULL; 127 const char *string; 128 char *name; 129 int id; 130 131 PRINTF0("Creating a World\n"); 132 133 // identifier 134 string = grabParameter( root, "identifier"); 135 if( string == NULL || sscanf(string, "%d", &id) != 1) 136 { 137 PRINTF0("World is missing a proper 'identifier'\n"); 138 this->setStoryID( -1); 139 } 140 else setStoryID( id); 141 142 // next id 143 string = grabParameter( root, "nextid"); 144 if( string == NULL || sscanf(string, "%d", &id) != 1) 145 { 146 PRINTF0("World is missing a proper 'nextid'\n"); 147 this->setStoryID( -1); 148 } 149 else setNextStoryID( id); 150 151 152 // path 153 string = grabParameter( root, "path"); 154 if( string == NULL) 155 { 156 PRINTF0("World is missing a proper 'path'\n"); 157 this->setPath( NULL); 158 } 159 else 160 { 161 name = new char[strlen(string + 2)]; 162 strcpy( name, string); 163 this->setPath( name); 164 } 127 128 this->loadParams(root); 165 129 } 166 130 … … 234 198 this->debugWorldNr = worldID; 235 199 this->entities = new tList<WorldEntity>(); 200 } 201 202 void World::loadParams(const TiXmlElement* root) 203 { 204 const char *string; 205 char *name; 206 int id; 207 208 PRINTF0("Creating a World\n"); 209 210 // identifier 211 string = grabParameter( root, "identifier"); 212 if( string == NULL || sscanf(string, "%d", &id) != 1) 213 { 214 PRINTF0("World is missing a proper 'identifier'\n"); 215 this->setStoryID( -1); 216 } 217 else setStoryID( id); 218 219 // next id 220 string = grabParameter( root, "nextid"); 221 if( string == NULL || sscanf(string, "%d", &id) != 1) 222 { 223 PRINTF0("World is missing a proper 'nextid'\n"); 224 this->setStoryID( -1); 225 } 226 else setNextStoryID( id); 227 228 229 // path 230 string = grabParameter( root, "path"); 231 if( string == NULL) 232 { 233 PRINTF0("World is missing a proper 'path'\n"); 234 this->setPath( NULL); 235 } 236 else 237 { 238 name = new char[strlen(string + 2)]; 239 strcpy( name, string); 240 this->setPath( name); 241 } 236 242 } 237 243 … … 332 338 else 333 339 { 334 this->glmis->load (element);340 this->glmis->loadParams(element); 335 341 this->glmis->draw(); 336 342 }
Note: See TracChangeset
for help on using the changeset viewer.