Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 31, 2008, 12:25:09 AM (16 years ago)
Author:
landauf
Message:

hum, i forgot what i was doing there… oh wait, i remember… it had something to do with executor evaluation. strange thing, no wonder my brain has a leak or something… what's that SVN thing all around my cursor? what's a cursor anyway? oh, and what am i doing here? i feel like having breakfast and it's all dark… stupid clock change…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core2/src/orxonox/core/CommandExecutor.cc

    r965 r967  
    6363        this->errorMessage_ = "";
    6464        this->state_ = CS_Uninitialized;
     65
     66        this->bEvaluatedParams_ = false;
     67        this->evaluatedExecutor_ = 0;
    6568    }
    6669
     
    113116            return false;
    114117        }
     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;
    115164    }
    116165
     
    178227        SubString tokens(evaluation.processedCommand_, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
    179228
     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
    180234        switch (evaluation.state_)
    181235        {
     
    404458    {
    405459        CommandExecutor::parse(command, true);
     460        CommandExecutor::getEvaluation().evaluateParams();
    406461        return CommandExecutor::getEvaluation();
    407462    }
Note: See TracChangeset for help on using the changeset viewer.