Changeset 1341 for code/branches/console/src/orxonox
- Timestamp:
- May 21, 2008, 1:33:42 AM (17 years ago)
- Location:
- code/branches/console/src/orxonox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/orxonox/Orxonox.cc
r1334 r1341 54 54 //#include "util/Sleep.h" 55 55 #include "util/ArgReader.h" 56 #include "util/ExprParser.h"57 56 58 57 // core … … 60 59 #include "core/ConsoleCommand.h" 61 60 #include "core/Debug.h" 62 #include "core/Factory.h"63 61 #include "core/Loader.h" 64 62 #include "core/Tickable.h" 65 #include "core/InputBuffer.h"66 63 #include "core/InputManager.h" 67 64 … … 74 71 75 72 // objects and tools 76 #include "tools/Timer.h"77 73 #include "hud/HUD.h" 78 74 //#include "console/InGameConsole.h" … … 85 81 namespace orxonox 86 82 { 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); 116 86 117 87 /** -
code/branches/console/src/orxonox/console/InGameConsole.cc
r1338 r1341 49 49 namespace orxonox 50 50 { 51 ConsoleCommand(InGameConsole, openConsole, AccessLevel::None, true);52 ConsoleCommand(InGameConsole, closeConsole, AccessLevel::None, true);51 SetConsoleCommand(InGameConsole, openConsole, true); 52 SetConsoleCommand(InGameConsole, closeConsole, true); 53 53 54 54 using namespace Ogre; -
code/branches/console/src/orxonox/objects/Ambient.cc
r1064 r1341 47 47 namespace orxonox 48 48 { 49 ConsoleCommand(Ambient, setAmbientLightTest, AccessLevel::Offline, false).setDefaultValues(ColourValue(1, 1, 1, 1));49 SetConsoleCommand(Ambient, setAmbientLightTest, false).setDefaultValues(ColourValue(1, 1, 1, 1)).setAccessLevel(AccessLevel::Offline); 50 50 51 51 CreateFactory(Ambient); -
code/branches/console/src/orxonox/objects/SpaceShip.cc
r1064 r1341 53 53 namespace orxonox 54 54 { 55 ConsoleCommand(SpaceShip, setMaxSpeedTest, AccessLevel::Debug, false);56 ConsoleCommandGeneric(test1, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxSpeed", AccessLevel::Debug), false);57 ConsoleCommandGeneric(test2, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxBlubber", AccessLevel::Debug), false);58 ConsoleCommandGeneric(test3, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setRofl", AccessLevel::Debug), false);55 SetConsoleCommand(SpaceShip, setMaxSpeedTest, false).setAccessLevel(AccessLevel::Debug); 56 SetConsoleCommandGeneric(test1, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxSpeed"), false).setAccessLevel(AccessLevel::Debug); 57 SetConsoleCommandGeneric(test2, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxBlubber"), false).setAccessLevel(AccessLevel::Debug); 58 SetConsoleCommandGeneric(test3, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setRofl"), false).setAccessLevel(AccessLevel::Debug); 59 59 60 60 CreateFactory(SpaceShip); -
code/branches/console/src/orxonox/tools/Timer.cc
r1063 r1341 27 27 */ 28 28 29 #include <set> 30 29 31 #include "OrxonoxStableHeaders.h" 30 32 #include "Timer.h" … … 37 39 namespace orxonox 38 40 { 39 ConsoleCommandShortcutExtern(delay, AccessLevel::None); 41 SetConsoleCommandShortcutExtern(delay); 42 SetConsoleCommandShortcutExtern(killdelays); 43 44 static std::set<StaticTimer*> delaytimerset; 40 45 41 46 /** … … 47 52 { 48 53 StaticTimer *delaytimer = new StaticTimer(); 54 delaytimerset.insert(delaytimer); 55 49 56 ExecutorStatic* delayexecutor = createExecutor(createFunctor(&executeDelayedCommand)); 50 57 delayexecutor->setDefaultValues(delaytimer, command); … … 61 68 CommandExecutor::execute(command); 62 69 delete timer; 70 delaytimerset.erase(timer); 71 } 72 73 /** 74 @brief Kills all delayed commands. 75 */ 76 void killdelays() 77 { 78 for (std::set<StaticTimer*>::iterator it = delaytimerset.begin(); it != delaytimerset.end(); ++it) 79 delete (*it); 80 81 delaytimerset.clear(); 63 82 } 64 83 -
code/branches/console/src/orxonox/tools/Timer.h
r1056 r1341 69 69 class StaticTimer; 70 70 void delay(float delay, const std::string& command); 71 void killdelays(); 71 72 void executeDelayedCommand(StaticTimer* timer, const std::string& command); 72 73
Note: See TracChangeset
for help on using the changeset viewer.