[Orxonox-commit 2512] r7219 - in code/branches/consolecommands3/src: libraries/core libraries/core/command libraries/core/input libraries/network libraries/tools modules/designtools modules/objects/triggers modules/overlays/hud orxonox orxonox/controllers orxonox/gamestates orxonox/gametypes orxonox/overlays
landauf at orxonox.net
landauf at orxonox.net
Thu Aug 26 00:09:13 CEST 2010
Author: landauf
Date: 2010-08-26 00:09:12 +0200 (Thu, 26 Aug 2010)
New Revision: 7219
Modified:
code/branches/consolecommands3/src/libraries/core/ConfigFileManager.cc
code/branches/consolecommands3/src/libraries/core/Core.cc
code/branches/consolecommands3/src/libraries/core/CorePrereqs.h
code/branches/consolecommands3/src/libraries/core/GUIManager.cc
code/branches/consolecommands3/src/libraries/core/Game.cc
code/branches/consolecommands3/src/libraries/core/GraphicsManager.cc
code/branches/consolecommands3/src/libraries/core/GraphicsManager.h
code/branches/consolecommands3/src/libraries/core/command/ConsoleCommandCompilation.cc
code/branches/consolecommands3/src/libraries/core/command/IRC.cc
code/branches/consolecommands3/src/libraries/core/command/Shell.cc
code/branches/consolecommands3/src/libraries/core/command/TclBind.cc
code/branches/consolecommands3/src/libraries/core/command/TclThreadManager.cc
code/branches/consolecommands3/src/libraries/core/input/InputManager.cc
code/branches/consolecommands3/src/libraries/core/input/KeyBinderManager.cc
code/branches/consolecommands3/src/libraries/core/input/KeyDetector.cc
code/branches/consolecommands3/src/libraries/core/input/KeyDetector.h
code/branches/consolecommands3/src/libraries/network/Host.cc
code/branches/consolecommands3/src/libraries/network/Host.h
code/branches/consolecommands3/src/libraries/tools/Timer.cc
code/branches/consolecommands3/src/modules/designtools/ScreenshotManager.cc
code/branches/consolecommands3/src/modules/designtools/SkyboxGenerator.cc
code/branches/consolecommands3/src/modules/objects/triggers/Trigger.cc
code/branches/consolecommands3/src/modules/overlays/hud/GametypeStatus.cc
code/branches/consolecommands3/src/modules/overlays/hud/GametypeStatus.h
code/branches/consolecommands3/src/orxonox/ChatInputHandler.cc
code/branches/consolecommands3/src/orxonox/Test.cc
code/branches/consolecommands3/src/orxonox/controllers/ArtificialController.cc
code/branches/consolecommands3/src/orxonox/controllers/HumanController.cc
code/branches/consolecommands3/src/orxonox/controllers/NewHumanController.cc
code/branches/consolecommands3/src/orxonox/gamestates/GSMainMenu.cc
code/branches/consolecommands3/src/orxonox/gamestates/GSRoot.cc
code/branches/consolecommands3/src/orxonox/gametypes/Gametype.cc
code/branches/consolecommands3/src/orxonox/gametypes/Gametype.h
code/branches/consolecommands3/src/orxonox/overlays/InGameConsole.cc
code/branches/consolecommands3/src/orxonox/overlays/OrxonoxOverlay.cc
code/branches/consolecommands3/src/orxonox/overlays/OverlayGroup.cc
Log:
adapted all console commands to the new interface
Modified: code/branches/consolecommands3/src/libraries/core/ConfigFileManager.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/ConfigFileManager.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/ConfigFileManager.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -424,25 +424,37 @@
// SettingsConfigFile //
////////////////////////
+ static const std::string __CC_load_name = "reloadSettings";
+ static const std::string __CC_setFilename_name = "setSettingsFile";
+ static const std::string __CC_config_name = "config";
+ static const std::string __CC_tconfig_name = "tconfig";
+ static const std::string __CC_getConfig_name = "getConfig";
+
+ _SetConsoleCommand(__CC_load_name, &ConfigFile::load);
+ _SetConsoleCommand(__CC_setFilename_name, &SettingsConfigFile::setFilename);
+ _SetConsoleCommand(__CC_config_name, &SettingsConfigFile::config).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
+ _SetConsoleCommand(__CC_tconfig_name, &SettingsConfigFile::tconfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
+ _SetConsoleCommand(__CC_getConfig_name, &SettingsConfigFile::getConfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries());
+
SettingsConfigFile* SettingsConfigFile::singletonPtr_s = 0;
SettingsConfigFile::SettingsConfigFile(const std::string& filename)
: ConfigFile(filename)
{
- ConsoleCommand* command = createConsoleCommand(createFunctor(&ConfigFile::load, this), "reloadSettings");
- CommandExecutor::addConsoleCommandShortcut(command);
- command = createConsoleCommand(createFunctor(&SettingsConfigFile::setFilename, this), "setSettingsFile");
- CommandExecutor::addConsoleCommandShortcut(command);
- command = createConsoleCommand(createFunctor(&SettingsConfigFile::config, this), "config");
- CommandExecutor::addConsoleCommandShortcut(command).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
- command = createConsoleCommand(createFunctor(&SettingsConfigFile::tconfig, this), "tconfig");
- CommandExecutor::addConsoleCommandShortcut(command).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
- command = createConsoleCommand(createFunctor(&SettingsConfigFile::getConfig, this), "getConfig");
- CommandExecutor::addConsoleCommandShortcut(command).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries());
+ _ModifyConsoleCommand(__CC_load_name).setObject(this);
+ _ModifyConsoleCommand(__CC_setFilename_name).setObject(this);
+ _ModifyConsoleCommand(__CC_config_name).setObject(this);
+ _ModifyConsoleCommand(__CC_tconfig_name).setObject(this);
+ _ModifyConsoleCommand(__CC_getConfig_name).setObject(this);
}
SettingsConfigFile::~SettingsConfigFile()
{
+ _ModifyConsoleCommand(__CC_load_name).setObject(0);
+ _ModifyConsoleCommand(__CC_setFilename_name).setObject(0);
+ _ModifyConsoleCommand(__CC_config_name).setObject(0);
+ _ModifyConsoleCommand(__CC_tconfig_name).setObject(0);
+ _ModifyConsoleCommand(__CC_getConfig_name).setObject(0);
}
void SettingsConfigFile::load()
Modified: code/branches/consolecommands3/src/libraries/core/Core.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/Core.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/Core.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -65,7 +65,7 @@
#include "Identifier.h"
#include "Language.h"
#include "LuaState.h"
-#include "command/CommandExecutor.h"
+#include "command/ConsoleCommand.h"
#include "command/IOConsole.h"
#include "command/TclBind.h"
#include "command/TclThreadManager.h"
@@ -87,7 +87,7 @@
// Cleanup guard for identifier destruction (incl. XMLPort, configValues, consoleCommands)
: identifierDestroyer_(Identifier::destroyAllIdentifiers)
// Cleanup guard for external console commands that don't belong to an Identifier
- , consoleCommandDestroyer_(CommandExecutor::destroyExternalCommands)
+ , consoleCommandDestroyer_(_ConsoleCommand::destroyAll)
, bGraphicsLoaded_(false)
, bStartIOConsole_(true)
{
Modified: code/branches/consolecommands3/src/libraries/core/CorePrereqs.h
===================================================================
--- code/branches/consolecommands3/src/libraries/core/CorePrereqs.h 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/CorePrereqs.h 2010-08-25 22:09:12 UTC (rev 7219)
@@ -193,7 +193,7 @@
class ArgumentCompleter;
class ArgumentCompletionListElement;
class CommandEvaluation;
- class ConsoleCommand;
+ class _ConsoleCommand;
class Executor;
template <class T>
class ExecutorMember;
Modified: code/branches/consolecommands3/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/GUIManager.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/GUIManager.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -70,7 +70,7 @@
{
static void key_esc()
{ GUIManager::getInstance().keyESC(); }
- SetConsoleCommandShortcutExternAlias(key_esc, "keyESC");
+ _SetConsoleCommand("keyESC", &key_esc);
class CEGUILogger : public CEGUI::DefaultLogger
{
@@ -98,8 +98,8 @@
GUIManager* GUIManager::singletonPtr_s = 0;
- SetConsoleCommandShortcut(GUIManager, showGUI).accessLevel(AccessLevel::User).defaultValue(1, false).defaultValue(2, true);
- SetConsoleCommandShortcut(GUIManager, hideGUI).accessLevel(AccessLevel::User);
+ _SetConsoleCommand("showGUI", &GUIManager::showGUI).defaultValue(1, false).defaultValue(2, true);
+ _SetConsoleCommand("hideGUI", &GUIManager::hideGUI);
/**
@brief
Modified: code/branches/consolecommands3/src/libraries/core/Game.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/Game.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/Game.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -56,13 +56,13 @@
{
static void stop_game()
{ Game::getInstance().stop(); }
- SetConsoleCommandShortcutExternAlias(stop_game, "exit");
+ _SetConsoleCommand("exit", &stop_game);
static void printFPS()
{ COUT(0) << Game::getInstance().getAvgFPS() << std::endl; }
- SetConsoleCommandShortcutExternAlias(printFPS, "printFPS");
+ _SetConsoleCommand("printFPS", &printFPS);
static void printTickTime()
{ COUT(0) << Game::getInstance().getAvgTickTime() << std::endl; }
- SetConsoleCommandShortcutExternAlias(printTickTime, "printTickTime");
+ _SetConsoleCommand("printTickTime", &printTickTime);
std::map<std::string, GameStateInfo> Game::gameStateDeclarations_s;
Game* Game::singletonPtr_s = 0;
Modified: code/branches/consolecommands3/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/GraphicsManager.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/GraphicsManager.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -64,6 +64,9 @@
namespace orxonox
{
+ static const std::string __CC_printScreen_name = "printScreen";
+ _DeclareConsoleCommand(__CC_printScreen_name, &prototype::void__void);
+
class OgreWindowEventListener : public Ogre::WindowEventListener
{
public:
@@ -130,7 +133,7 @@
Loader::unload(debugOverlay_.get());
Ogre::WindowEventUtilities::removeWindowEventListener(renderWindow_, ogreWindowEventListener_.get());
- // TODO: Destroy the console command
+ _ModifyConsoleCommand(__CC_printScreen_name).resetFunction();
// Undeclare the resources
Loader::unload(resources_.get());
@@ -320,8 +323,7 @@
Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(Ogre::MIP_UNLIMITED);
// add console commands
- ccPrintScreen_ = createConsoleCommand(createFunctor(&GraphicsManager::printScreen, this), "printScreen");
- CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_);
+ _ModifyConsoleCommand(__CC_printScreen_name).setFunction(&GraphicsManager::printScreen, this);
}
void GraphicsManager::loadDebugOverlay()
Modified: code/branches/consolecommands3/src/libraries/core/GraphicsManager.h
===================================================================
--- code/branches/consolecommands3/src/libraries/core/GraphicsManager.h 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/GraphicsManager.h 2010-08-25 22:09:12 UTC (rev 7219)
@@ -113,9 +113,6 @@
int ogreLogLevelNormal_; //!< Corresponding Orxonox debug level for LL_NORMAL
int ogreLogLevelCritical_; //!< Corresponding Orxonox debug level for LL_CRITICAL
- // console commands
- ConsoleCommand* ccPrintScreen_;
-
static GraphicsManager* singletonPtr_s; //!< Pointer to the Singleton
};
}
Modified: code/branches/consolecommands3/src/libraries/core/command/ConsoleCommandCompilation.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/command/ConsoleCommandCompilation.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/command/ConsoleCommandCompilation.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -36,18 +36,19 @@
#include "util/ExprParser.h"
#include "util/StringUtils.h"
#include "ConsoleCommand.h"
+#include "CommandExecutor.h"
namespace orxonox
{
- SetConsoleCommandShortcutExtern(source).argumentCompleter(0, autocompletion::files());
- SetConsoleCommandShortcutExtern(echo);
- SetConsoleCommandShortcutExtern(puts);
+ _SetConsoleCommand("source", source).argumentCompleter(0, autocompletion::files());
+ _SetConsoleCommand("echo", echo);
+ _SetConsoleCommand("puts", puts);
- SetConsoleCommandShortcutExtern(read).argumentCompleter(0, autocompletion::files());
- SetConsoleCommandShortcutExtern(append).argumentCompleter(0, autocompletion::files());
- SetConsoleCommandShortcutExtern(write).argumentCompleter(0, autocompletion::files());
+ _SetConsoleCommand("read", read).argumentCompleter(0, autocompletion::files());
+ _SetConsoleCommand("append", append).argumentCompleter(0, autocompletion::files());
+ _SetConsoleCommand("write", write).argumentCompleter(0, autocompletion::files());
- SetConsoleCommandShortcutExtern(calculate);
+ _SetConsoleCommand("calculate", calculate);
void source(const std::string& filename)
{
Modified: code/branches/consolecommands3/src/libraries/core/command/IRC.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/command/IRC.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/command/IRC.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -41,9 +41,9 @@
{
static const unsigned int IRC_TCL_THREADID = 1421421421;
- SetConsoleCommand(IRC, say, true).accessLevel(AccessLevel::User);
- SetConsoleCommand(IRC, msg, false).accessLevel(AccessLevel::User);
- SetConsoleCommand(IRC, nick, false).accessLevel(AccessLevel::User);
+ _SetConsoleCommand("IRC", "say", &IRC::say);
+ _SetConsoleCommand("IRC", "msg", &IRC::msg);
+ _SetConsoleCommand("IRC", "nick", &IRC::nick);
IRC::IRC()
{
Modified: code/branches/consolecommands3/src/libraries/core/command/Shell.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/command/Shell.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/command/Shell.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -39,11 +39,11 @@
namespace orxonox
{
- SetConsoleCommandShortcut(OutputHandler, log);
- SetConsoleCommandShortcut(OutputHandler, error);
- SetConsoleCommandShortcut(OutputHandler, warning);
- SetConsoleCommandShortcut(OutputHandler, info);
- SetConsoleCommandShortcut(OutputHandler, debug);
+ _SetConsoleCommand("log", OutputHandler::log );
+ _SetConsoleCommand("error", OutputHandler::error );
+ _SetConsoleCommand("warning", OutputHandler::warning);
+ _SetConsoleCommand("info", OutputHandler::info );
+ _SetConsoleCommand("debug", OutputHandler::debug );
Shell::Shell(const std::string& consoleName, bool bScrollable)
: OutputListener(consoleName)
Modified: code/branches/consolecommands3/src/libraries/core/command/TclBind.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/command/TclBind.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/command/TclBind.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -43,8 +43,8 @@
namespace orxonox
{
- SetConsoleCommandShortcut(TclBind, tcl);
- SetConsoleCommandShortcut(TclBind, bgerror);
+ _SetConsoleCommand("tcl", &TclBind::tcl);
+ _SetConsoleCommand("bgerror", &TclBind::bgerror);
TclBind* TclBind::singletonPtr_s = 0;
Modified: code/branches/consolecommands3/src/libraries/core/command/TclThreadManager.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/command/TclThreadManager.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/command/TclThreadManager.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -49,13 +49,13 @@
{
const float TCLTHREADMANAGER_MAX_CPU_USAGE = 0.50f;
- SetConsoleCommandShortcutAlias(TclThreadManager, execute, "tclexecute").argumentCompleter(0, autocompletion::tclthreads());
- SetConsoleCommandShortcutAlias(TclThreadManager, query, "tclquery" ).argumentCompleter(0, autocompletion::tclthreads());
- SetConsoleCommand(TclThreadManager, create, false);
- SetConsoleCommand(TclThreadManager, destroy, false).argumentCompleter(0, autocompletion::tclthreads());
- SetConsoleCommand(TclThreadManager, execute, false).argumentCompleter(0, autocompletion::tclthreads());
- SetConsoleCommand(TclThreadManager, query, false).argumentCompleter(0, autocompletion::tclthreads());
- SetConsoleCommand(TclThreadManager, source, false).argumentCompleter(0, autocompletion::tclthreads());
+ _SetConsoleCommand("tclexecute", &TclThreadManager::execute).argumentCompleter(0, autocompletion::tclthreads());
+ _SetConsoleCommand("tclquery", &TclThreadManager::query ).argumentCompleter(0, autocompletion::tclthreads());
+ _SetConsoleCommand("TclThreadManager", "create", &TclThreadManager::create);
+ _SetConsoleCommand("TclThreadManager", "destroy", &TclThreadManager::destroy).argumentCompleter(0, autocompletion::tclthreads());
+ _SetConsoleCommand("TclThreadManager", "execute", &TclThreadManager::execute).argumentCompleter(0, autocompletion::tclthreads());
+ _SetConsoleCommand("TclThreadManager", "query", &TclThreadManager::query ).argumentCompleter(0, autocompletion::tclthreads());
+ _SetConsoleCommand("TclThreadManager", "source", &TclThreadManager::source ).argumentCompleter(0, autocompletion::tclthreads());
/**
@brief A struct containing all information about a Tcl-interpreter
Modified: code/branches/consolecommands3/src/libraries/core/input/InputManager.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/input/InputManager.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/input/InputManager.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -61,6 +61,13 @@
{
SetCommandLineSwitch(keyboard_no_grab).information("Whether not to exclusively grab the keyboard");
+ static const std::string __CC_InputManager_name = "InputManager";
+ static const std::string __CC_calibrate_name = "calibrate";
+ static const std::string __CC_reload_name = "reload";
+
+ _SetConsoleCommand(__CC_InputManager_name, __CC_calibrate_name, &InputManager::calibrate).addShortcut();
+ _SetConsoleCommand(__CC_InputManager_name, __CC_reload_name, &InputManager::reload );
+
// Abuse of this source file for the InputHandler
InputHandler InputHandler::EMPTY;
@@ -117,10 +124,8 @@
this->updateActiveStates();
- // calibrate console command
- this->getIdentifier()->addConsoleCommand(createConsoleCommand(createFunctor(&InputManager::calibrate, this), "calibrate"), true);
- // reload console command
- this->getIdentifier()->addConsoleCommand(createConsoleCommand(createFunctor(&InputManager::reload, this), "reload"), false);
+ _ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(this);
+ _ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(this);
CCOUT(4) << "Construction complete." << std::endl;
internalState_ = Nothing;
@@ -287,6 +292,10 @@
if (!(internalState_ & Bad))
this->destroyDevices();
+ // Reset console commands
+ _ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(0);
+ _ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(0);
+
CCOUT(3) << "Destruction complete." << std::endl;
}
Modified: code/branches/consolecommands3/src/libraries/core/input/KeyBinderManager.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/input/KeyBinderManager.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/input/KeyBinderManager.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -42,6 +42,16 @@
{
ManageScopedSingleton(KeyBinderManager, ScopeID::Graphics, false);
+ static const std::string __CC_keybind_name = "keybind";
+ static const std::string __CC_tkeybind_name = "tkeybind";
+ static const std::string __CC_unbind_name = "unbind";
+ static const std::string __CC_tunbind_name = "tunbind";
+
+ _SetConsoleCommand(__CC_keybind_name, &KeyBinderManager::keybind).defaultValues("");
+ _SetConsoleCommand(__CC_tkeybind_name, &KeyBinderManager::tkeybind).defaultValues("");
+ _SetConsoleCommand(__CC_unbind_name, &KeyBinderManager::unbind).defaultValues("");
+ _SetConsoleCommand(__CC_tunbind_name, &KeyBinderManager::tunbind).defaultValues("");
+
KeyBinderManager::KeyBinderManager()
: currentBinder_(NULL)
, bDefaultFileLoaded_(true)
@@ -51,14 +61,10 @@
this->setConfigValues();
// keybind console commands
- CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::keybind, this), "keybind" ))
- .defaultValues("");
- CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::tkeybind, this), "tkeybind"))
- .defaultValues("");
- CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::unbind, this), "unbind"))
- .defaultValues("");
- CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::tunbind, this), "tunbind"))
- .defaultValues("");
+ _ModifyConsoleCommand(__CC_keybind_name ).setObject(this);
+ _ModifyConsoleCommand(__CC_tkeybind_name).setObject(this);
+ _ModifyConsoleCommand(__CC_unbind_name ).setObject(this);
+ _ModifyConsoleCommand(__CC_tunbind_name ).setObject(this);
// Load default key binder
this->setCurrent(defaultFilename_);
@@ -69,6 +75,12 @@
// Delete all remaining KeyBinders
for (std::map<std::string, KeyBinder*>::const_iterator it = this->binders_.begin(); it != this->binders_.end(); ++it)
delete it->second;
+
+ // Reset console commands
+ _ModifyConsoleCommand(__CC_keybind_name ).setObject(0);
+ _ModifyConsoleCommand(__CC_tkeybind_name).setObject(0);
+ _ModifyConsoleCommand(__CC_unbind_name ).setObject(0);
+ _ModifyConsoleCommand(__CC_tunbind_name ).setObject(0);
}
void KeyBinderManager::setConfigValues()
Modified: code/branches/consolecommands3/src/libraries/core/input/KeyDetector.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/input/KeyDetector.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/input/KeyDetector.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -37,15 +37,18 @@
namespace orxonox
{
- std::string KeyDetector::callbackCommand_s = "KeyDetectorKeyPressed";
ManageScopedSingleton(KeyDetector, ScopeID::Graphics, false);
+ static const std::string __CC_KeyDetector_callback_name = "KeyDetectorKeyPressed";
+ _DeclareConsoleCommand(__CC_KeyDetector_callback_name, &prototype::void__string);
+
KeyDetector::KeyDetector()
: KeyBinder("")
{
RegisterObject(KeyDetector);
- CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyDetector::callback, this), callbackCommand_s));
+ _ModifyConsoleCommand(__CC_KeyDetector_callback_name).setFunction(&KeyDetector::callback, this);
+
this->assignCommands();
inputState_ = InputManager::getInstance().createInputState("detector", false, false, InputStatePriority::Detector);
@@ -58,13 +61,14 @@
{
inputState_->setHandler(NULL);
InputManager::getInstance().destroyState("detector");
+ _ModifyConsoleCommand(__CC_KeyDetector_callback_name).resetFunction();
}
void KeyDetector::assignCommands()
{
// Assign every button/axis the same command, but with its name as argument
for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
- it->second->parse(callbackCommand_s + ' ' + it->second->groupName_ + "." + it->second->name_);
+ it->second->parse(__CC_KeyDetector_callback_name + ' ' + it->second->groupName_ + "." + it->second->name_);
}
void KeyDetector::callback(const std::string& name)
Modified: code/branches/consolecommands3/src/libraries/core/input/KeyDetector.h
===================================================================
--- code/branches/consolecommands3/src/libraries/core/input/KeyDetector.h 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/core/input/KeyDetector.h 2010-08-25 22:09:12 UTC (rev 7219)
@@ -56,7 +56,6 @@
FunctorPtr callbackFunction_;
InputState* inputState_;
- static std::string callbackCommand_s;
static KeyDetector* singletonPtr_s;
};
}
Modified: code/branches/consolecommands3/src/libraries/network/Host.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/network/Host.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/network/Host.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -37,8 +37,11 @@
namespace orxonox {
- SetConsoleCommandShortcut(Host, Chat);
+ static const std::string __CC_printRTT_name = "printRTT";
+ _SetConsoleCommand("chat", &Host::Chat);
+ _SetConsoleCommand(__CC_printRTT_name, &Host::printRTT);
+
// Host* Host::instance_=0;
uint32_t Host::clientID_s=0;
uint32_t Host::shipID_s=-1;
@@ -51,8 +54,7 @@
{
// assert(instance_==0);
instances_s.push_back(this);
- this->printRTTCC_ = createConsoleCommand( createFunctor(&Host::printRTT, this), "printRTT" );
- CommandExecutor::addConsoleCommandShortcut( this->printRTTCC_ );
+ _ModifyConsoleCommand(__CC_printRTT_name).setObject(this);
this->bIsActive_ = false;
}
@@ -64,8 +66,7 @@
{
assert( std::find( instances_s.begin(), instances_s.end(), this )!=instances_s.end() );
instances_s.erase(std::find( instances_s.begin(), instances_s.end(), this ));
- if( this->printRTTCC_ )
- delete this->printRTTCC_;
+ _ModifyConsoleCommand(__CC_printRTT_name).setObject(0);
}
/**
Modified: code/branches/consolecommands3/src/libraries/network/Host.h
===================================================================
--- code/branches/consolecommands3/src/libraries/network/Host.h 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/network/Host.h 2010-08-25 22:09:12 UTC (rev 7219)
@@ -84,7 +84,6 @@
virtual void printRTT()=0;
bool isActive(){ return bIsActive_; }
private:
- ConsoleCommand* printRTTCC_;
static uint32_t clientID_s;
static uint32_t shipID_s;
static std::vector<Host*> instances_s;
Modified: code/branches/consolecommands3/src/libraries/tools/Timer.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/tools/Timer.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/libraries/tools/Timer.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -38,8 +38,8 @@
namespace orxonox
{
- SetConsoleCommandShortcutExtern(delay);
- SetConsoleCommandShortcutExtern(killdelays);
+ _SetConsoleCommand("delay", &delay);
+ _SetConsoleCommand("killdelays", &killdelays);
static std::set<Timer*> delaytimerset;
Modified: code/branches/consolecommands3/src/modules/designtools/ScreenshotManager.cc
===================================================================
--- code/branches/consolecommands3/src/modules/designtools/ScreenshotManager.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/modules/designtools/ScreenshotManager.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -19,7 +19,7 @@
namespace orxonox
{
ManageScopedSingleton(ScreenshotManager, ScopeID::Graphics, false);
- SetConsoleCommandAlias(ScreenshotManager, makeScreenshot_s, "printScreenHD", true);
+ _SetConsoleCommand("printScreenHD", &ScreenshotManager::makeScreenshot_s);
ScreenshotManager::ScreenshotManager()
{
Modified: code/branches/consolecommands3/src/modules/designtools/SkyboxGenerator.cc
===================================================================
--- code/branches/consolecommands3/src/modules/designtools/SkyboxGenerator.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/modules/designtools/SkyboxGenerator.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -49,7 +49,7 @@
namespace orxonox
{
- SetConsoleCommand(SkyboxGenerator, createSkybox, true);
+ _SetConsoleCommand("SkyboxGenerator", "createSkybox", &SkyboxGenerator::createSkybox).addShortcut();
ManageScopedSingleton(SkyboxGenerator, ScopeID::Graphics, false);
@@ -78,7 +78,7 @@
{
if(!this->captionsRemoved_)
{
- CommandExecutor::execute("setGametypeStatus false");
+ CommandExecutor::execute("GametypeStatus displayCaption false");
this->captionsRemoved_ = true;
return;
}
@@ -144,7 +144,7 @@
iterateOverDirections_ =0;
takeScreenshot_ = false;
CommandExecutor::execute("pause");
- CommandExecutor::execute("setGametypeStatus true");
+ CommandExecutor::execute("GametypeStatus displayCaption true");
this->captionsRemoved_ = false;
}
Modified: code/branches/consolecommands3/src/modules/objects/triggers/Trigger.cc
===================================================================
--- code/branches/consolecommands3/src/modules/objects/triggers/Trigger.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/modules/objects/triggers/Trigger.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -37,7 +37,7 @@
namespace orxonox
{
- SetConsoleCommand(Trigger, debugFlares, false).defaultValues(false);
+ _SetConsoleCommand("Trigger", "debugFlares", &Trigger::debugFlares).defaultValues(false);
CreateFactory(Trigger);
Modified: code/branches/consolecommands3/src/modules/overlays/hud/GametypeStatus.cc
===================================================================
--- code/branches/consolecommands3/src/modules/overlays/hud/GametypeStatus.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/modules/overlays/hud/GametypeStatus.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -40,18 +40,24 @@
{
CreateFactory(GametypeStatus);
- /*static*/ bool GametypeStatus::noCaption_s = false;
- SetConsoleCommand(GametypeStatus, setGametypeStatus, true);
+ static const std::string __CC_GametypeStatus_name = "GametypeStatus";
+ static const std::string __CC_displayCaption_name = "displayCaption";
+ _SetConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name, &GametypeStatus::setDisplayCaption);
+
GametypeStatus::GametypeStatus(BaseObject* creator) : OverlayText(creator)
{
RegisterObject(GametypeStatus);
this->owner_ = 0;
+ this->bNoCaption_ = false;
+
+ _ModifyConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name).setObject(this);
}
GametypeStatus::~GametypeStatus()
{
+ _ModifyConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name).setObject(0);
}
void GametypeStatus::tick(float dt)
@@ -63,7 +69,7 @@
const GametypeInfo* gtinfo = this->owner_->getGametypeInfo();
ControllableEntity* ce = this->owner_->getControllableEntity();
- if(GametypeStatus::noCaption_s) // No captions are displayed.
+ if (this->bNoCaption_) // No captions are displayed.
{
this->setCaption("");
return;
@@ -104,9 +110,9 @@
@param bValue
If true captions are displayed, if false, not.
*/
- /*static*/ void GametypeStatus::setGametypeStatus(bool bValue)
+ void GametypeStatus::setDisplayCaption(bool bValue)
{
- GametypeStatus::noCaption_s = !bValue;
+ this->bNoCaption_ = !bValue;
}
}
Modified: code/branches/consolecommands3/src/modules/overlays/hud/GametypeStatus.h
===================================================================
--- code/branches/consolecommands3/src/modules/overlays/hud/GametypeStatus.h 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/modules/overlays/hud/GametypeStatus.h 2010-08-25 22:09:12 UTC (rev 7219)
@@ -45,11 +45,11 @@
virtual void tick(float dt);
virtual void changedOwner();
- static void setGametypeStatus(bool bValue); //!< Toggles whether the gametype status is displayed.
+ void setDisplayCaption(bool bValue); //!< Toggles whether the gametype status is displayed.
private:
PlayerInfo* owner_;
- static bool noCaption_s;
+ bool bNoCaption_;
};
}
Modified: code/branches/consolecommands3/src/orxonox/ChatInputHandler.cc
===================================================================
--- code/branches/consolecommands3/src/orxonox/ChatInputHandler.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/orxonox/ChatInputHandler.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -45,10 +45,8 @@
ManageScopedSingleton( ChatInputHandler, ScopeID::Graphics, false );
/* add commands to console */
- SetConsoleCommandAlias( ChatInputHandler, activate_static, "startchat",
- true );
- SetConsoleCommandAlias( ChatInputHandler, activate_small_static,
- "startchat_small", true );
+ _SetConsoleCommand( "startchat", &ChatInputHandler::activate_static );
+ _SetConsoleCommand( "startchat_small", &ChatInputHandler::activate_small_static );
/* constructor */
ChatInputHandler::ChatInputHandler()
Modified: code/branches/consolecommands3/src/orxonox/Test.cc
===================================================================
--- code/branches/consolecommands3/src/orxonox/Test.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/orxonox/Test.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -37,12 +37,12 @@
{
CreateFactory ( Test );
- SetConsoleCommand(Test, printV1, true).accessLevel(AccessLevel::User);
- SetConsoleCommand(Test, printV2, true).accessLevel(AccessLevel::User);
- SetConsoleCommand(Test, printV3, true).accessLevel(AccessLevel::User);
- SetConsoleCommand(Test, printV4, true).accessLevel(AccessLevel::User);
- SetConsoleCommand(Test, call, true).accessLevel(AccessLevel::User);
- SetConsoleCommand(Test, call2, true).accessLevel(AccessLevel::User);
+ _SetConsoleCommand("Test", "printV1", &Test::printV1).addShortcut();
+ _SetConsoleCommand("Test", "printV2", &Test::printV2).addShortcut();
+ _SetConsoleCommand("Test", "printV3", &Test::printV3).addShortcut();
+ _SetConsoleCommand("Test", "printV4", &Test::printV4).addShortcut();
+ _SetConsoleCommand("Test", "call", &Test::call).addShortcut();
+ _SetConsoleCommand("Test", "call2", &Test::call2).addShortcut();
//void=* aaaaa = copyPtr<sizeof(&Test::printV1)>( &NETWORK_FUNCTION_POINTER, &Test::printV1 );
Modified: code/branches/consolecommands3/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/branches/consolecommands3/src/orxonox/controllers/ArtificialController.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/orxonox/controllers/ArtificialController.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -46,11 +46,11 @@
namespace orxonox
{
- SetConsoleCommand(ArtificialController, formationflight, true);
- SetConsoleCommand(ArtificialController, masteraction, true);
- SetConsoleCommand(ArtificialController, followme, true);
- SetConsoleCommand(ArtificialController, passivebehaviour, true);
- SetConsoleCommand(ArtificialController, formationsize, true);
+ _SetConsoleCommand("ArtificialController", "formationflight", &ArtificialController::formationflight);
+ _SetConsoleCommand("ArtificialController", "masteraction", &ArtificialController::masteraction);
+ _SetConsoleCommand("ArtificialController", "followme", &ArtificialController::followme);
+ _SetConsoleCommand("ArtificialController", "passivebehaviour", &ArtificialController::passivebehaviour);
+ _SetConsoleCommand("ArtificialController", "formationsize", &ArtificialController::formationsize);
static const unsigned int STANDARD_MAX_FORMATION_SIZE = 7;
static const int RADIUS_TO_SEARCH_FOR_MASTERS = 5000;
Modified: code/branches/consolecommands3/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/branches/consolecommands3/src/orxonox/controllers/HumanController.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/orxonox/controllers/HumanController.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -39,26 +39,26 @@
namespace orxonox
{
- SetConsoleCommand(HumanController, moveFrontBack, true).setAsInputCommand();
- SetConsoleCommand(HumanController, moveRightLeft, true).setAsInputCommand();
- SetConsoleCommand(HumanController, moveUpDown, true).setAsInputCommand();
- SetConsoleCommand(HumanController, rotateYaw, true).setAsInputCommand();
- SetConsoleCommand(HumanController, rotatePitch, true).setAsInputCommand();
- SetConsoleCommand(HumanController, rotateRoll, true).setAsInputCommand();
- SetConsoleCommand(HumanController, fire, true).keybindMode(KeybindMode::OnHold);
- SetConsoleCommand(HumanController, reload, true);
- SetConsoleCommand(HumanController, boost, true).keybindMode(KeybindMode::OnHold);
- SetConsoleCommand(HumanController, greet, true);
- SetConsoleCommand(HumanController, switchCamera, true);
- SetConsoleCommand(HumanController, mouseLook, true);
- SetConsoleCommand(HumanController, suicide, true);
- SetConsoleCommand(HumanController, toggleGodMode, true);
- SetConsoleCommand(HumanController, addBots, true).defaultValues(1);
- SetConsoleCommand(HumanController, killBots, true).defaultValues(0);
- SetConsoleCommand(HumanController, dropItems, true);
- SetConsoleCommand(HumanController, useItem, true);
- SetConsoleCommand(HumanController, cycleNavigationFocus, true);
- SetConsoleCommand(HumanController, releaseNavigationFocus, true);
+ _SetConsoleCommand("HumanController", "moveFrontBack", &HumanController::moveFrontBack ).addShortcut().setAsInputCommand();
+ _SetConsoleCommand("HumanController", "moveRightLeft", &HumanController::moveRightLeft ).addShortcut().setAsInputCommand();
+ _SetConsoleCommand("HumanController", "moveUpDown", &HumanController::moveUpDown ).addShortcut().setAsInputCommand();
+ _SetConsoleCommand("HumanController", "rotateYaw", &HumanController::rotateYaw ).addShortcut().setAsInputCommand();
+ _SetConsoleCommand("HumanController", "rotatePitch", &HumanController::rotatePitch ).addShortcut().setAsInputCommand();
+ _SetConsoleCommand("HumanController", "rotateRoll", &HumanController::rotateRoll ).addShortcut().setAsInputCommand();
+ _SetConsoleCommand("HumanController", "fire", &HumanController::fire ).addShortcut().keybindMode(KeybindMode::OnHold);
+ _SetConsoleCommand("HumanController", "reload", &HumanController::reload ).addShortcut();
+ _SetConsoleCommand("HumanController", "boost", &HumanController::boost ).addShortcut().keybindMode(KeybindMode::OnHold);
+ _SetConsoleCommand("HumanController", "greet", &HumanController::greet ).addShortcut();
+ _SetConsoleCommand("HumanController", "switchCamera", &HumanController::switchCamera ).addShortcut();
+ _SetConsoleCommand("HumanController", "mouseLook", &HumanController::mouseLook ).addShortcut();
+ _SetConsoleCommand("HumanController", "suicide", &HumanController::suicide ).addShortcut();
+ _SetConsoleCommand("HumanController", "toggleGodMode", &HumanController::toggleGodMode ).addShortcut();
+ _SetConsoleCommand("HumanController", "addBots", &HumanController::addBots ).addShortcut().defaultValues(1);
+ _SetConsoleCommand("HumanController", "killBots", &HumanController::killBots ).addShortcut().defaultValues(0);
+ _SetConsoleCommand("HumanController", "dropItems", &HumanController::dropItems ).addShortcut();
+ _SetConsoleCommand("HumanController", "useItem", &HumanController::useItem ).addShortcut();
+ _SetConsoleCommand("HumanController", "cycleNavigationFocus", &HumanController::cycleNavigationFocus).addShortcut();
+ _SetConsoleCommand("HumanController", "releaseNavigationFocus", &HumanController::releaseNavigationFocus).addShortcut();
CreateUnloadableFactory(HumanController);
Modified: code/branches/consolecommands3/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/consolecommands3/src/orxonox/controllers/NewHumanController.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/orxonox/controllers/NewHumanController.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -48,10 +48,10 @@
namespace orxonox
{
- SetConsoleCommand(NewHumanController, changeMode, false).keybindMode(KeybindMode::OnPress);
- SetConsoleCommand(NewHumanController, accelerate, false).keybindMode(KeybindMode::OnPress);
- SetConsoleCommand(NewHumanController, decelerate, false).keybindMode(KeybindMode::OnPress);
- SetConsoleCommand(NewHumanController, unfire, true).keybindMode(KeybindMode::OnRelease);
+ _SetConsoleCommand("NewHumanController", "changeMode", &NewHumanController::changeMode).keybindMode(KeybindMode::OnPress);
+ _SetConsoleCommand("NewHumanController", "accelerate", &NewHumanController::accelerate).keybindMode(KeybindMode::OnPress);
+ _SetConsoleCommand("NewHumanController", "decelerate", &NewHumanController::decelerate).keybindMode(KeybindMode::OnPress);
+ _SetConsoleCommand("NewHumanController", "unfire", &NewHumanController::unfire ).keybindMode(KeybindMode::OnRelease).addShortcut();
CreateUnloadableFactory(NewHumanController);
Modified: code/branches/consolecommands3/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/branches/consolecommands3/src/orxonox/gamestates/GSMainMenu.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/orxonox/gamestates/GSMainMenu.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -47,6 +47,20 @@
{
DeclareGameState(GSMainMenu, "mainMenu", false, true);
+ static const std::string __CC_startStandalone_name = "startGame";
+ static const std::string __CC_startServer_name = "startServer";
+ static const std::string __CC_startClient_name = "startClient";
+ static const std::string __CC_startDedicated_name = "startDedicated";
+ static const std::string __CC_startMainMenu_name = "startMainMenu";
+ static const std::string __CC_setMainMenuSoundPath_name = "setMMSoundPath";
+
+ _SetConsoleCommand(__CC_startStandalone_name, &GSMainMenu::startStandalone).deactivate();
+ _SetConsoleCommand(__CC_startServer_name, &GSMainMenu::startServer ).deactivate();
+ _SetConsoleCommand(__CC_startClient_name, &GSMainMenu::startClient ).deactivate();
+ _SetConsoleCommand(__CC_startDedicated_name, &GSMainMenu::startDedicated ).deactivate();
+ _SetConsoleCommand(__CC_startMainMenu_name, &GSMainMenu::startMainMenu ).deactivate();
+ _SetConsoleCommand(__CC_setMainMenuSoundPath_name, &GSMainMenu::setMainMenuSoundPath);
+
GSMainMenu::GSMainMenu(const GameStateInfo& info)
: GameState(info)
{
@@ -88,15 +102,13 @@
InputManager::getInstance().enterState("MainMenuHackery");
- CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startStandalone), "startGame"));
- CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startServer), "startServer"));
- CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startClient), "startClient"));
- CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startDedicated), "startDedicated"));
- CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startMainMenu), "startMainMenu"));
+ _ModifyConsoleCommand(__CC_startStandalone_name).activate();
+ _ModifyConsoleCommand(__CC_startServer_name ).activate();
+ _ModifyConsoleCommand(__CC_startClient_name ).activate();
+ _ModifyConsoleCommand(__CC_startDedicated_name ).activate();
+ _ModifyConsoleCommand(__CC_startMainMenu_name ).activate();
+ _ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(this);
- // create command to change sound path
- CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::setMainMenuSoundPath, this), "setMMSoundPath"));
-
KeyBinderManager::getInstance().setToDefault();
this->setConfigValues();
@@ -121,6 +133,13 @@
GUIManager::getInstance().setBackgroundImage("");
GUIManager::hideGUI("MainMenu");
GraphicsManager::getInstance().setCamera(0);
+
+ _ModifyConsoleCommand(__CC_startStandalone_name).deactivate();
+ _ModifyConsoleCommand(__CC_startServer_name ).deactivate();
+ _ModifyConsoleCommand(__CC_startClient_name ).deactivate();
+ _ModifyConsoleCommand(__CC_startDedicated_name ).deactivate();
+ _ModifyConsoleCommand(__CC_startMainMenu_name ).deactivate();
+ _ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(0);
}
void GSMainMenu::update(const Clock& time)
Modified: code/branches/consolecommands3/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/branches/consolecommands3/src/orxonox/gamestates/GSRoot.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/orxonox/gamestates/GSRoot.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -40,8 +40,14 @@
namespace orxonox
{
DeclareGameState(GSRoot, "root", false, false);
- SetConsoleCommandShortcut(GSRoot, printObjects);
+ static const std::string __CC_setTimeFactor_name = "setTimeFactor";
+ static const std::string __CC_pause_name = "pause";
+
+ _SetConsoleCommand("printObjects", &GSRoot::printObjects);
+ _SetConsoleCommand(__CC_setTimeFactor_name, &GSRoot::setTimeFactor).accessLevel(AccessLevel::Master).defaultValues(1.0);
+ _SetConsoleCommand(__CC_pause_name, &GSRoot::pause ).accessLevel(AccessLevel::Master);
+
registerStaticNetworkFunction(&TimeFactorListener::setTimeFactor);
GSRoot::GSRoot(const GameStateInfo& info)
@@ -75,17 +81,14 @@
// reset game speed to normal
TimeFactorListener::setTimeFactor(1.0f);
- // time factor console command
- ConsoleCommand* command = createConsoleCommand(createFunctor(&GSRoot::setTimeFactor, this), "setTimeFactor");
- CommandExecutor::addConsoleCommandShortcut(command).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);
-
- // time factor console command
- command = createConsoleCommand(createFunctor(&GSRoot::pause, this), "pause");
- CommandExecutor::addConsoleCommandShortcut(command).accessLevel(AccessLevel::Offline);
+ _ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(this);
+ _ModifyConsoleCommand(__CC_pause_name).setObject(this);
}
void GSRoot::deactivate()
{
+ _ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(0);
+ _ModifyConsoleCommand(__CC_pause_name).setObject(0);
}
void GSRoot::update(const Clock& time)
Modified: code/branches/consolecommands3/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/branches/consolecommands3/src/orxonox/gametypes/Gametype.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/orxonox/gametypes/Gametype.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -78,13 +78,6 @@
}
else
this->scoreboard_ = 0;
-
- /* HACK HACK HACK */
- this->hackAddBots_ = createConsoleCommand( createFunctor(&Gametype::addBots, this), "hackAddBots");
- this->hackKillBots_ = createConsoleCommand( createFunctor(&Gametype::killBots, this), "hackKillBots");
- CommandExecutor::addConsoleCommandShortcut( this->hackAddBots_ );
- CommandExecutor::addConsoleCommandShortcut( this->hackKillBots_ );
- /* HACK HACK HACK */
}
Gametype::~Gametype()
@@ -92,10 +85,6 @@
if (this->isInitialized())
{
this->gtinfo_->destroy();
- if( this->hackAddBots_ )
- delete this->hackAddBots_;
- if( this->hackKillBots_ )
- delete this->hackKillBots_;
}
}
Modified: code/branches/consolecommands3/src/orxonox/gametypes/Gametype.h
===================================================================
--- code/branches/consolecommands3/src/orxonox/gametypes/Gametype.h 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/orxonox/gametypes/Gametype.h 2010-08-25 22:09:12 UTC (rev 7219)
@@ -183,11 +183,6 @@
// Config Values
std::string scoreboardTemplate_;
-
- /* HACK HACK HACK */
- ConsoleCommand* hackAddBots_;
- ConsoleCommand* hackKillBots_;
- /* HACK HACK HACK */
};
}
Modified: code/branches/consolecommands3/src/orxonox/overlays/InGameConsole.cc
===================================================================
--- code/branches/consolecommands3/src/orxonox/overlays/InGameConsole.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/orxonox/overlays/InGameConsole.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -57,8 +57,8 @@
const int LINES = 30;
const float CHAR_WIDTH = 7.45f; // fix this please - determine the char-width dynamically
- SetConsoleCommand(InGameConsole, openConsole, true);
- SetConsoleCommand(InGameConsole, closeConsole, true);
+ _SetConsoleCommand("InGameConsole", "openConsole", &InGameConsole::openConsole).addShortcut();
+ _SetConsoleCommand("InGameConsole", "closeConsole", &InGameConsole::closeConsole).addShortcut();
ManageScopedSingleton(InGameConsole, ScopeID::Graphics, false);
Modified: code/branches/consolecommands3/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/branches/consolecommands3/src/orxonox/overlays/OrxonoxOverlay.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/orxonox/overlays/OrxonoxOverlay.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -56,10 +56,10 @@
unsigned int OrxonoxOverlay::hudOverlayCounter_s = 0;
std::map<std::string, OrxonoxOverlay*> OrxonoxOverlay::overlays_s;
- SetConsoleCommand(OrxonoxOverlay, scaleOverlay, false).accessLevel(AccessLevel::User);
- SetConsoleCommand(OrxonoxOverlay, scrollOverlay, false).accessLevel(AccessLevel::User);
- SetConsoleCommand(OrxonoxOverlay, toggleVisibility, false).accessLevel(AccessLevel::User);
- SetConsoleCommand(OrxonoxOverlay, rotateOverlay, false).accessLevel(AccessLevel::User);
+ _SetConsoleCommand("OrxonoxOverlay", "scaleOverlay", &OrxonoxOverlay::scaleOverlay);
+ _SetConsoleCommand("OrxonoxOverlay", "scrollOverlay", &OrxonoxOverlay::scrollOverlay);
+ _SetConsoleCommand("OrxonoxOverlay", "toggleVisibility", &OrxonoxOverlay::toggleVisibility);
+ _SetConsoleCommand("OrxonoxOverlay", "rotateOverlay", &OrxonoxOverlay::rotateOverlay);
OrxonoxOverlay::OrxonoxOverlay(BaseObject* creator)
: BaseObject(creator)
Modified: code/branches/consolecommands3/src/orxonox/overlays/OverlayGroup.cc
===================================================================
--- code/branches/consolecommands3/src/orxonox/overlays/OverlayGroup.cc 2010-08-25 21:46:32 UTC (rev 7218)
+++ code/branches/consolecommands3/src/orxonox/overlays/OverlayGroup.cc 2010-08-25 22:09:12 UTC (rev 7219)
@@ -42,9 +42,9 @@
{
CreateFactory(OverlayGroup);
- SetConsoleCommand(OverlayGroup, toggleVisibility, false).accessLevel(AccessLevel::User);
- SetConsoleCommand(OverlayGroup, scaleGroup, false).accessLevel(AccessLevel::User);
- SetConsoleCommand(OverlayGroup, scrollGroup, false).accessLevel(AccessLevel::User);
+ _SetConsoleCommand("OverlayGroup", "toggleVisibility", &OverlayGroup::toggleVisibility);
+ _SetConsoleCommand("OverlayGroup", "scaleGroup", &OverlayGroup::scaleGroup);
+ _SetConsoleCommand("OverlayGroup", "scrollGroup", &OverlayGroup::scrollGroup);
OverlayGroup::OverlayGroup(BaseObject* creator)
: BaseObject(creator)
More information about the Orxonox-commit
mailing list