Changeset 5155 in orxonox.OLD for trunk/src/util
- Timestamp:
- Aug 27, 2005, 3:39:26 PM (19 years ago)
- Location:
- trunk/src/util
- Files:
-
- 4 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 -
trunk/src/util/shell_command.cc
r5154 r5155 139 139 while(elem != NULL) 140 140 { 141 printf("%s \n", elem->getName());141 printf("%s::%s\n", elem->className, elem->getName()); 142 142 if (!strncasecmp (executionString, elem->className, strlen(elem->className)) && 143 143 (*(executionString+strlen(elem->className)) == ' ' || … … 170 170 while(*commandBegin == ' ') 171 171 commandBegin++; 172 tList<BaseObject>* list = 172 tList<BaseObject>* list = ClassList::getList(elem->classID); 173 173 if (list == NULL) 174 174 break; -
trunk/src/util/shell_command.h
r5153 r5155 10 10 11 11 #include "helper_functions.h" 12 #include "functor_list.h"13 12 #include "substring.h" 13 #include "functor_list.h" 14 14 15 15 #include <stdarg.h>
Note: See TracChangeset
for help on using the changeset viewer.