- Timestamp:
- Nov 18, 2005, 6:20:23 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/executor/executor.cc
r5633 r5635 68 68 69 69 /** 70 * lets a command be described71 * @param description the description of the Given command72 */73 Executor* Executor::describe(const char* description)74 {75 if (this == NULL)76 return NULL;77 else78 {79 this->description = description;80 return this;81 }82 }83 84 /**85 70 * sets default Values of the Commands 86 71 * @param count how many default Values to set. … … 93 78 Executor* Executor::defaultValues(unsigned int count, ...) 94 79 { 80 va_list values; 81 va_start(values, count); 82 83 this->defaultValues(count, values); 84 } 85 86 Executor* Executor::defaultValues(unsigned int count, va_list values) 87 { 95 88 if (this == NULL) 96 89 return NULL; … … 100 93 count = this->paramCount; 101 94 102 va_list defaultList;103 va_start(defaultList, count);104 95 105 96 for (unsigned int i = 0; i < count; i++) … … 108 99 { 109 100 case MT_BOOL: 110 this->defaultValue[i].setInt(va_arg( defaultList, int));101 this->defaultValue[i].setInt(va_arg(values, int)); 111 102 break; 112 103 case MT_CHAR: 113 this->defaultValue[i].setChar((char)va_arg( defaultList, int));104 this->defaultValue[i].setChar((char)va_arg(values, int)); 114 105 break; 115 106 case MT_STRING: 116 this->defaultValue[i].setString(va_arg( defaultList, char*));107 this->defaultValue[i].setString(va_arg(values, char*)); 117 108 break; 118 109 case MT_INT: 119 this->defaultValue[i].setInt(va_arg( defaultList, int));110 this->defaultValue[i].setInt(va_arg(values, int)); 120 111 break; 121 112 /* case MT_UINT: 122 this->defaultValue[i].setInt((int)va_arg( defaultList, unsigned int));113 this->defaultValue[i].setInt((int)va_arg(values, unsigned int)); 123 114 break;*/ 124 115 case MT_FLOAT: 125 this->defaultValue[i].setFloat(va_arg( defaultList, double));116 this->defaultValue[i].setFloat(va_arg(values, double)); 126 117 break; 127 118 /* case MT_LONG: 128 this->defaultValue[i].setInt((int) va_arg( defaultList, long));119 this->defaultValue[i].setInt((int) va_arg(values, long)); 129 120 break;*/ 130 121 default: -
trunk/src/lib/util/executor/executor.h
r5633 r5635 12 12 #include "multi_type.h" 13 13 #include "substring.h" 14 #include "functor_list.h" 14 #include "functor_list.h" //< MUST BE INCLUDED HERE AT LEAST ONCE. 15 15 16 16 #include <stdarg.h> … … 32 32 { 33 33 public: 34 static bool execute (const char* executionString);35 36 Executor* describe(const char* description);37 34 Executor* defaultValues(unsigned int count, ...); 35 Executor* defaultValues(unsigned int count, va_list values); 38 36 39 37 /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */ 40 38 virtual void execute (BaseObject* object, const char* parameters) = 0; 41 42 39 43 40 static void debug(); … … 56 53 57 54 private: 58 const char* description; //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla");59 55 }; 60 56 -
trunk/src/world_entities/player.cc
r5634 r5635 16 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY 17 17 18 19 #include "executor/executor.h" 18 20 #include "player.h" 19 21 … … 32 34 33 35 #include "event.h" 34 35 #include "executor/executor.h"36 36 37 37 using namespace std;
Note: See TracChangeset
for help on using the changeset viewer.