From 38f29c3d86ddfb101fae8b5002d31e0f556c420e Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 29 May 2001 20:02:00 +0000 Subject: [PATCH] Fix a clash with some standard MSVC defines (yeah MS) :-( --- FlightGear.dsp | 34 ++++++++++++++++++++++++++++++++++ src/Input/input.cxx | 16 ++++++++-------- src/Input/input.hxx | 18 +++++++++--------- src/Main/keyboard.cxx | 6 +++--- 4 files changed, 54 insertions(+), 20 deletions(-) diff --git a/FlightGear.dsp b/FlightGear.dsp index e5e370e37..576548f50 100644 --- a/FlightGear.dsp +++ b/FlightGear.dsp @@ -4416,6 +4416,40 @@ SOURCE=.\src\GUI\trackball.h !ENDIF +# End Source File +# End Group +# Begin Group "Lib_Input" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\src\Input\input.cxx + +!IF "$(CFG)" == "FlightGear - Win32 Release" + +# PROP Intermediate_Dir "Release\Lib_Input" + +!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug" + +# PROP Intermediate_Dir "Debug\Lib_Input" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\src\Input\input.hxx + +!IF "$(CFG)" == "FlightGear - Win32 Release" + +# PROP Intermediate_Dir "Release\Lib_Input" + +!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug" + +# PROP Intermediate_Dir "Debug\Lib_Input" + +!ENDIF + # End Source File # End Group # Begin Group "Lib_Joystick" diff --git a/src/Input/input.cxx b/src/Input/input.cxx index a309b14d9..b6e8b6d66 100644 --- a/src/Input/input.cxx +++ b/src/Input/input.cxx @@ -248,20 +248,20 @@ FGInput::init () globals->get_props()->getNode("/input/keyboard", true); vector keys = keyboard->getChildren("key"); - for (int i = 0; i < keys.size(); i++) { + for (unsigned int i = 0; i < keys.size(); i++) { int index = keys[i]->getIndex(); - int modifiers = MOD_NONE; + int modifiers = FG_MOD_NONE; if (keys[i]->getBoolValue("mod-shift")) - modifiers |= MOD_SHIFT; + modifiers |= FG_MOD_SHIFT; if (keys[i]->getBoolValue("mod-ctrl")) - modifiers |= MOD_CTRL; + modifiers |= FG_MOD_CTRL; if (keys[i]->getBoolValue("mod-alt")) - modifiers |= MOD_ALT; + modifiers |= FG_MOD_ALT; SG_LOG(SG_INPUT, SG_INFO, "Binding key " << index << " with modifiers " << modifiers); vector bindings = keys[i]->getChildren("binding"); - for (int j = 0; j < bindings.size(); j++) { + for (unsigned int j = 0; j < bindings.size(); j++) { SG_LOG(SG_INPUT, SG_INFO, " Adding binding " << j); _key_bindings[modifiers][index].push_back(FGBinding(bindings[j])); } @@ -298,7 +298,7 @@ FGInput::doKey (int k, int modifiers, int x, int y) if (_key_bindings[modifiers].find(k) != _key_bindings[modifiers].end()) { const vector &bindings = _key_bindings[modifiers][k]; - for (int i = 0; i < bindings.size(); i++) { + for (unsigned int i = 0; i < bindings.size(); i++) { bindings[i].fire(); } return; @@ -312,7 +312,7 @@ FGInput::doKey (int k, int modifiers, int x, int y) // everything after here will be removed sooner or later... - if (modifiers & MOD_SHIFT) { + if (modifiers & FG_MOD_SHIFT) { switch (k) { case 7: // Ctrl-G key diff --git a/src/Input/input.hxx b/src/Input/input.hxx index d3bae03b4..2e2dc8703 100644 --- a/src/Input/input.hxx +++ b/src/Input/input.hxx @@ -100,11 +100,11 @@ class FGInput : public FGSubsystem public: enum { - MOD_NONE = 0, - MOD_SHIFT = 1, - MOD_CTRL = 2, - MOD_ALT = 4, - MOD_MAX = 8 // one past all modifiers + FG_MOD_NONE = 0, + FG_MOD_SHIFT = 1, + FG_MOD_CTRL = 2, + FG_MOD_ALT = 4, + FG_MOD_MAX = 8 // one past all modifiers }; FGInput(); @@ -129,9 +129,9 @@ public: * @param modifiers Modifier keys pressed (bitfield). * @param x The mouse x position at the time of keypress. * @param y The mouse y position at the time of keypress. - * @see #MOD_SHIFT - * @see #MOD_CTRL - * @see #MOD_ALT + * @see #FG_MOD_SHIFT + * @see #FG_MOD_CTRL + * @see #FG_MOD_ALT */ virtual void doKey (int k, int modifiers, int x, int y); @@ -175,7 +175,7 @@ public: private: typedef map > keyboard_map; - keyboard_map _key_bindings[MOD_MAX]; + keyboard_map _key_bindings[FG_MOD_MAX]; }; diff --git a/src/Main/keyboard.cxx b/src/Main/keyboard.cxx index 7882c8ff2..706ba2aae 100644 --- a/src/Main/keyboard.cxx +++ b/src/Main/keyboard.cxx @@ -47,11 +47,11 @@ static inline int get_mods () int modifiers = 0; if (glut_modifiers & GLUT_ACTIVE_SHIFT) - modifiers |= FGInput::MOD_SHIFT; + modifiers |= FGInput::FG_MOD_SHIFT; if (glut_modifiers & GLUT_ACTIVE_CTRL) - modifiers |= FGInput::MOD_CTRL; + modifiers |= FGInput::FG_MOD_CTRL; if (glut_modifiers & GLUT_ACTIVE_ALT) - modifiers |= FGInput::MOD_ALT; + modifiers |= FGInput::FG_MOD_ALT; return modifiers; }