- Timestamp:
- Nov 19, 2005, 12:16:12 AM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/lang/base_object.cc
r5626 r5642 151 151 /** 152 152 * displays everything this class is 153 * @TODO REIMPLEMENT WITH SENSE. 153 154 */ 154 155 void BaseObject::whatIs() const … … 193 194 PRINT(0)(" -Weapon-"); 194 195 PRINT(0)("\n"); 195 }196 196 } 197 } -
trunk/src/lib/shell/shell_command.cc
r5641 r5642 42 42 this->description = NULL; 43 43 this->alias = NULL; 44 this->executor = executor.clone(); 44 45 45 46 // this->classID = classID; … … 47 48 if (this->shellClass != NULL) 48 49 this->shellClass->commandList->add(this); 49 // handling parameters, and storing them:50 if (paramCount > FUNCTOR_MAX_ARGUMENTS)51 paramCount = FUNCTOR_MAX_ARGUMENTS;52 this->paramCount = paramCount;53 this->parameters = new unsigned int[paramCount];54 this->defaultValue = new MultiType[paramCount];55 56 this->executor = executor.clone();57 50 } 58 51 … … 62 55 ShellCommand::~ShellCommand() 63 56 { 64 delete[] this->parameters;65 delete[] this->defaultValue;66 57 if (this->alias != NULL && ShellCommandClass::aliasList != NULL) 67 58 { … … 369 360 while(elem != NULL) 370 361 { 371 PRINT(0)(" command:'%s' : params:%d: ", elem->getName(), elem->paramCount); 372 for (unsigned int i = 0; i< elem->paramCount; i++) 373 printf("%s ", ShellCommand::paramToString(elem->parameters[i])); 362 PRINT(0)(" command:'%s' : params:%d: ", elem->getName(), elem->executor->getParamCount()); 363 /// FIXME 364 /* for (unsigned int i = 0; i< elem->paramCount; i++) 365 printf("%s ", ShellCommand::paramToString(elem->parameters[i]));*/ 374 366 if (elem->description != NULL) 375 367 printf("- %s", elem->description); -
trunk/src/lib/shell/shell_command.h
r5641 r5642 86 86 87 87 protected: 88 unsigned int paramCount; //!< the count of parameters.89 unsigned int* parameters; //!< Parameters the function of this Command takes.90 88 MultiType* defaultValue; //!< Default Values. 91 89 … … 95 93 96 94 const char* description; //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla"); 97 Executor* executor; 95 Executor* executor; //!< The Executor, that really executes the Function. 98 96 99 97 }; -
trunk/src/lib/shell/shell_command_class.cc
r5641 r5642 238 238 while(elem != NULL) 239 239 { 240 PRINT(0)(" command:'%s' : params:%d: ", elem->getName(), elem->paramCount); 241 for (unsigned int i = 0; i< elem->paramCount; i++) 242 PRINT(0)("%s ", ShellCommand::paramToString(elem->parameters[i])); 240 PRINT(0)(" command:'%s' : params:%d: ", elem->getName(), elem->executor->getParamCount()); 241 /// FIXME 242 /* for (unsigned int i = 0; i< elem->paramCount; i++) 243 PRINT(0)("%s ", ShellCommand::paramToString(elem->parameters[i]));*/ 243 244 if (elem->description != NULL) 244 245 PRINT(0)("- %s", elem->description); -
trunk/src/lib/util/executor/executor.h
r5641 r5642 44 44 /** @returns the Type of this Function (either static or objective) */ 45 45 inline Executor_Type getType() const { return this->functorType; }; 46 /** @returns the Count of Parameters this Executor takes */ 47 inline unsigned int getParamCount() const { return this->paramCount; }; 46 48 47 49 static void debug(); … … 54 56 55 57 protected: 56 Executor_Type functorType; 57 unsigned int paramCount; 58 MultiType* defaultValue; 58 Executor_Type functorType; //!< The type of Function we've got (either static or objective). 59 unsigned int paramCount; //!< the count of parameters. 60 MultiType* defaultValue; //!< Default Values. 59 61 }; 60 62 -
trunk/src/lib/util/multi_type.cc
r5641 r5642 96 96 * @returns a Copy of itself. (strings inside are copied as well) 97 97 */ 98 MultiType MultiType::operator= (const MultiType& mt) 99 { 100 this->type = mt.type; 101 this->value = mt.value; 102 103 if (mt.type == MT_STRING && mt.storedString != NULL) 104 { 105 this->storedString = new char[strlen (mt.storedString)+1]; 106 strcpy(this->storedString, mt.storedString); 107 this->value.String = this->storedString; 108 } 109 else 110 this->storedString = NULL; 111 } 98 // MultiType MultiType::operator= (const MultiType& mt) 99 // { 100 // this->type = mt.type; 101 // this->value = mt.value; 102 // 103 // if (mt.type == MT_STRING && mt.storedString != NULL) 104 // { 105 // this->storedString = new char[strlen (mt.storedString)+1]; 106 // strcpy(this->storedString, mt.storedString); 107 // this->value.String = this->storedString; 108 // } 109 // else 110 // this->storedString = NULL; 111 // return *this; 112 // } 112 113 113 114 /** … … 126 127 this->type = (MT_Type)type; 127 128 129 if (this->type != type) 130 { 131 if (this->type == MT_NULL) 132 this->setString(""); 133 134 } 128 135 /// @todo check if this works... 129 136 … … 158 165 this->type = MT_FLOAT; 159 166 this->value.Float = value; 160 161 167 } 162 168 … … 308 314 { 309 315 sprintf(tmpString, "%d", this->value.Int); 310 this->storedString = new char[strlen 316 this->storedString = new char[strlen(tmpString)+1]; 311 317 strcpy (this->storedString, tmpString); 312 318 return this->storedString; -
trunk/src/lib/util/multi_type.h
r5633 r5642 42 42 virtual ~MultiType(); 43 43 44 MultiType operator= (const MultiType& mt);44 // MultiType operator= (const MultiType& mt); 45 45 46 46 void setType(int type);
Note: See TracChangeset
for help on using the changeset viewer.