From cd6683bdb53ffa0e95f53dd1813b3f74e8191616 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 3 Aug 2001 00:19:19 +0000 Subject: [PATCH] - FGBinding now extends FGConditional - switched to a vector of binding pointers, to avoid copying - removed FGBinding copy constructor declaration --- src/Input/input.hxx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Input/input.hxx b/src/Input/input.hxx index c046ba69d..15791aaf9 100644 --- a/src/Input/input.hxx +++ b/src/Input/input.hxx @@ -51,7 +51,7 @@ SG_USING_STD(vector); * keyboard key, a joystick button or axis, or even a panel * instrument.

*/ -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 binding_list_t; + typedef vector 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 &_find_key_bindings (unsigned int k, int modifiers); + const vector &_find_key_bindings (unsigned int k, + int modifiers); button _key_bindings[MAX_KEYS]; joystick _joystick_bindings[MAX_JOYSTICKS]; -- 2.39.5