Changeset 965 for code/branches/core2/src/orxonox/core
- Timestamp:
- Mar 30, 2008, 7:15:16 PM (17 years ago)
- Location:
- code/branches/core2/src/orxonox/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/core/CommandExecutor.cc
r957 r965 91 91 } 92 92 93 void CommandEvaluation::setAdditionalParameter(const std::string& param)94 {95 this->additionalParameter_ = param;96 }97 98 93 bool CommandEvaluation::isValid() const 99 94 { … … 198 193 { 199 194 if (tokens.size() >= 2) 200 return evaluation.shortcut_->parse(tokens.subSet(1).join() + " " + evaluation.additionalParameter_);195 return evaluation.shortcut_->parse(tokens.subSet(1).join() + evaluation.getAdditionalParameter()); 201 196 else 202 197 return evaluation.shortcut_->parse(evaluation.additionalParameter_); … … 212 207 { 213 208 if (tokens.size() >= 3) 214 return evaluation.function_->parse(tokens.subSet(2).join() + " " + evaluation.additionalParameter_);209 return evaluation.function_->parse(tokens.subSet(2).join() + evaluation.getAdditionalParameter()); 215 210 else 216 211 return evaluation.function_->parse(evaluation.additionalParameter_); … … 230 225 { 231 226 if (tokens.size() >= 4) 232 return evaluation.configvalue_->set(tokens.subSet(3).join() + " " + evaluation.additionalParameter_);227 return evaluation.configvalue_->set(tokens.subSet(3).join() + evaluation.getAdditionalParameter()); 233 228 else 234 229 return evaluation.configvalue_->set(evaluation.additionalParameter_); … … 237 232 { 238 233 if (tokens.size() >= 4) 239 return evaluation.configvalue_->tset(tokens.subSet(3).join() + " " + evaluation.additionalParameter_);234 return evaluation.configvalue_->tset(tokens.subSet(3).join() + evaluation.getAdditionalParameter()); 240 235 else 241 236 return evaluation.configvalue_->tset(evaluation.additionalParameter_); … … 445 440 CommandExecutor::createListOfPossibleFunctionClasses(CommandExecutor::getToken(0)); 446 441 CommandExecutor::createListOfPossibleShortcuts(CommandExecutor::getToken(0)); 442 443 // Check if there's only one possiblility 444 if ((CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.size() == 1) && (CommandExecutor::getEvaluation().listOfPossibleShortcuts_.size() == 0)) 445 { 446 // There's only one possible class 447 CommandExecutor::getEvaluation().state_ = CS_Function; 448 CommandExecutor::getEvaluation().functionclass_ = CommandExecutor::getIdentifierOfPossibleFunctionClass(**CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.begin()); 449 CommandExecutor::parse(**CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.begin() + " ", false); 450 return; 451 } 452 else if ((CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.size() == 0) && (CommandExecutor::getEvaluation().listOfPossibleShortcuts_.size() == 1)) 453 { 454 if ((**CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin() != COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) 455 && (**CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin() != COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY) 456 && (**CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin() != COMMAND_EXECUTOR_KEYWORD_SET_KEYBIND)) 457 { 458 // There's only one possible shortcut 459 CommandExecutor::getEvaluation().state_ = CS_Shortcut_Params; 460 CommandExecutor::getEvaluation().shortcut_ = CommandExecutor::getExecutorOfPossibleShortcut(**CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin()); 461 } 462 else if ((**CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin() == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) 463 || (**CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin() == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)) 464 { 465 // It's the 'set' or 'tset' keyword 466 CommandExecutor::getEvaluation().state_ = CS_ConfigValueClass; 467 } 468 else if (**CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin() != COMMAND_EXECUTOR_KEYWORD_SET_KEYBIND) 469 { 470 // It's the 'bind' keyword 471 CommandExecutor::getEvaluation().state_ = CS_KeybindKey; 472 } 473 474 CommandExecutor::parse(**CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin() + " ", false); 475 return; 476 } 477 478 // It's ambiguous 447 479 return; 448 480 } … … 568 600 // No perfect match: Create the list of all possible functions and return 569 601 CommandExecutor::createListOfPossibleFunctions(CommandExecutor::getToken(1), CommandExecutor::getEvaluation().functionclass_); 602 603 // Check if there's only one possiblility 604 if (CommandExecutor::getEvaluation().listOfPossibleFunctions_.size() == 1) 605 { 606 // There's only one possible function 607 CommandExecutor::getEvaluation().state_ = CS_Function_Params; 608 CommandExecutor::getEvaluation().function_ = CommandExecutor::getExecutorOfPossibleFunction(**CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin(), CommandExecutor::getEvaluation().functionclass_); 609 CommandExecutor::parse(CommandExecutor::getToken(0) + " " + **CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin() + " ", false); 610 return; 611 } 612 613 // It's ambiguous 570 614 return; 571 615 } … … 638 682 // No perfect match: Create the list of all possible classnames and return 639 683 CommandExecutor::createListOfPossibleConfigValueClasses(CommandExecutor::getToken(1)); 684 685 // Check if there's only one possiblility 686 if (CommandExecutor::getEvaluation().listOfPossibleConfigValueClasses_.size() == 1) 687 { 688 // There's only one possible classname 689 CommandExecutor::getEvaluation().state_ = CS_ConfigValue; 690 CommandExecutor::getEvaluation().configvalueclass_ = CommandExecutor::getIdentifierOfPossibleConfigValueClass(**CommandExecutor::getEvaluation().listOfPossibleConfigValueClasses_.begin()); 691 CommandExecutor::parse(CommandExecutor::getToken(0) + " " + **CommandExecutor::getEvaluation().listOfPossibleConfigValueClasses_.begin() + " ", false); 692 return; 693 } 694 695 // It's ambiguous 640 696 return; 641 697 } … … 690 746 // No perfect match: Create the list of all possible config values 691 747 CommandExecutor::createListOfPossibleConfigValues(CommandExecutor::getToken(2), CommandExecutor::getEvaluation().configvalueclass_); 748 749 // Check if there's only one possiblility 750 if (CommandExecutor::getEvaluation().listOfPossibleConfigValues_.size() == 1) 751 { 752 // There's only one possible config value 753 CommandExecutor::getEvaluation().state_ = CS_ConfigValueType; 754 CommandExecutor::getEvaluation().configvalue_ = CommandExecutor::getContainerOfPossibleConfigValue(**CommandExecutor::getEvaluation().listOfPossibleConfigValues_.begin(), CommandExecutor::getEvaluation().configvalueclass_); 755 CommandExecutor::parse(CommandExecutor::getToken(0) + " " + CommandExecutor::getToken(1) + " " + **CommandExecutor::getEvaluation().listOfPossibleConfigValues_.begin() + " ", false); 756 return; 757 } 758 759 // It's ambiguous 692 760 return; 693 761 } -
code/branches/core2/src/orxonox/core/CommandExecutor.h
r957 r965 74 74 75 75 KeybindMode getKeybindMode(); 76 void setAdditionalParameter(const std::string& param);77 76 bool isValid() const; 77 78 inline void setAdditionalParameter(const std::string& param) 79 { this->additionalParameter_ = param; } 80 inline std::string getAdditionalParameter() const 81 { return (this->additionalParameter_ != "") ? (" " + this->additionalParameter_) : ""; } 78 82 79 83 private:
Note: See TracChangeset
for help on using the changeset viewer.