[Orxonox-commit 5318] r9981 - code/trunk/src/libraries/core/input

landauf at orxonox.net landauf at orxonox.net
Sat Jan 4 23:25:18 CET 2014


Author: landauf
Date: 2014-01-04 23:25:18 +0100 (Sat, 04 Jan 2014)
New Revision: 9981

Modified:
   code/trunk/src/libraries/core/input/Button.cc
Log:
I think that was a bug - why should a command not be added if it has input parameters and an overwritten binding mode? (formerly on line 224)
fixed this now and reduced redundancy

Modified: code/trunk/src/libraries/core/input/Button.cc
===================================================================
--- code/trunk/src/libraries/core/input/Button.cc	2014-01-04 22:20:26 UTC (rev 9980)
+++ code/trunk/src/libraries/core/input/Button.cc	2014-01-04 22:25:18 UTC (rev 9981)
@@ -212,27 +212,14 @@
 
 
                     // we don't know whether this is an actual axis or just a button
-                    if (mode == KeybindMode::None)
-                    {
-                        if (!addParamCommand(cmd))
-                        {
-                            mode = eval.getConsoleCommand()->getKeybindMode();
-                            this->addCommand(cmd, mode, commands);
-                        }
-                    }
-                    else
-                        cmd->setFixedKeybindMode(true);
+                    if (mode != KeybindMode::None || !addParamCommand(cmd))
+                        this->addCommand(cmd, mode, commands);
                 }
                 else
                 {
                     SimpleCommand* cmd = new SimpleCommand();
                     cmd->evaluation_ = eval;
 
-                    if (mode == KeybindMode::None)
-                        mode = eval.getConsoleCommand()->getKeybindMode();
-                    else
-                        cmd->setFixedKeybindMode(true);
-
                     this->addCommand(cmd, mode, commands);
                 }
             }
@@ -254,6 +241,11 @@
 
     inline void Button::addCommand(BaseCommand* cmd, KeybindMode::Value mode, std::vector<BaseCommand*> commands[3])
     {
+        if (mode == KeybindMode::None)
+            mode = cmd->getEvaluation()->getConsoleCommand()->getKeybindMode();
+        else
+            cmd->setFixedKeybindMode(true);
+
         if (mode == KeybindMode::OnPressAndRelease)
         {
             BaseCommand* cmd2 = cmd->clone();




More information about the Orxonox-commit mailing list