Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 21, 2008, 1:33:42 AM (16 years ago)
Author:
landauf
Message:

big commit, but not much changes in code:

  • put CommandEvaluation into it's own .cc and .h files
  • put some basic ConsoleCommands into ConsoleCommandCompilation.cc and .h
  • created a new class, ConsoleCommand, inheriting from ExecutorStatic, implementing all command-related features that were located in the Executor until now (at the moment only accessLevel_, but more will come - from reto and me)
  • renamed ConsoleCommand-macros to SetConsoleCommand (all related macros were changed the same way)
  • added a new command named "killdelays", that kills all delayed commands. helpful to stop disco ;)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/console/src/orxonox/Orxonox.cc

    r1334 r1341  
    5454//#include "util/Sleep.h"
    5555#include "util/ArgReader.h"
    56 #include "util/ExprParser.h"
    5756
    5857// core
     
    6059#include "core/ConsoleCommand.h"
    6160#include "core/Debug.h"
    62 #include "core/Factory.h"
    6361#include "core/Loader.h"
    6462#include "core/Tickable.h"
    65 #include "core/InputBuffer.h"
    6663#include "core/InputManager.h"
    6764
     
    7471
    7572// objects and tools
    76 #include "tools/Timer.h"
    7773#include "hud/HUD.h"
    7874//#include "console/InGameConsole.h"
     
    8581namespace orxonox
    8682{
    87   ConsoleCommand(Orxonox, exit, AccessLevel::None, true);
    88   ConsoleCommand(Orxonox, slomo, AccessLevel::Offline, true).setDefaultValue(0, 1.0);
    89   ConsoleCommand(Orxonox, setTimeFactor, AccessLevel::Offline, false).setDefaultValue(0, 1.0);
    90 
    91   class Calculator
    92   {
    93   public:
    94     static float calculate(const std::string& calculation)
    95     {
    96       ExprParser expr(calculation);
    97       if (expr.getSuccess())
    98       {
    99         if (expr.getResult() == 42.0)
    100           std::cout << "Greetings from the restaurant at the end of the universe." << std::endl;
    101         // FIXME: insert modifier to display in full precision
    102         std::cout << "Result is: " << expr.getResult() << std::endl;
    103         if (expr.getRemains() != "")
    104           std::cout << "Warning: Expression could not be parsed to the end! Remains: '"
    105               << expr.getRemains() << "'" << std::endl;
    106         return expr.getResult();
    107       }
    108       else
    109       {
    110         std::cout << "Cannot calculate expression: Parse error" << std::endl;
    111         return 0;
    112       }
    113     }
    114   };
    115   ConsoleCommandShortcut(Calculator, calculate, AccessLevel::None);
     83  SetConsoleCommand(Orxonox, exit, true);
     84  SetConsoleCommand(Orxonox, slomo, true).setDefaultValue(0, 1.0).setAccessLevel(AccessLevel::Offline);
     85  SetConsoleCommand(Orxonox, setTimeFactor, false).setDefaultValue(0, 1.0).setAccessLevel(AccessLevel::Offline);
    11686
    11787  /**
Note: See TracChangeset for help on using the changeset viewer.