Changeset 4261 in orxonox.OLD for orxonox/trunk/src/story_entities
- Timestamp:
- May 22, 2005, 3:19:57 AM (20 years ago)
- Location:
- orxonox/trunk/src/story_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/story_entities/campaign.cc
r4114 r4261 27 27 #include "list.h" 28 28 29 #include "load_param.h" 30 29 31 using namespace std; 30 32 … … 35 37 this->isInit = false; 36 38 } 39 37 40 Campaign::Campaign ( TiXmlElement* root) 38 41 { -
orxonox/trunk/src/story_entities/campaign.h
r4010 r4261 8 8 9 9 class World; 10 class TiXmlElement; 10 11 template<class T> class tList; 11 12 -
orxonox/trunk/src/story_entities/story_entity.h
r3629 r4261 11 11 #include "story_def.h" 12 12 #include "error.h" 13 14 13 15 14 //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc... -
orxonox/trunk/src/story_entities/world.cc
r4245 r4261 53 53 #include "substring.h" 54 54 55 55 #include "factory.h" 56 56 57 57 using namespace std; … … 123 123 CREATE_FACTORY(World); 124 124 125 World::World( TiXmlElement* root)125 World::World(const TiXmlElement* root) 126 126 { 127 127 this->constuctorInit("", -1); 128 128 this->path = NULL; 129 const char *string; 130 char *name; 131 int id; 132 133 PRINTF0("Creating a World\n"); 134 135 // identifier 136 string = grabParameter( root, "identifier"); 137 if( string == NULL || sscanf(string, "%d", &id) != 1) 138 { 139 PRINTF0("World is missing a proper 'identifier'\n"); 140 this->setStoryID( -1); 141 } 142 else setStoryID( id); 143 144 // next id 145 string = grabParameter( root, "nextid"); 146 if( string == NULL || sscanf(string, "%d", &id) != 1) 147 { 148 PRINTF0("World is missing a proper 'nextid'\n"); 149 this->setStoryID( -1); 150 } 151 else setNextStoryID( id); 152 153 154 // path 155 string = grabParameter( root, "path"); 156 if( string == NULL) 157 { 158 PRINTF0("World is missing a proper 'path'\n"); 159 this->setPath( NULL); 160 } 161 else 162 { 163 name = new char[strlen(string + 2)]; 164 strcpy( name, string); 165 this->setPath( name); 166 } 129 130 this->loadParams(root); 167 131 } 168 132 … … 213 177 //delete animator 214 178 179 LoadClassDescription::printAll(); 180 215 181 ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL); 216 182 } … … 234 200 this->debugWorldNr = worldID; 235 201 this->entities = new tList<WorldEntity>(); 202 } 203 204 void World::loadParams(const TiXmlElement* root) 205 { 206 const char *string; 207 char *name; 208 int id; 209 210 PRINTF0("Creating a World\n"); 211 212 LoadParam<World>(root, "identifier", this, &World::setStoryID) 213 .describe("Sets the StoryID of this world"); 214 LoadParam<World>(root, "nextid", this, &World::setNextStoryID) 215 .describe("Sets the ID of the next world"); 216 LoadParam<World>(root, "path", this, &World::setPath) 217 .describe("The Filename of this World (relative from the data-dir)"); 218 219 220 /* 221 // identifier 222 string = grabParameter( root, "identifier"); 223 if( string == NULL || sscanf(string, "%d", &id) != 1) 224 { 225 PRINTF0("World is missing a proper 'identifier'\n"); 226 this->setStoryID( -1); 227 } 228 else setStoryID( id); 229 230 // next id 231 string = grabParameter( root, "nextid"); 232 if( string == NULL || sscanf(string, "%d", &id) != 1) 233 { 234 PRINTF0("World is missing a proper 'nextid'\n"); 235 this->setStoryID( -1); 236 } 237 else setNextStoryID( id); 238 239 240 // path 241 string = grabParameter( root, "path"); 242 if( string == NULL) 243 { 244 PRINTF0("World is missing a proper 'path'\n"); 245 this->setPath( NULL); 246 } 247 else 248 { 249 name = new char[strlen(string + 2)]; 250 strcpy( name, string); 251 this->setPath( name); 252 } 253 */ 236 254 } 237 255 … … 334 352 else 335 353 { 336 this->glmis->load (element);354 this->glmis->loadParams(element); 337 355 this->glmis->draw(); 338 356 } … … 421 439 glNewList (objectList, GL_COMPILE); 422 440 423 424 441 //trackManager->drawGraph(.01); 425 442 //trackManager->debug(2); -
orxonox/trunk/src/story_entities/world.h
r4176 r4261 11 11 #include "story_entity.h" 12 12 #include "p_node.h" 13 #include "xmlparser/tinyxml.h"14 13 15 14 class World; … … 24 23 class GarbageCollector; 25 24 class Text; 25 class TiXmlElement; 26 26 27 27 //! The game world Interface … … 56 56 World (char* name); 57 57 World (int worldID); 58 World ( TiXmlElement* root);58 World (const TiXmlElement* root = NULL); 59 59 virtual ~World (); 60 61 void loadParams(const TiXmlElement* root); 60 62 61 63 double getGameTime();
Note: See TracChangeset
for help on using the changeset viewer.