Changeset 5155 in orxonox.OLD for trunk/src/util/loading
- Timestamp:
- Aug 27, 2005, 3:39:26 PM (19 years ago)
- Location:
- trunk/src/util/loading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/loading/factory.cc
r4836 r5155 16 16 17 17 #include "factory.h" 18 19 #include "shell_command.h" 18 20 #include "game_loader.h" 19 20 21 using namespace std; 21 22 … … 68 69 69 70 if( Factory::first == NULL) 71 { 70 72 Factory::first = factory; 73 ShellCommand<Factory>::registerCommand("create", CL_FACTORY, &Factory::fabricate); 74 } 71 75 else 72 76 { … … 79 83 } 80 84 } 85 86 void Factory::fabricate(const char* className, const char* entityName) 87 { 88 if (className == NULL) 89 return; 90 Factory* fac = Factory::first; 91 92 while (fac != NULL) 93 { 94 if (!strcmp(className, fac->getName())) 95 { 96 PRINTF(3)("Create a new Object of type %s\n", fac->getName()); 97 BaseObject* object = fac->fabricate(NULL); 98 if (object != NULL) 99 { 100 object->setName(entityName); 101 } 102 break; 103 } 104 fac = fac->next; 105 } 106 } -
trunk/src/util/loading/factory.h
r4932 r5155 26 26 27 27 #include "tinyxml.h" 28 #include "load_param.h"29 28 #include "base_object.h" 30 29 #include "debug.h" … … 44 43 ~Factory (); 45 44 46 45 void fabricate(const char* className, const char* entityName); 47 46 virtual BaseObject* fabricate(const TiXmlElement* root) = NULL; 48 47
Note: See TracChangeset
for help on using the changeset viewer.