[Orxonox-commit 3198] r7891 - code/trunk/src/libraries/core/input

landauf at orxonox.net landauf at orxonox.net
Mon Feb 14 22:30:01 CET 2011


Author: landauf
Date: 2011-02-14 22:30:01 +0100 (Mon, 14 Feb 2011)
New Revision: 7891

Modified:
   code/trunk/src/libraries/core/input/Button.cc
   code/trunk/src/libraries/core/input/InputCommands.h
   code/trunk/src/libraries/core/input/KeyBinder.cc
Log:
keybind mode shouldn't be changed if it was defined explicitly in the keybindings.ini

Modified: code/trunk/src/libraries/core/input/Button.cc
===================================================================
--- code/trunk/src/libraries/core/input/Button.cc	2011-02-14 19:29:14 UTC (rev 7890)
+++ code/trunk/src/libraries/core/input/Button.cc	2011-02-14 21:30:01 UTC (rev 7891)
@@ -218,6 +218,8 @@
                             commands[mode].push_back(cmd);
                         }
                     }
+                    else
+                        cmd->setFixedKeybindMode(true);
                 }
                 else
                 {
@@ -226,6 +228,8 @@
 
                     if (mode == KeybindMode::None)
                         mode = eval.getConsoleCommand()->getKeybindMode();
+                    else
+                        cmd->setFixedKeybindMode(true);
 
                     commands[mode].push_back(cmd);
                 }

Modified: code/trunk/src/libraries/core/input/InputCommands.h
===================================================================
--- code/trunk/src/libraries/core/input/InputCommands.h	2011-02-14 19:29:14 UTC (rev 7890)
+++ code/trunk/src/libraries/core/input/InputCommands.h	2011-02-14 21:30:01 UTC (rev 7891)
@@ -55,9 +55,19 @@
     class _CoreExport BaseCommand
     {
     public:
+        BaseCommand() : bFixedKeybindMode_(false) {}
         virtual ~BaseCommand() { }
+
         virtual bool execute(float abs = 1.0f, float rel = 1.0f) = 0;
         virtual CommandEvaluation* getEvaluation() = 0;
+
+        inline void setFixedKeybindMode(bool fixed)
+            { this->bFixedKeybindMode_ = fixed; }
+        inline bool hasFixedKeybindMode() const
+            { return this->bFixedKeybindMode_; }
+
+    private:
+        bool bFixedKeybindMode_;
     };
 
     class _CoreExport SimpleCommand : public BaseCommand

Modified: code/trunk/src/libraries/core/input/KeyBinder.cc
===================================================================
--- code/trunk/src/libraries/core/input/KeyBinder.cc	2011-02-14 19:29:14 UTC (rev 7890)
+++ code/trunk/src/libraries/core/input/KeyBinder.cc	2011-02-14 21:30:01 UTC (rev 7891)
@@ -403,6 +403,9 @@
                 // iterate over all commands of the given mode at the given button
                 for (size_t command_index = 0; command_index < button->nCommands_[mode_index]; ++command_index)
                 {
+                    if (button->commands_[mode_index][command_index]->hasFixedKeybindMode())
+                        continue;
+
                     CommandEvaluation* evaluation = button->commands_[mode_index][command_index]->getEvaluation();
 
                     // compare the command




More information about the Orxonox-commit mailing list