Changeset 967 for code/branches/core2/src/orxonox/core/CommandExecutor.cc
- Timestamp:
- Mar 31, 2008, 12:25:09 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/core/CommandExecutor.cc
r965 r967 63 63 this->errorMessage_ = ""; 64 64 this->state_ = CS_Uninitialized; 65 66 this->bEvaluatedParams_ = false; 67 this->evaluatedExecutor_ = 0; 65 68 } 66 69 … … 113 116 return false; 114 117 } 118 } 119 120 void CommandEvaluation::evaluateParams() 121 { 122 this->bEvaluatedParams_ = false; 123 this->evaluatedExecutor_ = 0; 124 125 for (unsigned int i = 0; i < MAX_FUNCTOR_ARGUMENTS; i++) 126 this->param_[i] = MT_null; 127 128 if (this->state_ == CS_Shortcut_Params || this->state_ == CS_Shortcut_Finished) 129 { 130 if (this->shortcut_ != 0) 131 { 132 if (this->shortcut_->evaluate(this->processedCommand_ + this->getAdditionalParameter(), this->param_, " ")) 133 { 134 this->bEvaluatedParams_ = true; 135 this->evaluatedExecutor_ = this->shortcut_; 136 } 137 } 138 } 139 else if (this->state_ == CS_Function_Params || this->state_ == CS_Function_Finished) 140 { 141 if (this->function_ != 0) 142 { 143 if (this->function_->evaluate(this->processedCommand_ + this->getAdditionalParameter(), this->param_, " ")) 144 { 145 this->bEvaluatedParams_ = true; 146 this->evaluatedExecutor_ = this->function_; 147 } 148 } 149 } 150 } 151 152 void CommandEvaluation::setEvaluatedParameter(unsigned int index, MultiTypeMath param) 153 { 154 if (index >= 0 && index < MAX_FUNCTOR_ARGUMENTS) 155 this->param_[index] = param; 156 } 157 158 MultiTypeMath CommandEvaluation::getEvaluatedParameter(unsigned int index) const 159 { 160 if (index >= 0 && index < MAX_FUNCTOR_ARGUMENTS) 161 return this->param_[index]; 162 163 return MT_null; 115 164 } 116 165 … … 178 227 SubString tokens(evaluation.processedCommand_, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0'); 179 228 229 if (evaluation.bEvaluatedParams_ && evaluation.evaluatedExecutor_ != 0) 230 { 231 (*evaluation.evaluatedExecutor_)(evaluation.param_[0], evaluation.param_[1], evaluation.param_[2], evaluation.param_[3], evaluation.param_[4]); 232 } 233 180 234 switch (evaluation.state_) 181 235 { … … 404 458 { 405 459 CommandExecutor::parse(command, true); 460 CommandExecutor::getEvaluation().evaluateParams(); 406 461 return CommandExecutor::getEvaluation(); 407 462 }
Note: See TracChangeset
for help on using the changeset viewer.