summaryrefslogtreecommitdiff
path: root/src/joystick.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-08 00:17:45 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-08 00:17:45 +0300
commit593cccb16074fe9269dd2f278bd79859769eb1fd (patch)
treed8b3d93001021c59622ea88140dbbef8aee05013 /src/joystick.cpp
parentb7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2 (diff)
downloadmanaverse-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.gz
manaverse-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.bz2
manaverse-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.xz
manaverse-593cccb16074fe9269dd2f278bd79859769eb1fd.zip
Improve constructors in some classes.
Diffstat (limited to 'src/joystick.cpp')
-rw-r--r--src/joystick.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/joystick.cpp b/src/joystick.cpp
index 04fb9d254..81b61b85d 100644
--- a/src/joystick.cpp
+++ b/src/joystick.cpp
@@ -59,16 +59,12 @@ Joystick::Joystick(int no):
mLeftTolerance(0),
mRightTolerance(0),
mCalibrating(false),
+ mNumber(no >= joystickCount ? joystickCount : no),
mCalibrated(false),
mButtonsNumber(MAX_BUTTONS),
mUseInactive(false),
mHaveHats(false)
{
- if (no >= joystickCount)
- no = joystickCount;
-
- mNumber = no;
-
for (int i = 0; i < MAX_BUTTONS; i++)
mActiveButtons[i] = false;
}