[Orxonox-commit 1266] r5984 - code/branches/steering/src/libraries/core/input

rgrieder at orxonox.net rgrieder at orxonox.net
Thu Oct 22 00:51:54 CEST 2009


Author: rgrieder
Date: 2009-10-22 00:51:54 +0200 (Thu, 22 Oct 2009)
New Revision: 5984

Modified:
   code/branches/steering/src/libraries/core/input/InputManager.cc
Log:
Fixed bug in InputManager that occurred when entering and leaving (or vice versa) the same InputState withing the same tick.

Modified: code/branches/steering/src/libraries/core/input/InputManager.cc
===================================================================
--- code/branches/steering/src/libraries/core/input/InputManager.cc	2009-10-21 20:25:59 UTC (rev 5983)
+++ code/branches/steering/src/libraries/core/input/InputManager.cc	2009-10-21 22:51:54 UTC (rev 5984)
@@ -630,11 +630,16 @@
                 if (stateDestroyRequests_.find(it->second) == stateDestroyRequests_.end())
                 {
                     // not scheduled for destruction
-                    // prevents a state being added multiple times
+                    // prevents a state from being added multiple times
                     stateEnterRequests_.insert(it->second);
                     return true;
                 }
             }
+            else if (this->stateLeaveRequests_.find(it->second) != this->stateLeaveRequests_.end())
+            {
+                // State already scheduled for leaving --> cancel
+                this->stateLeaveRequests_.erase(this->stateLeaveRequests_.find(it->second));
+            }
         }
         return false;
     }
@@ -657,6 +662,11 @@
                 stateLeaveRequests_.insert(it->second);
                 return true;
             }
+            else if (this->stateEnterRequests_.find(it->second) != this->stateEnterRequests_.end())
+            {
+                // State already scheduled for entering --> cancel
+                this->stateEnterRequests_.erase(this->stateEnterRequests_.find(it->second));
+            }
         }
         return false;
     }




More information about the Orxonox-commit mailing list