Changeset 1324 for code/branches/console/src
- Timestamp:
- May 19, 2008, 2:58:22 PM (17 years ago)
- Location:
- code/branches/console/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/core/ConfigValueContainer.cc
r1321 r1324 107 107 if (this->bIsVector_) 108 108 { 109 return this->callFunctionWithIndex(&ConfigValueContainer::set, input. getString());109 return this->callFunctionWithIndex(&ConfigValueContainer::set, input.toString()); 110 110 } 111 111 else … … 113 113 if (this->tset(input)) 114 114 { 115 ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, input. getString(), this->value_.isA(MT_string));115 ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, input.toString(), this->value_.isA(MT_string)); 116 116 return true; 117 117 } … … 132 132 if (this->tset(index, input)) 133 133 { 134 ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, index, input. getString(), this->value_.isA(MT_string));134 ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, index, input.toString(), this->value_.isA(MT_string)); 135 135 return true; 136 136 } … … 152 152 if (this->bIsVector_) 153 153 { 154 return this->callFunctionWithIndex(&ConfigValueContainer::tset, input. getString());154 return this->callFunctionWithIndex(&ConfigValueContainer::tset, input.toString()); 155 155 } 156 156 else … … 160 160 { 161 161 this->value_ = temp; 162 163 162 if (this->identifier_) 164 163 this->identifier_->updateConfigValues(); … … 191 190 { 192 191 this->valueVector_.push_back(MultiTypeMath()); 193 ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isA(MT_string));194 192 } 195 193 } 196 194 197 MultiTypeMath temp = this->value Vector_[index];195 MultiTypeMath temp = this->value_; 198 196 if (temp.assimilate(input)) 199 197 { -
code/branches/console/src/core/ConfigValueContainer.h
r1321 r1324 90 90 } 91 91 92 template <typename T> 93 inline void setVectorType(const std::vector<T>& value) 94 { 95 this->value_ = T(); 96 } 97 92 98 inline const std::string& getName() const 93 99 { return this->varname_; } -
code/branches/console/src/core/ConfigValueIncludes.h
r1062 r1324 69 69 temp.push_back(MultiTypeMath(defvalue[i])); \ 70 70 container##varname = new orxonox::ConfigValueContainer(CFT_Settings, this->getIdentifier(), #varname, temp); \ 71 container##varname->setVectorType(varname); \ 71 72 this->getIdentifier()->addConfigValueContainer(#varname, container##varname); \ 72 73 } \ -
code/branches/console/src/core/Shell.cc
r1322 r1324 80 80 SetConfigValue(maxHistoryLength_, 100); 81 81 SetConfigValue(historyOffset_, 0); 82 SetConfigValueVector(commandHistory_, std::vector<std::string>()); 83 84 std::cout << "gaga1: " << this->commandHistory_[this->historyOffset_] << std::endl; 82 SetConfigValueVector(commandHistory_, std::vector<std::string>(1, "")); 85 83 86 84 if (this->historyOffset_ >= this->maxHistoryLength_) … … 93 91 ModifyConfigValue(commandHistory_, remove, index); 94 92 } 95 96 std::cout << "gaga2: " << this->commandHistory_[this->historyOffset_] << std::endl;97 93 } 98 94 … … 163 159 void Shell::addToHistory(const std::string& command) 164 160 { 165 std::cout << "command: " << command << std::endl;166 std::cout << "offset: " << this->historyOffset_ << std::endl;167 161 ModifyConfigValue(commandHistory_, set, this->historyOffset_, command); 168 // this->commandHistory_[this->historyOffset_] = command;169 162 this->historyPosition_ = 0; 170 std::cout << "gaga3: " << this->commandHistory_[this->historyOffset_] << std::endl;171 163 ModifyConfigValue(historyOffset_, set, (this->historyOffset_ + 1) % this->maxHistoryLength_); 172 std::cout << "offset new: " << this->historyOffset_ << std::endl;173 164 } 174 165 175 166 std::string Shell::getFromHistory() const 176 167 { 177 return this->commandHistory_[(this->historyOffset_ - this->historyPosition_) % this->maxHistoryLength_]; 168 unsigned int index = mod(((int)this->historyOffset_) - ((int)this->historyPosition_), this->maxHistoryLength_); 169 if (index < this->commandHistory_.size() && this->historyPosition_ != 0) 170 return this->commandHistory_[index]; 171 else 172 return ""; 178 173 } 179 174 … … 219 214 void Shell::execute() 220 215 { 221 //this->addToHistory(this->inputBuffer_.get());216 this->addToHistory(this->inputBuffer_.get()); 222 217 this->addLine(this->inputBuffer_.get(), 0); 223 218 … … 252 247 { 253 248 this->inputBuffer_.clear(); 249 this->historyPosition_ = 0; 254 250 SHELL_UPDATE_LISTENERS(inputChanged); 255 251 SHELL_UPDATE_LISTENERS(cursorChanged); … … 282 278 void Shell::history_up() 283 279 { 284 if (this->historyPosition_ < (this->commandHistory_.size() - 1))280 if (this->historyPosition_ < this->commandHistory_.size()) 285 281 { 286 282 this->historyPosition_++; -
code/branches/console/src/util/Math.h
r1062 r1324 121 121 122 122 template <typename T> 123 inline int mod(T x, int max) 124 { 125 if (x >= 0) 126 return (x % max); 127 else 128 return ((x % max) + max); 129 } 130 131 template <typename T> 123 132 T interpolate(float time, const T& start, const T& end) 124 133 {
Note: See TracChangeset
for help on using the changeset viewer.