]> git.mxchange.org Git - flightgear.git/commitdiff
- FGBinding now extends FGConditional
authorcurt <curt>
Fri, 3 Aug 2001 00:19:19 +0000 (00:19 +0000)
committercurt <curt>
Fri, 3 Aug 2001 00:19:19 +0000 (00:19 +0000)
- switched to a vector of binding pointers, to avoid copying
- removed FGBinding copy constructor declaration

src/Input/input.hxx

index c046ba69d2e0bf284d46b63e1e4905441cfd7db2..15791aaf9134c57e7864e3e9a5cc45cc47c31bc0 100644 (file)
@@ -51,7 +51,7 @@ SG_USING_STD(vector);
  * keyboard key, a joystick button or axis, or even a panel
  * instrument.</p>
  */
-class FGBinding
+class FGBinding : public FGConditional
 {
 public:
 
@@ -61,12 +61,6 @@ public:
   FGBinding ();
 
 
-  /**
-   * Copy constructor.
-   */
-  FGBinding (const FGBinding &binding);
-
-
   /**
    * Convenience constructor.
    *
@@ -206,7 +200,7 @@ private:
   };
 
 
-  typedef vector<FGBinding> binding_list_t;
+  typedef vector<FGBinding *> binding_list_t;
 
   /**
    * Settings for a key or button.
@@ -216,6 +210,11 @@ private:
       : is_repeatable(false),
        last_state(-1)
     {}
+    virtual ~button () {
+      for (int i = 0; i < FG_MOD_MAX; i++)
+       for (int j = 0; i < bindings[i].size(); j++)
+         delete bindings[i][j];
+    }
     bool is_repeatable;
     int last_state;
     binding_list_t bindings[FG_MOD_MAX];
@@ -232,6 +231,11 @@ private:
        low_threshold(-0.9),
        high_threshold(0.9)
     {}
+    virtual ~axis () {
+      for (int i = 0; i < FG_MOD_MAX; i++)
+       for (int j = 0; i < bindings[i].size(); j++)
+         delete bindings[i][j];
+    }
     float last_value;
     float tolerance;
     binding_list_t bindings[FG_MOD_MAX];
@@ -307,7 +311,8 @@ private:
   /**
    * Look up the bindings for a key code.
    */
-  const vector<FGBinding> &_find_key_bindings (unsigned int k, int modifiers);
+  const vector<FGBinding *> &_find_key_bindings (unsigned int k,
+                                                int modifiers);
 
   button _key_bindings[MAX_KEYS];
   joystick _joystick_bindings[MAX_JOYSTICKS];