Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 12, 2009, 11:58:01 PM (15 years ago)
Author:
rgrieder
Message:

Merged most of the core4 revisions back to the trunk except for:

  • orxonox_cast
  • all the radical changes in the input library
Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/core/CommandExecutor.cc

    r3196 r3280  
    3030
    3131#include "util/Debug.h"
    32 #include "util/String.h"
     32#include "util/StringUtils.h"
    3333#include "ConsoleCommand.h"
    3434#include "Identifier.h"
     
    141141    void CommandExecutor::parseIfNeeded(const std::string& command)
    142142    {
    143         if (CommandExecutor::getEvaluation().state_ == CS_Uninitialized)
     143        if (CommandExecutor::getEvaluation().state_ == CommandState::Uninitialized)
    144144        {
    145145            CommandExecutor::parse(command);
     
    169169        switch (CommandExecutor::getEvaluation().state_)
    170170        {
    171             case CS_Uninitialized:
     171            case CommandState::Uninitialized:
    172172            {
    173173                // Impossible
    174174                break;
    175175            }
    176             case CS_Empty:
     176            case CommandState::Empty:
    177177            {
    178178                if (CommandExecutor::argumentsGiven() == 0)
     
    184184                else
    185185                {
    186                     CommandExecutor::getEvaluation().state_ = CS_ShortcutOrIdentifier;
     186                    CommandExecutor::getEvaluation().state_ = CommandState::ShortcutOrIdentifier;
    187187                    // Move on to next case
    188188                }
    189189            }
    190             case CS_ShortcutOrIdentifier:
     190            case CommandState::ShortcutOrIdentifier:
    191191            {
    192192                if (CommandExecutor::argumentsGiven() > 1)
     
    199199                    {
    200200                        // It's a shortcut
    201                         CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
     201                        CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
    202202                        CommandExecutor::getEvaluation().functionclass_ = 0;
    203203                        // Move on to next case
     
    206206                    {
    207207                        // It's a functionname
    208                         CommandExecutor::getEvaluation().state_ = CS_Function;
     208                        CommandExecutor::getEvaluation().state_ = CommandState::Function;
    209209                        CommandExecutor::getEvaluation().function_ = 0;
    210210                        // Move on to next case
     
    213213                    {
    214214                        // The first argument is bad
    215                         CommandExecutor::getEvaluation().state_ = CS_Error;
     215                        CommandExecutor::getEvaluation().state_ = CommandState::Error;
    216216                        AddLanguageEntry("commandexecutorunknownfirstargument", "is not a shortcut nor a classname");
    217217                        CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(0) + " " + GetLocalisation("commandexecutorunknownfirstargument") + ".";
     
    238238                            CommandExecutor::getEvaluation().bCommandChanged_ = true;
    239239                        }
    240                         CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
     240                        CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
    241241                        CommandExecutor::getEvaluation().functionclass_ = 0;
    242242                        CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().function_->getName();
     
    258258                            CommandExecutor::getEvaluation().bCommandChanged_ = true;
    259259                        }
    260                         CommandExecutor::getEvaluation().state_ = CS_Function;
     260                        CommandExecutor::getEvaluation().state_ = CommandState::Function;
    261261                        CommandExecutor::getEvaluation().function_ = 0;
    262262                        CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " ";
     
    266266                    {
    267267                        // No possibilities
    268                         CommandExecutor::getEvaluation().state_ = CS_Error;
     268                        CommandExecutor::getEvaluation().state_ = CommandState::Error;
    269269                        AddLanguageEntry("commandexecutorunknownfirstargumentstart", "There is no command or classname starting with");
    270270                        CommandExecutor::getEvaluation().errorMessage_ = "Error: " + GetLocalisation("commandexecutorunknownfirstargumentstart") + " " + CommandExecutor::getArgument(0) + ".";
     
    285285                }
    286286            }
    287             case CS_Function:
     287            case CommandState::Function:
    288288            {
    289289                if (CommandExecutor::getEvaluation().functionclass_)
     
    298298                        {
    299299                            // It's a function
    300                             CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
     300                            CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
    301301                            // Move on to next case
    302302                        }
     
    304304                        {
    305305                            // The second argument is bad
    306                             CommandExecutor::getEvaluation().state_ = CS_Error;
     306                            CommandExecutor::getEvaluation().state_ = CommandState::Error;
    307307                            AddLanguageEntry("commandexecutorunknownsecondargument", "is not a function of");
    308308                            CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(1) + " " + GetLocalisation("commandexecutorunknownsecondargument") + " " + CommandExecutor::getEvaluation().functionclass_->getName() + ".";
     
    326326                                CommandExecutor::getEvaluation().bCommandChanged_ = true;
    327327                            }
    328                             CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
     328                            CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
    329329                            CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " " + CommandExecutor::getEvaluation().function_->getName();
    330330                            if (CommandExecutor::getEvaluation().function_->getParamCount() > 0)
     
    338338                        {
    339339                            // No possibilities
    340                             CommandExecutor::getEvaluation().state_ = CS_Error;
     340                            CommandExecutor::getEvaluation().state_ = CommandState::Error;
    341341                            AddLanguageEntry("commandexecutorunknownsecondargumentstart", "has no function starting with");
    342342                            CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getEvaluation().functionclass_->getName() + " " + GetLocalisation("commandexecutorunknownsecondargumentstart") + " " + CommandExecutor::getArgument(1) + ".";
     
    355355                else
    356356                {
    357                     // There is no classname - move on to CS_ParamPreparation
    358                 }
    359             }
    360             case CS_ParamPreparation:
     357                    // There is no classname - move on to CommandState::ParamPreparation
     358                }
     359            }
     360            case CommandState::ParamPreparation:
    361361            {
    362362                if (CommandExecutor::getEvaluation().function_->getParamCount() == 0 || CommandExecutor::enoughArgumentsGiven(CommandExecutor::getEvaluation().function_))
    363363                {
    364                     CommandExecutor::getEvaluation().state_ = CS_Finished;
     364                    CommandExecutor::getEvaluation().state_ = CommandState::Finished;
    365365                    return;
    366366                }
     
    372372
    373373                    CommandExecutor::createListOfPossibleArguments(CommandExecutor::getLastArgument(), CommandExecutor::getEvaluation().function_, argumentNumber);
    374                     CommandExecutor::getEvaluation().state_ = CS_Params;
     374                    CommandExecutor::getEvaluation().state_ = CommandState::Params;
    375375
    376376                    if (CommandExecutor::getEvaluation().bCommandChanged_)
     
    381381                }
    382382            }
    383             case CS_Params:
     383            case CommandState::Params:
    384384            {
    385385                if (CommandExecutor::getEvaluation().listOfPossibleArguments_.size() == 1)
     
    388388                    CommandExecutor::getEvaluation().argument_ = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()).getString();
    389389                    CommandExecutor::getEvaluation().possibleArgument_ = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()).getString();
    390                     CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
     390                    CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
    391391                    return;
    392392                }
     
    394394                {
    395395                    // The user tries something new - we let him do
    396                     CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
     396                    CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
    397397                    CommandExecutor::getEvaluation().argument_ = CommandExecutor::getLastArgument();
    398398                    return;
     
    409409                    CommandExecutor::getEvaluation().argument_ = CommandExecutor::getCommonBegin(CommandExecutor::getEvaluation().listOfPossibleArguments_);
    410410                    CommandExecutor::getEvaluation().possibleArgument_ = CommandExecutor::getPossibleArgument(CommandExecutor::getLastArgument(), CommandExecutor::getEvaluation().function_, argumentNumber);
    411                     CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
     411                    CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
    412412                    return;
    413413                }
    414414            }
    415             case CS_Finished:
     415            case CommandState::Finished:
    416416            {
    417417                // Nothing more to do
    418418                break;
    419419            }
    420             case CS_Error:
     420            case CommandState::Error:
    421421            {
    422422                // Bad, very bad
Note: See TracChangeset for help on using the changeset viewer.