Changeset 4003 in orxonox.OLD for orxonox/branches/ll2trunktemp/src/factory.cc
- Timestamp:
- Apr 28, 2005, 2:25:08 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/ll2trunktemp/src/factory.cc
r3994 r4003 1 2 3 1 /* 4 2 orxonox - the future of 3D-vertical-scrollers … … 23 21 24 22 /* -------------------------------------------------- 25 * Factory26 * --------------------------------------------------27 */23 * Factory 24 * -------------------------------------------------- 25 */ 28 26 29 27 /** … … 34 32 Factory::Factory () 35 33 { 36 classname = "NULL"; 37 next = NULL; 34 classname = "NULL"; 35 next = NULL; 36 37 initialize(); 38 38 } 39 39 … … 45 45 Factory::~Factory () 46 46 { 47 //if( next != NULL) delete next; 47 printf("%s\n", this->classname); 48 Factory* tmpDel = this->next; 49 this->next = NULL; 50 // if (tmpDel) 51 // delete tmpDel; 48 52 } 49 50 53 51 54 /** … … 54 57 BaseObject* Factory::fabricate( TiXmlElement* data) 55 58 { 56 59 return NULL; 57 60 } 58 61 … … 62 65 void Factory::initialize() 63 66 { 64 65 66 67 assert( classname != NULL); 68 GameLoader* gl = GameLoader::getInstance(); 69 gl->registerFactory( this); 67 70 } 68 71 … … 72 75 void Factory::registerFactory( Factory* factory) 73 76 { 74 75 77 if( next == NULL) setNext( factory); 78 else next->registerFactory( factory); 76 79 } 77 80 78 81 const char* grabParameter( TiXmlElement* root, const char* name) 79 82 { 80 81 83 TiXmlElement* element; 84 TiXmlNode* node; 82 85 83 84 86 assert( root != NULL); 87 assert( name != NULL); 85 88 86 87 89 element = root->FirstChildElement( name); 90 if( element == NULL) return NULL; 88 91 89 90 91 92 93 94 95 92 node = element->FirstChild(); 93 while( node != NULL) 94 { 95 if( node->ToText()) return node->Value(); 96 node = node->NextSibling(); 97 } 98 return NULL; 96 99 } 97 100
Note: See TracChangeset
for help on using the changeset viewer.