Changeset 5207 in orxonox.OLD
- Timestamp:
- Sep 19, 2005, 10:00:45 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.cc
r5204 r5207 572 572 return this; 573 573 } 574 575 /** 576 * sets default Values of the Commands 577 * @param count how many default Values to set. 578 * @param ... the default Values in order. They will be cast to the right type 579 * @returns itself 580 * 581 * Be aware, that when you use this Function, you !!MUST!! match the input as 582 * count, [EXACTLY THE SAME AS IF YOU WOULD CALL THE FUNCTION UP TO count ARGUMENTS] 583 */ 584 ShellCommandBase* ShellCommandBase::defaultValues(unsigned int count, ...) 585 { 586 if (this == NULL) 587 return NULL; 588 if (count == 0) 589 return this; 590 if (count > this->paramCount) 591 count = this->paramCount; 592 593 va_list defaultList; 594 va_start(defaultList, count); 595 596 for (unsigned int i = 0; i < count; i++) 597 { 598 switch (this->parameters[i]) 599 { 600 case ParameterBool: 601 this->defaultBools[i] = va_arg(defaultList, int); 602 break; 603 case ParameterChar: 604 this->defaultStrings[i] = new char[2]; 605 sprintf(this->defaultStrings[0], "%c", va_arg(defaultList, int)); 606 break; 607 case ParameterString: 608 this->defaultStrings[i] = va_arg(defaultList, char*); 609 break; 610 case ParameterInt: 611 this->defaultInts[i] = va_arg(defaultList, int); 612 break; 613 case ParameterUInt: 614 this->defaultInts[i] = va_arg(defaultList, unsigned int); 615 break; 616 case ParameterFloat: 617 this->defaultFloats[i] = va_arg(defaultList, double); 618 break; 619 case ParameterLong: 620 this->defaultInts[i] = va_arg(defaultList, long); 621 break; 622 default: 623 break; 624 } 625 } 626 627 return this; 628 } 629 574 630 575 631 /** -
trunk/src/lib/shell/shell_command.h
r5204 r5207 2 2 * @file shell_command.h 3 3 * Definition of a on-screen-shell 4 * @todo simple way to supply Default Values with the macro.5 4 */ 6 5 … … 87 86 ShellCommandBase* describe(const char* description); 88 87 ShellCommandBase* setAlias(const char* alias); 88 ShellCommandBase* defaultValues(unsigned int count, ...); 89 89 90 90 /** @returns the CommandList of the Shell */ -
trunk/src/lib/shell/shell_input.cc
r5204 r5207 36 36 ->describe("retrieve some help about the input mode") 37 37 ->setAlias("help"); 38 39 38 /** 40 39 * standard constructor … … 179 178 void ShellInput::help(const char* className, const char* functionName) 180 179 { 180 printf("%s::%s\n", className, functionName); 181 181 182 if (strlen(className) == 0) 182 183 { -
trunk/src/lib/util/helper_functions.cc
r5148 r5207 63 63 const char* isString(const char* STRING, const char* defaultValue) 64 64 { 65 if (STRING != NULL )65 if (STRING != NULL && strlen(STRING) > 0) 66 66 return STRING; 67 67 else -
trunk/src/orxonox.cc
r5183 r5207 58 58 59 59 using namespace std; 60 61 SHELL_COMMAND(restart, Orxonox, restart); 60 62 61 63 /** … … 121 123 Orxonox* Orxonox::singletonRef = NULL; 122 124 125 // DANGEROUS 126 void Orxonox::restart() 127 { 128 // int argc = this->argc; 129 // char** argv = this->argv; 130 // 131 // Orxonox *orx = Orxonox::getInstance(); 132 // 133 // delete orx; 134 // 135 // orx = Orxonox::getInstance(); 136 // 137 // if((*orx).init(argc, argv) == -1) 138 // { 139 // PRINTF(1)("! Orxonox initialization failed\n"); 140 // return; 141 // } 142 // 143 // printf("finished inizialisation\n"); 144 // orx->start(); 145 } 146 123 147 /** 124 148 * this finds the config file -
trunk/src/orxonox.h
r5074 r5207 25 25 int init (int argc, char** argv); 26 26 27 void restart(); 28 27 29 void start(); 28 30 … … 40 42 int initNetworking (); 41 43 int initMisc (); 44 42 45 43 46 const char* getConfigFile ();
Note: See TracChangeset
for help on using the changeset viewer.