- Timestamp:
- Aug 21, 2010, 9:52:13 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/ConsoleCommand.cc
r7186 r7198 34 34 namespace orxonox 35 35 { 36 ConsoleCommand::ConsoleCommand( Functor*functor, const std::string& name) : Executor(functor, name)36 ConsoleCommand::ConsoleCommand(const FunctorPtr& functor, const std::string& name) : Executor(functor, name) 37 37 { 38 38 this->accessLevel_ = AccessLevel::None; … … 124 124 _ConsoleCommand::_ConsoleCommandManipulator test(_ModifyConsoleCommand("BaseObject", "setName").setFunction(&BaseObject::setActive)); 125 125 126 _ConsoleCommand::_ConsoleCommand(const std::string& group, const std::string& name, Functor*functor, bool bInitialized) : Executor(functor, name), functionHeader_(functor->getHeaderIdentifier())126 _ConsoleCommand::_ConsoleCommand(const std::string& group, const std::string& name, const FunctorPtr& functor, bool bInitialized) : Executor(functor, name), functionHeader_(functor->getHeaderIdentifier()) 127 127 { 128 128 this->bActive_ = true; … … 155 155 } 156 156 157 bool _ConsoleCommand::setFunctor( Functor*functor, bool bForce)157 bool _ConsoleCommand::setFunctor(const FunctorPtr& functor, bool bForce) 158 158 { 159 159 if (!functor) … … 174 174 } 175 175 176 void _ConsoleCommand::pushFunctor( Functor*functor, bool bForce)177 { 178 Functor*oldfunctor = this->getFunctor();176 void _ConsoleCommand::pushFunctor(const FunctorPtr& functor, bool bForce) 177 { 178 const FunctorPtr& oldfunctor = this->getFunctor(); 179 179 180 180 if (this->setFunctor(functor, bForce)); … … 184 184 void _ConsoleCommand::popFunctor() 185 185 { 186 Functor * newfunctor = 0;186 FunctorPtr newfunctor; 187 187 if (!this->functorStack_.empty()) 188 188 { … … 193 193 } 194 194 195 Functor*_ConsoleCommand::getFunctor() const196 { 197 if (this->bInitialized_) 195 const FunctorPtr& _ConsoleCommand::getFunctor() const 196 { 197 // if (this->bInitialized_) // FIXME 198 198 return this->functor_; 199 else200 return 0;201 } 202 203 bool _ConsoleCommand::functionHeaderMatches( Functor*functor) const199 // else 200 // return 0; 201 } 202 203 bool _ConsoleCommand::functionHeaderMatches(const FunctorPtr& functor) const 204 204 { 205 205 if (!this->functor_) … … 216 216 this->functor_->setRawObjectPointer(object); 217 217 else if (object) 218 COUT( 0) << "Error: Can't set object in console command \"" << this->getName() << "\", no functor set." << std::endl;218 COUT(1) << "Error: Can't set object in console command \"" << this->getName() << "\", no functor set." << std::endl; 219 219 } 220 220 … … 227 227 } 228 228 else 229 COUT( 0) << "Error: Can't set object in console command \"" << this->getName() << "\", no functor set." << std::endl;229 COUT(1) << "Error: Can't set object in console command \"" << this->getName() << "\", no functor set." << std::endl; 230 230 } 231 231 … … 263 263 { 264 264 if (group == "") 265 COUT( 0) << "Error: Couldn't find console command with shortcut \"" << name << "\"" << std::endl;265 COUT(1) << "Error: Couldn't find console command with shortcut \"" << name << "\"" << std::endl; 266 266 else 267 COUT( 0) << "Error: Couldn't find console command with group \"" << group << "\" and name \"" << name << "\"" << std::endl;267 COUT(1) << "Error: Couldn't find console command with group \"" << group << "\" and name \"" << name << "\"" << std::endl; 268 268 } 269 269 return 0;
Note: See TracChangeset
for help on using the changeset viewer.