Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 949 for code


Ignore:
Timestamp:
Mar 29, 2008, 2:30:10 AM (17 years ago)
Author:
landauf
Message:

made CommandExecutor a singleton

Location:
code/branches/core2/src/orxonox/core
Files:
5 edited

Legend:

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

    r948 r949  
    2929#include "ConsoleCommand.h"
    3030#include "util/String.h"
    31 #include "util/SubString.h"
    3231#include "Identifier.h"
    3332#include "Language.h"
     
    4645    ConsoleCommandShortcutGeneric(keyword3, createExecutor((FunctorStatic*)0, "bind", AccessLevel::User));
    4746
    48     SubString CommandExecutor::tokens_s;
    49     std::string CommandExecutor::lastProcessedCommand_s;
    50 
    51     std::list<const std::string*> CommandExecutor::listOfPossibleFunctionClasses_s;
    52     std::list<const std::string*> CommandExecutor::listOfPossibleShortcuts_s;
    53     std::list<const std::string*> CommandExecutor::listOfPossibleFunctions_s;
    54     std::list<const std::string*> CommandExecutor::listOfPossibleConfigValueClasses_s;
    55     std::list<const std::string*> CommandExecutor::listOfPossibleConfigValues_s;
    56     std::list<const std::string*> CommandExecutor::listOfPossibleKeys_s;
    57 
    58     Identifier* CommandExecutor::functionclass_s;
    59     Identifier* CommandExecutor::configvalueclass_s;
    60     ExecutorStatic* CommandExecutor::shortcut_s;
    61     ExecutorStatic* CommandExecutor::function_s;
    62     ConfigValueContainer* CommandExecutor::configvalue_s;
    63     ConfigValueContainer* CommandExecutor::key_s;
    64 
    65     std::string CommandExecutor::errorMessage_s;
    66     CommandExecutor::CommandState CommandExecutor::state_s;
    67 
    68     std::map<std::string, ExecutorStatic*> CommandExecutor::consoleCommandShortcuts_s;
    69     std::map<std::string, ExecutorStatic*> CommandExecutor::consoleCommandShortcuts_LC_s;
     47    CommandExecutor& CommandExecutor::getInstance()
     48    {
     49        static CommandExecutor instance;
     50        return instance;
     51    }
    7052
    7153    bool CommandExecutor::addConsoleCommandShortcut(ExecutorStatic* executor)
    7254    {
    73         CommandExecutor::consoleCommandShortcuts_s[executor->getName()] = executor;
    74         CommandExecutor::consoleCommandShortcuts_LC_s[getLowercase(executor->getName())] = executor;
     55        CommandExecutor::getInstance().consoleCommandShortcuts_s[executor->getName()] = executor;
     56        CommandExecutor::getInstance().consoleCommandShortcuts_LC_s[getLowercase(executor->getName())] = executor;
    7557        return true;
    7658    }
     
    8365    ExecutorStatic* CommandExecutor::getConsoleCommandShortcut(const std::string& name)
    8466    {
    85         std::map<std::string, ExecutorStatic*>::const_iterator it = CommandExecutor::consoleCommandShortcuts_s.find(name);
    86         if (it != CommandExecutor::consoleCommandShortcuts_s.end())
     67        std::map<std::string, ExecutorStatic*>::const_iterator it = CommandExecutor::getInstance().consoleCommandShortcuts_s.find(name);
     68        if (it != CommandExecutor::getInstance().consoleCommandShortcuts_s.end())
    8769            return (*it).second;
    8870        else
     
    9779    ExecutorStatic* CommandExecutor::getLowercaseConsoleCommandShortcut(const std::string& name)
    9880    {
    99         std::map<std::string, ExecutorStatic*>::const_iterator it = CommandExecutor::consoleCommandShortcuts_LC_s.find(name);
    100         if (it != CommandExecutor::consoleCommandShortcuts_LC_s.end())
     81        std::map<std::string, ExecutorStatic*>::const_iterator it = CommandExecutor::getInstance().consoleCommandShortcuts_LC_s.find(name);
     82        if (it != CommandExecutor::getInstance().consoleCommandShortcuts_LC_s.end())
    10183            return (*it).second;
    10284        else
     
    10688    bool CommandExecutor::execute(const std::string& command)
    10789    {
    108         if (CommandExecutor::lastProcessedCommand_s != command)
     90        if (CommandExecutor::getInstance().lastProcessedCommand_s != command)
    10991            CommandExecutor::parse(command);
    11092
    111         CommandExecutor::tokens_s.split(command, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
    112 
    113         switch (CommandExecutor::state_s)
     93        CommandExecutor::getInstance().tokens_s.split(command, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
     94
     95        switch (CommandExecutor::getInstance().state_s)
    11496        {
    11597            case CS_Empty:
     
    122104            case CS_Shortcut_Finished:
    123105                // call the shortcut
    124                 if (CommandExecutor::shortcut_s != 0)
    125                     return CommandExecutor::shortcut_s->parse(CommandExecutor::tokens_s.subSet(1).join());
     106                if (CommandExecutor::getInstance().shortcut_s != 0)
     107                    return CommandExecutor::getInstance().shortcut_s->parse(CommandExecutor::getInstance().tokens_s.subSet(1).join());
    126108                break;
    127109            case CS_Function:
     
    132114            case CS_Function_Finished:
    133115                // call the shortcut
    134                 if (CommandExecutor::function_s != 0)
    135                     return CommandExecutor::function_s->parse(CommandExecutor::tokens_s.subSet(2).join());
     116                if (CommandExecutor::getInstance().function_s != 0)
     117                    return CommandExecutor::getInstance().function_s->parse(CommandExecutor::getInstance().tokens_s.subSet(2).join());
    136118                break;
    137119            case CS_ConfigValueClass:
     
    144126            case CS_ConfigValueFinished:
    145127                // set the config value
    146                 if (CommandExecutor::configvalue_s != 0)
    147                     return CommandExecutor::configvalue_s->parseString(CommandExecutor::tokens_s.subSet(3).join());
     128                if (CommandExecutor::getInstance().configvalue_s != 0)
     129                    return CommandExecutor::getInstance().configvalue_s->parseString(CommandExecutor::getInstance().tokens_s.subSet(3).join());
    148130                break;
    149131            case CS_KeybindKey:
     
    165147    std::string CommandExecutor::complete(const std::string& command)
    166148    {
    167         if (CommandExecutor::lastProcessedCommand_s != command)
     149        if (CommandExecutor::getInstance().lastProcessedCommand_s != command)
    168150            CommandExecutor::parse(command);
    169151
    170         CommandExecutor::tokens_s.split(command, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
     152        CommandExecutor::getInstance().tokens_s.split(command, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
    171153
    172154        std::list<const std::string*> temp;
    173         if (CommandExecutor::state_s == CS_Empty)
    174         {
    175             temp.insert(temp.end(), CommandExecutor::listOfPossibleShortcuts_s.begin(), CommandExecutor::listOfPossibleShortcuts_s.end());
    176             temp.insert(temp.end(), CommandExecutor::listOfPossibleFunctionClasses_s.begin(), CommandExecutor::listOfPossibleFunctionClasses_s.end());
    177         }
    178 
    179         switch (CommandExecutor::state_s)
     155        if (CommandExecutor::getInstance().state_s == CS_Empty)
     156        {
     157            temp.insert(temp.end(), CommandExecutor::getInstance().listOfPossibleShortcuts_s.begin(), CommandExecutor::getInstance().listOfPossibleShortcuts_s.end());
     158            temp.insert(temp.end(), CommandExecutor::getInstance().listOfPossibleFunctionClasses_s.begin(), CommandExecutor::getInstance().listOfPossibleFunctionClasses_s.end());
     159        }
     160
     161        switch (CommandExecutor::getInstance().state_s)
    180162        {
    181163            case CS_Empty:
    182                 return (CommandExecutor::tokens_s.subSet(0, CommandExecutor::tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(temp));
     164                return (CommandExecutor::getInstance().tokens_s.subSet(0, CommandExecutor::getInstance().tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(temp));
    183165                break;
    184166            case CS_FunctionClass_Or_Shortcut_Or_Keyword:
     
    191173                break;
    192174            case CS_Function:
    193                 return (CommandExecutor::tokens_s.subSet(0, CommandExecutor::tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::listOfPossibleFunctions_s));
     175                return (CommandExecutor::getInstance().tokens_s.subSet(0, CommandExecutor::getInstance().tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::getInstance().listOfPossibleFunctions_s));
    194176                break;
    195177            case CS_Function_Params:
     
    200182                break;
    201183            case CS_ConfigValueClass:
    202                 return (CommandExecutor::tokens_s.subSet(0, CommandExecutor::tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::listOfPossibleConfigValueClasses_s));
     184                return (CommandExecutor::getInstance().tokens_s.subSet(0, CommandExecutor::getInstance().tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::getInstance().listOfPossibleConfigValueClasses_s));
    203185                break;
    204186            case CS_ConfigValue:
    205                 return (CommandExecutor::tokens_s.subSet(0, CommandExecutor::tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::listOfPossibleConfigValues_s));
     187                return (CommandExecutor::getInstance().tokens_s.subSet(0, CommandExecutor::getInstance().tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::getInstance().listOfPossibleConfigValues_s));
    206188                break;
    207189            case CS_ConfigValueType:
     
    212194                break;
    213195            case CS_KeybindKey:
    214                 return (CommandExecutor::tokens_s.subSet(0, CommandExecutor::tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::listOfPossibleKeys_s));
     196                return (CommandExecutor::getInstance().tokens_s.subSet(0, CommandExecutor::getInstance().tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::getInstance().listOfPossibleKeys_s));
    215197                break;
    216198            case CS_KeybindCommand:
     
    224206        }
    225207
    226         return CommandExecutor::lastProcessedCommand_s;
     208        return CommandExecutor::getInstance().lastProcessedCommand_s;
    227209    }
    228210
    229211    std::string CommandExecutor::hint(const std::string& command)
    230212    {
    231         if (CommandExecutor::lastProcessedCommand_s != command)
     213        if (CommandExecutor::getInstance().lastProcessedCommand_s != command)
    232214            CommandExecutor::parse(command);
    233215
    234         CommandExecutor::tokens_s.split(command, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
    235 
    236         switch (CommandExecutor::state_s)
     216        CommandExecutor::getInstance().tokens_s.split(command, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
     217
     218        switch (CommandExecutor::getInstance().state_s)
    237219        {
    238220            case CS_Empty:
    239                 return (CommandExecutor::dump(CommandExecutor::listOfPossibleShortcuts_s) + "\n" + CommandExecutor::dump(CommandExecutor::listOfPossibleFunctionClasses_s));
     221                return (CommandExecutor::dump(CommandExecutor::getInstance().listOfPossibleShortcuts_s) + "\n" + CommandExecutor::dump(CommandExecutor::getInstance().listOfPossibleFunctionClasses_s));
    240222                break;
    241223            case CS_FunctionClass_Or_Shortcut_Or_Keyword:
    242224                break;
    243225            case CS_Shortcut_Params:
    244                 if (CommandExecutor::shortcut_s != 0)
    245                     return CommandExecutor::dump(CommandExecutor::shortcut_s);
     226                if (CommandExecutor::getInstance().shortcut_s != 0)
     227                    return CommandExecutor::dump(CommandExecutor::getInstance().shortcut_s);
    246228                break;
    247229            case CS_Shortcut_Finished:
     230                if (CommandExecutor::getInstance().shortcut_s != 0)
     231                    return CommandExecutor::dump(CommandExecutor::getInstance().shortcut_s);
    248232                break;
    249233            case CS_Function:
    250                 return CommandExecutor::dump(CommandExecutor::listOfPossibleFunctions_s);
     234                return CommandExecutor::dump(CommandExecutor::getInstance().listOfPossibleFunctions_s);
    251235                break;
    252236            case CS_Function_Params:
    253                 if (CommandExecutor::function_s != 0)
    254                     return CommandExecutor::dump(CommandExecutor::function_s);
     237                if (CommandExecutor::getInstance().function_s != 0)
     238                    return CommandExecutor::dump(CommandExecutor::getInstance().function_s);
    255239                break;
    256240            case CS_Function_Finished:
     241                if (CommandExecutor::getInstance().function_s != 0)
     242                    return CommandExecutor::dump(CommandExecutor::getInstance().function_s);
    257243                break;
    258244            case CS_ConfigValueClass:
    259                 return CommandExecutor::dump(CommandExecutor::listOfPossibleConfigValueClasses_s);
     245                return CommandExecutor::dump(CommandExecutor::getInstance().listOfPossibleConfigValueClasses_s);
    260246                break;
    261247            case CS_ConfigValue:
    262                 return CommandExecutor::dump(CommandExecutor::listOfPossibleConfigValues_s);
     248                return CommandExecutor::dump(CommandExecutor::getInstance().listOfPossibleConfigValues_s);
    263249                break;
    264250            case CS_ConfigValueType:
    265                 if (CommandExecutor::configvalue_s != 0)
    266                     CommandExecutor::dump(CommandExecutor::configvalue_s);
     251                if (CommandExecutor::getInstance().configvalue_s != 0)
     252                    return CommandExecutor::dump(CommandExecutor::getInstance().configvalue_s);
    267253                break;
    268254            case CS_ConfigValueFinished:
     255                if (CommandExecutor::getInstance().configvalue_s != 0)
     256                    return CommandExecutor::dump(CommandExecutor::getInstance().configvalue_s);
    269257                break;
    270258            case CS_KeybindKey:
    271                 return CommandExecutor::dump(CommandExecutor::listOfPossibleKeys_s);
     259                return CommandExecutor::dump(CommandExecutor::getInstance().listOfPossibleKeys_s);
    272260                break;
    273261            case CS_KeybindCommand:
    274                 if (CommandExecutor::key_s != 0)
    275                     CommandExecutor::dump(CommandExecutor::key_s);
     262                if (CommandExecutor::getInstance().key_s != 0)
     263                    return CommandExecutor::dump(CommandExecutor::getInstance().key_s);
    276264                break;
    277265            case CS_KeybindFinished:
     266                if (CommandExecutor::getInstance().key_s != 0)
     267                    return CommandExecutor::dump(CommandExecutor::getInstance().key_s);
    278268                break;
    279269            case CS_Error:
     
    287277    void CommandExecutor::parse(const std::string& command, bool bInitialize)
    288278    {
    289         CommandExecutor::tokens_s.split((command + CommandExecutor::cursor_s), " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
    290         CommandExecutor::lastProcessedCommand_s = command;
     279        CommandExecutor::getInstance().tokens_s.split((command + COMMAND_EXECUTOR_CURSOR), " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
     280        CommandExecutor::getInstance().lastProcessedCommand_s = command;
    291281
    292282        if (bInitialize)
    293283            CommandExecutor::initialize();
    294284
    295         switch (CommandExecutor::state_s)
     285        switch (CommandExecutor::getInstance().state_s)
    296286        {
    297287            case CS_Empty:
     
    300290                    // We want a hint for the first token
    301291                    // Check if there is already a perfect match
    302                     CommandExecutor::functionclass_s = CommandExecutor::getIdentifierOfPossibleFunctionClass(CommandExecutor::getToken(0));
    303                     CommandExecutor::shortcut_s = CommandExecutor::getExecutorOfPossibleShortcut(CommandExecutor::getToken(0));
    304 
    305                     if ((CommandExecutor::functionclass_s != 0) || (CommandExecutor::shortcut_s != 0))
     292                    CommandExecutor::getInstance().functionclass_s = CommandExecutor::getIdentifierOfPossibleFunctionClass(CommandExecutor::getToken(0));
     293                    CommandExecutor::getInstance().shortcut_s = CommandExecutor::getExecutorOfPossibleShortcut(CommandExecutor::getToken(0));
     294
     295                    if ((CommandExecutor::getInstance().functionclass_s != 0) || (CommandExecutor::getInstance().shortcut_s != 0))
    306296                    {
    307297                        // Yes, there is a class or a shortcut with the searched name
    308298                        // Add a whitespace and continue parsing
    309                         CommandExecutor::state_s = CS_FunctionClass_Or_Shortcut_Or_Keyword;
     299                        CommandExecutor::getInstance().state_s = CS_FunctionClass_Or_Shortcut_Or_Keyword;
    310300                        CommandExecutor::parse(command + " ", false);
    311301                        return;
     
    315305                    CommandExecutor::createListOfPossibleFunctionClasses(CommandExecutor::getToken(0));
    316306                    CommandExecutor::createListOfPossibleShortcuts(CommandExecutor::getToken(0));
    317                     CommandExecutor::state_s = CS_Empty;
    318307                    return;
    319308                }
     
    321310                {
    322311                    // There is at least one argument: Check if it's a shortcut, a classname or a special keyword
    323                     CommandExecutor::state_s = CS_FunctionClass_Or_Shortcut_Or_Keyword;
     312                    CommandExecutor::getInstance().state_s = CS_FunctionClass_Or_Shortcut_Or_Keyword;
    324313                    CommandExecutor::parse(command, false);
    325314                    return;
     
    332321                    {
    333322                        // We want to set a config value
    334                         CommandExecutor::state_s = CS_ConfigValueClass;
     323                        CommandExecutor::getInstance().state_s = CS_ConfigValueClass;
    335324                        CommandExecutor::parse(command, false);
    336325                        return;
     
    339328                    {
    340329                        // We want to set a keybinding
    341                         CommandExecutor::state_s = CS_KeybindKey;
     330                        CommandExecutor::getInstance().state_s = CS_KeybindKey;
    342331                        CommandExecutor::parse(command, false);
    343332                        return;
    344333                    }
    345334
    346                     if (CommandExecutor::functionclass_s == 0)
    347                         CommandExecutor::functionclass_s = CommandExecutor::getIdentifierOfPossibleFunctionClass(CommandExecutor::getToken(0));
    348                     if (CommandExecutor::shortcut_s == 0)
    349                         CommandExecutor::shortcut_s = CommandExecutor::getExecutorOfPossibleShortcut(CommandExecutor::getToken(0));
    350 
    351                     if ((CommandExecutor::functionclass_s == 0) && (CommandExecutor::shortcut_s == 0))
     335                    if (CommandExecutor::getInstance().functionclass_s == 0)
     336                        CommandExecutor::getInstance().functionclass_s = CommandExecutor::getIdentifierOfPossibleFunctionClass(CommandExecutor::getToken(0));
     337                    if (CommandExecutor::getInstance().shortcut_s == 0)
     338                        CommandExecutor::getInstance().shortcut_s = CommandExecutor::getExecutorOfPossibleShortcut(CommandExecutor::getToken(0));
     339
     340                    if ((CommandExecutor::getInstance().functionclass_s == 0) && (CommandExecutor::getInstance().shortcut_s == 0))
    352341                    {
    353342                        // Argument 1 seems to be wrong
    354343                        AddLanguageEntry("CommandExecutor::NoSuchCommandOrClassName", "No such command or classname");
    355                         CommandExecutor::errorMessage_s = (CommandExecutor::getToken(0) + ": " + GetLocalisation("CommandExecutor::NoSuchCommandOrClassName"));
    356                         CommandExecutor::state_s = CS_Error;
    357                         return;
    358                     }
    359                     else if (CommandExecutor::shortcut_s != 0)
     344                        CommandExecutor::getInstance().errorMessage_s = (CommandExecutor::getToken(0) + ": " + GetLocalisation("CommandExecutor::NoSuchCommandOrClassName"));
     345                        CommandExecutor::getInstance().state_s = CS_Error;
     346                        return;
     347                    }
     348                    else if (CommandExecutor::getInstance().shortcut_s != 0)
    360349                    {
    361350                        // Argument 1 is a shortcut: Return the needed parameter types
    362                         CommandExecutor::state_s = CS_Shortcut_Params;
     351                        CommandExecutor::getInstance().state_s = CS_Shortcut_Params;
    363352                        CommandExecutor::parse(command, false);
    364353                        return;
     
    367356                    {
    368357                        // Argument 1 is a classname: Return the possible functions
    369                         CommandExecutor::state_s = CS_Function;
     358                        CommandExecutor::getInstance().state_s = CS_Function;
    370359                        CommandExecutor::parse(command, false);
    371360                        return;
     
    374363                else
    375364                {
    376                     CommandExecutor::state_s = CS_Error;
     365                    CommandExecutor::getInstance().state_s = CS_Error;
    377366                    return;
    378367                }
    379368                break;
    380369            case CS_Shortcut_Params:
    381                 if (CommandExecutor::shortcut_s != 0)
     370                if (CommandExecutor::getInstance().shortcut_s != 0)
    382371                {
    383372                    // Valid command
    384373                    // Check if there are enough parameters
    385                     if (CommandExecutor::enoughParametersGiven(1, CommandExecutor::shortcut_s))
    386                     {
    387                         CommandExecutor::state_s = CS_Shortcut_Finished;
     374                    if (CommandExecutor::enoughParametersGiven(1, CommandExecutor::getInstance().shortcut_s))
     375                    {
     376                        CommandExecutor::getInstance().state_s = CS_Shortcut_Finished;
    388377                        return;
    389378                    }
     
    392381                {
    393382                    // Something is wrong
    394                     CommandExecutor::state_s = CS_Error;
     383                    CommandExecutor::getInstance().state_s = CS_Error;
    395384                    return;
    396385                }
    397386                break;
    398387            case CS_Function:
    399                 if (CommandExecutor::functionclass_s != 0)
     388                if (CommandExecutor::getInstance().functionclass_s != 0)
    400389                {
    401390                    // We have a valid classname
     
    404393                    {
    405394                        // There is a second argument: Check if it's a valid functionname
    406                         CommandExecutor::function_s = CommandExecutor::getExecutorOfPossibleFunction(CommandExecutor::getToken(1), CommandExecutor::functionclass_s);
    407                         if (CommandExecutor::function_s == 0)
     395                        CommandExecutor::getInstance().function_s = CommandExecutor::getExecutorOfPossibleFunction(CommandExecutor::getToken(1), CommandExecutor::getInstance().functionclass_s);
     396                        if (CommandExecutor::getInstance().function_s == 0)
    408397                        {
    409398                            // Argument 2 seems to be wrong
    410399                            AddLanguageEntry("CommandExecutor::NoSuchFunctionnameIn", "No such functionname in");
    411                             CommandExecutor::errorMessage_s = (CommandExecutor::getToken(1) + ": " + GetLocalisation("CommandExecutor::NoSuchFunctionnameIn") + " " + CommandExecutor::functionclass_s->getName());
    412                             CommandExecutor::state_s = CS_Error;
     400                            CommandExecutor::getInstance().errorMessage_s = (CommandExecutor::getToken(1) + ": " + GetLocalisation("CommandExecutor::NoSuchFunctionnameIn") + " " + CommandExecutor::getInstance().functionclass_s->getName());
     401                            CommandExecutor::getInstance().state_s = CS_Error;
    413402                            return;
    414403                        }
     
    416405                        {
    417406                            // Argument 2 seems to be a valid functionname: Get the parameters
    418                             CommandExecutor::state_s = CS_Function_Params;
     407                            CommandExecutor::getInstance().state_s = CS_Function_Params;
    419408                            CommandExecutor::parse(command, false);
    420409                            return;
     
    425414                        // There is no finished second argument
    426415                        // Check if there's already a perfect match
    427                         if (CommandExecutor::tokens_s.size() >= 2)
    428                         {
    429                             CommandExecutor::function_s = CommandExecutor::getExecutorOfPossibleFunction(CommandExecutor::getToken(1), CommandExecutor::functionclass_s);
    430                             if (CommandExecutor::function_s != 0)
     416                        if (CommandExecutor::getInstance().tokens_s.size() >= 2)
     417                        {
     418                            CommandExecutor::getInstance().function_s = CommandExecutor::getExecutorOfPossibleFunction(CommandExecutor::getToken(1), CommandExecutor::getInstance().functionclass_s);
     419                            if (CommandExecutor::getInstance().function_s != 0)
    431420                            {
    432421                                // There is a perfect match: Add a whitespace and continue parsing
    433                                 CommandExecutor::state_s = CS_Function_Params;
     422                                CommandExecutor::getInstance().state_s = CS_Function_Params;
    434423                                CommandExecutor::parse(command + " ", false);
    435424                                return;
     
    438427
    439428                        // No perfect match: Create the list of all possible functions and return
    440                         CommandExecutor::createListOfPossibleFunctions(CommandExecutor::getToken(1), CommandExecutor::functionclass_s);
    441                         CommandExecutor::state_s = CS_Function;
     429                        CommandExecutor::createListOfPossibleFunctions(CommandExecutor::getToken(1), CommandExecutor::getInstance().functionclass_s);
    442430                        return;
    443431                    }
     
    445433                else
    446434                {
    447                     CommandExecutor::state_s = CS_Error;
     435                    CommandExecutor::getInstance().state_s = CS_Error;
    448436                    return;
    449437                }
    450438                break;
    451439            case CS_Function_Params:
    452                 if ((CommandExecutor::functionclass_s != 0) && (CommandExecutor::function_s != 0))
     440                if ((CommandExecutor::getInstance().functionclass_s != 0) && (CommandExecutor::getInstance().function_s != 0))
    453441                {
    454442                    // Valid command
    455443                    // Check if there are enough parameters
    456                     if (CommandExecutor::enoughParametersGiven(2, CommandExecutor::function_s))
    457                     {
    458                         CommandExecutor::state_s = CS_Function_Finished;
     444                    if (CommandExecutor::enoughParametersGiven(2, CommandExecutor::getInstance().function_s))
     445                    {
     446                        CommandExecutor::getInstance().state_s = CS_Function_Finished;
    459447                        return;
    460448                    }
     
    463451                {
    464452                    // Something is wrong
    465                     CommandExecutor::state_s = CS_Error;
     453                    CommandExecutor::getInstance().state_s = CS_Error;
    466454                    return;
    467455                }
     
    475463                    {
    476464                        // There is a second argument: Check if it's a valid classname
    477                         CommandExecutor::configvalueclass_s = CommandExecutor::getIdentifierOfPossibleConfigValueClass(CommandExecutor::getToken(1));
    478                         if (CommandExecutor::configvalueclass_s == 0)
     465                        CommandExecutor::getInstance().configvalueclass_s = CommandExecutor::getIdentifierOfPossibleConfigValueClass(CommandExecutor::getToken(1));
     466                        if (CommandExecutor::getInstance().configvalueclass_s == 0)
    479467                        {
    480468                            // Argument 2 seems to be wrong
    481469                            AddLanguageEntry("CommandExecutor::NoSuchClassWithConfigValues", "No such class with config values");
    482                             CommandExecutor::errorMessage_s = (CommandExecutor::getToken(1) + ": " + GetLocalisation("CommandExecutor::NoSuchClassWithConfigValues"));
    483                             CommandExecutor::state_s = CS_Error;
     470                            CommandExecutor::getInstance().errorMessage_s = (CommandExecutor::getToken(1) + ": " + GetLocalisation("CommandExecutor::NoSuchClassWithConfigValues"));
     471                            CommandExecutor::getInstance().state_s = CS_Error;
    484472                            return;
    485473                        }
     
    487475                        {
    488476                            // Argument 2 seems to be a valid classname: Search for possible config values
    489                             CommandExecutor::state_s = CS_ConfigValue;
     477                            CommandExecutor::getInstance().state_s = CS_ConfigValue;
    490478                            CommandExecutor::parse(command, false);
    491479                            return;
     
    496484                        // There's no finished second argument
    497485                        // Check if there's already a perfect match
    498                         if (CommandExecutor::tokens_s.size() >= 2)
    499                         {
    500                             CommandExecutor::configvalueclass_s = CommandExecutor::getIdentifierOfPossibleConfigValueClass(CommandExecutor::getToken(1));
    501                             if (CommandExecutor::configvalueclass_s != 0)
     486                        if (CommandExecutor::getInstance().tokens_s.size() >= 2)
     487                        {
     488                            CommandExecutor::getInstance().configvalueclass_s = CommandExecutor::getIdentifierOfPossibleConfigValueClass(CommandExecutor::getToken(1));
     489                            if (CommandExecutor::getInstance().configvalueclass_s != 0)
    502490                            {
    503491                                // There is a perfect match: Add a whitespace and continue parsing
    504                                 CommandExecutor::state_s = CS_ConfigValue;
     492                                CommandExecutor::getInstance().state_s = CS_ConfigValue;
    505493                                CommandExecutor::parse(command + " ", false);
    506494                                return;
     
    510498                        // No perfect match: Create the list of all possible classnames and return
    511499                        CommandExecutor::createListOfPossibleConfigValueClasses(CommandExecutor::getToken(1));
    512                         CommandExecutor::state_s = CS_ConfigValueClass;
    513500                        return;
    514501                    }
     
    517504                {
    518505                    // Something is wrong
    519                     CommandExecutor::state_s = CS_Error;
     506                    CommandExecutor::getInstance().state_s = CS_Error;
    520507                    return;
    521508                }
    522509                break;
    523510            case CS_ConfigValue:
    524                 if (((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) || (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)) && (CommandExecutor::configvalueclass_s != 0))
     511                if (((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) || (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)) && (CommandExecutor::getInstance().configvalueclass_s != 0))
    525512                {
    526513                    // Check if there is a third argument
     
    528515                    {
    529516                        // There is a third argument: Check if it's a valid config value
    530                         CommandExecutor::configvalue_s = CommandExecutor::getContainerOfPossibleConfigValue(CommandExecutor::getToken(2), CommandExecutor::configvalueclass_s);
    531                         if (CommandExecutor::configvalue_s == 0)
     517                        CommandExecutor::getInstance().configvalue_s = CommandExecutor::getContainerOfPossibleConfigValue(CommandExecutor::getToken(2), CommandExecutor::getInstance().configvalueclass_s);
     518                        if (CommandExecutor::getInstance().configvalue_s == 0)
    532519                        {
    533520                            // Argument 3 seems to be wrong
    534521                            AddLanguageEntry("CommandExecutor::NoSuchConfigValueIn", "No such config value in");
    535                             CommandExecutor::errorMessage_s = (CommandExecutor::getToken(2) + ": " + GetLocalisation("CommandExecutor::NoSuchConfigValueIn") + " " + CommandExecutor::configvalueclass_s->getName());
    536                             CommandExecutor::state_s = CS_Error;
     522                            CommandExecutor::getInstance().errorMessage_s = (CommandExecutor::getToken(2) + ": " + GetLocalisation("CommandExecutor::NoSuchConfigValueIn") + " " + CommandExecutor::getInstance().configvalueclass_s->getName());
     523                            CommandExecutor::getInstance().state_s = CS_Error;
    537524                            return;
    538525                        }
     
    540527                        {
    541528                            // Argument 3 seems to be a valid config value: Get the type
    542                             CommandExecutor::state_s = CS_ConfigValueType;
     529                            CommandExecutor::getInstance().state_s = CS_ConfigValueType;
    543530                            CommandExecutor::parse(command, false);
    544531                            return;
     
    549536                        // There is no finished third argument
    550537                        // Check if there's already a perfect match
    551                         if (CommandExecutor::tokens_s.size() >= 3)
    552                         {
    553                             CommandExecutor::configvalue_s = CommandExecutor::getContainerOfPossibleConfigValue(CommandExecutor::getToken(2), CommandExecutor::configvalueclass_s);
    554                             if (CommandExecutor::configvalueclass_s != 0)
     538                        if (CommandExecutor::getInstance().tokens_s.size() >= 3)
     539                        {
     540                            CommandExecutor::getInstance().configvalue_s = CommandExecutor::getContainerOfPossibleConfigValue(CommandExecutor::getToken(2), CommandExecutor::getInstance().configvalueclass_s);
     541                            if (CommandExecutor::getInstance().configvalueclass_s != 0)
    555542                            {
    556543                                // There is a perfect match: Add a whitespace and continue parsing
    557                                 CommandExecutor::state_s = CS_ConfigValueType;
     544                                CommandExecutor::getInstance().state_s = CS_ConfigValueType;
    558545                                CommandExecutor::parse(command + " ", false);
    559546                                return;
     
    562549
    563550                        // No perfect match: Create the list of all possible config values
    564                         CommandExecutor::createListOfPossibleConfigValues(CommandExecutor::getToken(2), CommandExecutor::configvalueclass_s);
    565                         CommandExecutor::state_s = CS_ConfigValueType;
     551                        CommandExecutor::createListOfPossibleConfigValues(CommandExecutor::getToken(2), CommandExecutor::getInstance().configvalueclass_s);
    566552                        return;
    567553                    }
     
    570556                {
    571557                    // Something is wrong
    572                     CommandExecutor::state_s = CS_Error;
     558                    CommandExecutor::getInstance().state_s = CS_Error;
    573559                    return;
    574560                }
    575561                break;
    576562            case CS_ConfigValueType:
    577                 if (((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) || (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)) && (CommandExecutor::configvalueclass_s != 0) && (CommandExecutor::configvalue_s != 0))
     563                if (((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) || (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)) && (CommandExecutor::getInstance().configvalueclass_s != 0) && (CommandExecutor::getInstance().configvalue_s != 0))
    578564                {
    579565                    // Valid command
    580566                    // Check if there are enough parameters
    581                     if (CommandExecutor::tokens_s.size() >= 4)
    582                     {
    583                         CommandExecutor::state_s = CS_ConfigValueFinished;
     567                    if (CommandExecutor::getInstance().tokens_s.size() >= 4)
     568                    {
     569                        CommandExecutor::getInstance().state_s = CS_ConfigValueFinished;
    584570                        return;
    585571                    }
     
    588574                {
    589575                    // Something is wrong
    590                     CommandExecutor::state_s = CS_Error;
     576                    CommandExecutor::getInstance().state_s = CS_Error;
    591577                    return;
    592578                }
     
    600586                {
    601587                    // Something is wrong
    602                     CommandExecutor::state_s = CS_Error;
     588                    CommandExecutor::getInstance().state_s = CS_Error;
    603589                    return;
    604590                }
     
    609595                    // Valid command
    610596                    // Check if there are enough parameters
    611                     if (CommandExecutor::tokens_s.size() >= 3)
    612                     {
    613                         CommandExecutor::state_s = CS_KeybindFinished;
     597                    if (CommandExecutor::getInstance().tokens_s.size() >= 3)
     598                    {
     599                        CommandExecutor::getInstance().state_s = CS_KeybindFinished;
    614600                        return;
    615601                    }
     
    619605                {
    620606                    // Something is wrong
    621                     CommandExecutor::state_s = CS_Error;
     607                    CommandExecutor::getInstance().state_s = CS_Error;
    622608                    return;
    623609                }
     
    643629    void CommandExecutor::initialize()
    644630    {
    645         CommandExecutor::listOfPossibleFunctionClasses_s.clear();
    646         CommandExecutor::listOfPossibleShortcuts_s.clear();
    647         CommandExecutor::listOfPossibleFunctions_s.clear();
    648         CommandExecutor::listOfPossibleConfigValueClasses_s.clear();
    649         CommandExecutor::listOfPossibleConfigValues_s.clear();
    650         CommandExecutor::listOfPossibleKeys_s.clear();
    651 
    652         CommandExecutor::functionclass_s = 0;
    653         CommandExecutor::configvalueclass_s = 0;
    654         CommandExecutor::shortcut_s = 0;
    655         CommandExecutor::function_s = 0;
    656         CommandExecutor::configvalue_s = 0;
    657         CommandExecutor::key_s = 0;
    658 
    659         CommandExecutor::errorMessage_s = "";
    660         CommandExecutor::state_s = CS_Empty;
     631        CommandExecutor::getInstance().listOfPossibleFunctionClasses_s.clear();
     632        CommandExecutor::getInstance().listOfPossibleShortcuts_s.clear();
     633        CommandExecutor::getInstance().listOfPossibleFunctions_s.clear();
     634        CommandExecutor::getInstance().listOfPossibleConfigValueClasses_s.clear();
     635        CommandExecutor::getInstance().listOfPossibleConfigValues_s.clear();
     636        CommandExecutor::getInstance().listOfPossibleKeys_s.clear();
     637
     638        CommandExecutor::getInstance().functionclass_s = 0;
     639        CommandExecutor::getInstance().configvalueclass_s = 0;
     640        CommandExecutor::getInstance().shortcut_s = 0;
     641        CommandExecutor::getInstance().function_s = 0;
     642        CommandExecutor::getInstance().configvalue_s = 0;
     643        CommandExecutor::getInstance().key_s = 0;
     644
     645        CommandExecutor::getInstance().errorMessage_s = "";
     646        CommandExecutor::getInstance().state_s = CS_Empty;
    661647    }
    662648
     
    665651        // Because we added a cursor we have +1 arguments
    666652        // There are num arguments given if there are at least num arguments + one cursor
    667         return (CommandExecutor::tokens_s.size() >= (num + 1));
     653        return (CommandExecutor::getInstance().tokens_s.size() >= (num + 1));
    668654    }
    669655
     
    671657    {
    672658        // Because we added a cursor we have +1 arguments
    673         if (CommandExecutor::tokens_s.size() >= 1)
    674             return (CommandExecutor::tokens_s.size() - 1);
     659        if (CommandExecutor::getInstance().tokens_s.size() >= 1)
     660            return (CommandExecutor::getInstance().tokens_s.size() - 1);
    675661        else
    676662            return 0;
     
    679665    std::string CommandExecutor::getToken(unsigned int index)
    680666    {
    681         if ((index >= 0) && (index < (CommandExecutor::tokens_s.size() - 1)))
    682             return CommandExecutor::tokens_s[index];
    683         else if (index == (CommandExecutor::tokens_s.size() - 1))
    684             return CommandExecutor::tokens_s[index].substr(0, CommandExecutor::tokens_s[index].size() - 1);
     667        if ((index >= 0) && (index < (CommandExecutor::getInstance().tokens_s.size() - 1)))
     668            return CommandExecutor::getInstance().tokens_s[index];
     669        else if (index == (CommandExecutor::getInstance().tokens_s.size() - 1))
     670            return CommandExecutor::getInstance().tokens_s[index].substr(0, CommandExecutor::getInstance().tokens_s[index].size() - 1);
    685671        else
    686672            return "";
     
    697683                break;
    698684        }
    699         return (CommandExecutor::tokens_s.size() >= neededParams);
     685        return (CommandExecutor::getInstance().tokens_s.size() >= neededParams);
    700686    }
    701687
     
    708694                if ((*it).first.find(getLowercase(fragment)) == 0)
    709695                {
    710                     CommandExecutor::listOfPossibleFunctionClasses_s.push_back(&(*it).first);
     696                    CommandExecutor::getInstance().listOfPossibleFunctionClasses_s.push_back(&(*it).first);
    711697                }
    712698            }
    713699        }
    714700
    715         CommandExecutor::listOfPossibleFunctionClasses_s.sort(CommandExecutor::compareStringsInList);
     701        CommandExecutor::getInstance().listOfPossibleFunctionClasses_s.sort(CommandExecutor::compareStringsInList);
    716702    }
    717703
     
    722708            if ((*it).first.find(getLowercase(fragment)) == 0)
    723709            {
    724                 CommandExecutor::listOfPossibleShortcuts_s.push_back(&(*it).first);
     710                CommandExecutor::getInstance().listOfPossibleShortcuts_s.push_back(&(*it).first);
    725711            }
    726712        }
    727713
    728         CommandExecutor::listOfPossibleShortcuts_s.sort(CommandExecutor::compareStringsInList);
     714        CommandExecutor::getInstance().listOfPossibleShortcuts_s.sort(CommandExecutor::compareStringsInList);
    729715    }
    730716
     
    735721            if ((*it).first.find(getLowercase(fragment)) == 0)
    736722            {
    737                 CommandExecutor::listOfPossibleFunctions_s.push_back(&(*it).first);
     723                CommandExecutor::getInstance().listOfPossibleFunctions_s.push_back(&(*it).first);
    738724            }
    739725        }
    740726
    741         CommandExecutor::listOfPossibleFunctions_s.sort(CommandExecutor::compareStringsInList);
     727        CommandExecutor::getInstance().listOfPossibleFunctions_s.sort(CommandExecutor::compareStringsInList);
    742728    }
    743729
     
    750736                if ((*it).first.find(getLowercase(fragment)) == 0)
    751737                {
    752                     CommandExecutor::listOfPossibleConfigValueClasses_s.push_back(&(*it).first);
     738                    CommandExecutor::getInstance().listOfPossibleConfigValueClasses_s.push_back(&(*it).first);
    753739                }
    754740            }
    755741        }
    756742
    757         CommandExecutor::listOfPossibleConfigValueClasses_s.sort(CommandExecutor::compareStringsInList);
     743        CommandExecutor::getInstance().listOfPossibleConfigValueClasses_s.sort(CommandExecutor::compareStringsInList);
    758744    }
    759745
     
    764750            if ((*it).first.find(getLowercase(fragment)) == 0)
    765751            {
    766                 CommandExecutor::listOfPossibleConfigValues_s.push_back(&(*it).first);
     752                CommandExecutor::getInstance().listOfPossibleConfigValues_s.push_back(&(*it).first);
    767753            }
    768754        }
    769755
    770         CommandExecutor::listOfPossibleConfigValues_s.sort(CommandExecutor::compareStringsInList);
     756        CommandExecutor::getInstance().listOfPossibleConfigValues_s.sort(CommandExecutor::compareStringsInList);
    771757    }
    772758
     
    775761        // todo
    776762
    777         CommandExecutor::listOfPossibleKeys_s.sort(CommandExecutor::compareStringsInList);
     763        CommandExecutor::getInstance().listOfPossibleKeys_s.sort(CommandExecutor::compareStringsInList);
    778764    }
    779765
  • code/branches/core2/src/orxonox/core/CommandExecutor.h

    r948 r949  
    3333#include <list>
    3434
     35#include "util/SubString.h"
    3536#include "CorePrereqs.h"
    3637
    37 class SubString;
     38#define COMMAND_EXECUTOR_CURSOR '$'
    3839
    3940namespace orxonox
     
    7071
    7172            /** @brief Returns the map that stores all console commands. @return The const_iterator */
    72             static inline const std::map<std::string, ExecutorStatic*>& getConsoleCommandShortcutMap() { return CommandExecutor::consoleCommandShortcuts_s; }
     73            static inline const std::map<std::string, ExecutorStatic*>& getConsoleCommandShortcutMap() { return CommandExecutor::getInstance().consoleCommandShortcuts_s; }
    7374            /** @brief Returns a const_iterator to the beginning of the map that stores all console commands. @return The const_iterator */
    74             static inline std::map<std::string, ExecutorStatic*>::const_iterator getConsoleCommandShortcutMapBegin() { return CommandExecutor::consoleCommandShortcuts_s.begin(); }
     75            static inline std::map<std::string, ExecutorStatic*>::const_iterator getConsoleCommandShortcutMapBegin() { return CommandExecutor::getInstance().consoleCommandShortcuts_s.begin(); }
    7576            /** @brief Returns a const_iterator to the end of the map that stores all console commands. @return The const_iterator */
    76             static inline std::map<std::string, ExecutorStatic*>::const_iterator getConsoleCommandShortcutMapEnd() { return CommandExecutor::consoleCommandShortcuts_s.end(); }
     77            static inline std::map<std::string, ExecutorStatic*>::const_iterator getConsoleCommandShortcutMapEnd() { return CommandExecutor::getInstance().consoleCommandShortcuts_s.end(); }
    7778
    7879            /** @brief Returns the map that stores all console commands with their names in lowercase. @return The const_iterator */
    79             static inline const std::map<std::string, ExecutorStatic*>& getLowercaseConsoleCommandShortcutMap() { return CommandExecutor::consoleCommandShortcuts_LC_s; }
     80            static inline const std::map<std::string, ExecutorStatic*>& getLowercaseConsoleCommandShortcutMap() { return CommandExecutor::getInstance().consoleCommandShortcuts_LC_s; }
    8081            /** @brief Returns a const_iterator to the beginning of the map that stores all console commands with their names in lowercase. @return The const_iterator */
    81             static inline std::map<std::string, ExecutorStatic*>::const_iterator getLowercaseConsoleCommandShortcutMapBegin() { return CommandExecutor::consoleCommandShortcuts_LC_s.begin(); }
     82            static inline std::map<std::string, ExecutorStatic*>::const_iterator getLowercaseConsoleCommandShortcutMapBegin() { return CommandExecutor::getInstance().consoleCommandShortcuts_LC_s.begin(); }
    8283            /** @brief Returns a const_iterator to the end of the map that stores all console commands with their names in lowercase. @return The const_iterator */
    83             static inline std::map<std::string, ExecutorStatic*>::const_iterator getLowercaseConsoleCommandShortcutMapEnd() { return CommandExecutor::consoleCommandShortcuts_LC_s.end(); }
     84            static inline std::map<std::string, ExecutorStatic*>::const_iterator getLowercaseConsoleCommandShortcutMapEnd() { return CommandExecutor::getInstance().consoleCommandShortcuts_LC_s.end(); }
    8485
    8586        private:
     87            static CommandExecutor& getInstance();
     88
    8689            static void parse(const std::string& command, bool bInitialize = true);
    8790            static void initialize();
     
    116119            static ConfigValueContainer* getContainerOfPossibleKey(const std::string& name);
    117120
    118             static const char cursor_s = '$';
     121            std::string lastProcessedCommand_s;
     122            SubString tokens_s;
     123            std::list<const std::string*> listOfPossibleFunctionClasses_s;
     124            std::list<const std::string*> listOfPossibleShortcuts_s;
     125            std::list<const std::string*> listOfPossibleFunctions_s;
     126            std::list<const std::string*> listOfPossibleConfigValueClasses_s;
     127            std::list<const std::string*> listOfPossibleConfigValues_s;
     128            std::list<const std::string*> listOfPossibleKeys_s;
    119129
    120             static std::string lastProcessedCommand_s;
    121             static SubString tokens_s;
    122             static std::list<const std::string*> listOfPossibleFunctionClasses_s;
    123             static std::list<const std::string*> listOfPossibleShortcuts_s;
    124             static std::list<const std::string*> listOfPossibleFunctions_s;
    125             static std::list<const std::string*> listOfPossibleConfigValueClasses_s;
    126             static std::list<const std::string*> listOfPossibleConfigValues_s;
    127             static std::list<const std::string*> listOfPossibleKeys_s;
     130            Identifier* functionclass_s;
     131            Identifier* configvalueclass_s;
     132            ExecutorStatic* shortcut_s;
     133            ExecutorStatic* function_s;
     134            ConfigValueContainer* configvalue_s;
     135            ConfigValueContainer* key_s;
    128136
    129             static Identifier* functionclass_s;
    130             static Identifier* configvalueclass_s;
    131             static ExecutorStatic* shortcut_s;
    132             static ExecutorStatic* function_s;
    133             static ConfigValueContainer* configvalue_s;
    134             static ConfigValueContainer* key_s;
     137            std::string errorMessage_s;
     138            CommandState state_s;
    135139
    136             static std::string errorMessage_s;
    137             static CommandState state_s;
    138 
    139             static std::map<std::string, ExecutorStatic*> consoleCommandShortcuts_s;
    140             static std::map<std::string, ExecutorStatic*> consoleCommandShortcuts_LC_s;
     140            std::map<std::string, ExecutorStatic*> consoleCommandShortcuts_s;
     141            std::map<std::string, ExecutorStatic*> consoleCommandShortcuts_LC_s;
    141142    };
    142143}
  • code/branches/core2/src/orxonox/core/ConfigValueContainer.cc

    r947 r949  
    921921        std::ofstream file;
    922922        file.open(filename.c_str(), std::fstream::out);
     923        file.setf(std::ios::fixed, std::ios::floatfield);
     924        file.precision(6);
    923925
    924926        if (!file.is_open())
  • code/branches/core2/src/orxonox/core/ConsoleCommand.h

    r947 r949  
    4040
    4141#define ConsoleCommandGeneric(fakevariable, classname, executor, bCreateShortcut) \
    42 //    Executor& fakevariable = ClassManager<classname>::getIdentifier()->addConsoleCommand((ExecutorStatic*)executor, bCreateShortcut)
     42    Executor& fakevariable = ClassManager<classname>::getIdentifier()->addConsoleCommand((ExecutorStatic*)executor, bCreateShortcut)
    4343
    4444
     
    4747
    4848#define ConsoleCommandShortcutGeneric(fakevariable, executor) \
    49 //    bool fakevariable = CommandExecutor::addConsoleCommandShortcut((ExecutorStatic*)executor)
     49    bool fakevariable = CommandExecutor::addConsoleCommandShortcut((ExecutorStatic*)executor)
    5050
    5151
  • code/branches/core2/src/orxonox/core/OutputHandler.h

    r947 r949  
    6161            /** @brief Puts some text on the outstream. @param text The text */
    6262            static inline void log(const std::string& text)
    63                 { OutputHandler::getOutStream().output(text); }
     63                { OutputHandler::getOutStream().setOutputLevel(0); OutputHandler::getOutStream().output(text); }
    6464
    6565            /** @brief Returns a reference to the logfile. @return The logfile */
Note: See TracChangeset for help on using the changeset viewer.