summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/Src/ControllerInterface
diff options
context:
space:
mode:
authorJordan Cristiano <jordan.cristi@gmail.com>2013-11-14 02:19:15 -0500
committerJordan Cristiano <jordan.cristi@gmail.com>2013-11-14 02:19:15 -0500
commit39a4d4329dd335cb46900e029bac7a7719a88a31 (patch)
tree98fb9c040d820c12bb3d405dfe9ace8e819bf987 /Source/Core/InputCommon/Src/ControllerInterface
parentca5b3b4773d6cac757c6ac3eb2c0a50984b7353f (diff)
more warning fixes
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface')
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp52
1 files changed, 27 insertions, 25 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp
index bcd3586dc6..24e0d0de58 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp
+++ b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp
@@ -154,12 +154,13 @@ Joystick::~Joystick()
{
// stop/destroy all effects
SDL_HapticStopAll(m_haptic);
- std::list<EffectIDState>::iterator
- i = m_state_out.begin(),
- e = m_state_out.end();
- for ( ; i != e; ++i)
- if (i->id != -1)
- SDL_HapticDestroyEffect(m_haptic, i->id);
+ for (auto &i : m_state_out)
+ {
+ if (i.id != -1)
+ {
+ SDL_HapticDestroyEffect(m_haptic, i.id);
+ }
+ }
// close haptic first
SDL_HapticClose(m_haptic);
}
@@ -210,7 +211,7 @@ void Joystick::ConstantEffect::SetState(ControlState state)
}
const Sint16 old = m_effect.effect.constant.level;
- m_effect.effect.constant.level = state * 0x7FFF;
+ m_effect.effect.constant.level = (Sint16)(state * 0x7FFF);
if (old != m_effect.effect.constant.level)
m_effect.changed = true;
}
@@ -228,7 +229,7 @@ void Joystick::RampEffect::SetState(ControlState state)
}
const Sint16 old = m_effect.effect.ramp.start;
- m_effect.effect.ramp.start = state * 0x7FFF;
+ m_effect.effect.ramp.start = (Sint16)(state * 0x7FFF);
if (old != m_effect.effect.ramp.start)
m_effect.changed = true;
}
@@ -247,7 +248,7 @@ void Joystick::SineEffect::SetState(ControlState state)
const Sint16 old = m_effect.effect.periodic.magnitude;
m_effect.effect.periodic.period = 5;
- m_effect.effect.periodic.magnitude = state * 0x5000;
+ m_effect.effect.periodic.magnitude = (Sint16)(state * 0x5000);
m_effect.effect.periodic.attack_length = 0;
m_effect.effect.periodic.fade_length = 500;
@@ -293,7 +294,7 @@ void Joystick::TriangleEffect::SetState(ControlState state)
const Sint16 old = m_effect.effect.periodic.magnitude;
m_effect.effect.periodic.period = 5;
- m_effect.effect.periodic.magnitude = state * 0x5000;
+ m_effect.effect.periodic.magnitude = (Sint16)(state * 0x5000);
m_effect.effect.periodic.attack_length = 0;
m_effect.effect.periodic.fade_length = 100;
@@ -313,34 +314,35 @@ bool Joystick::UpdateInput()
bool Joystick::UpdateOutput()
{
#ifdef USE_SDL_HAPTIC
- std::list<EffectIDState>::iterator
- i = m_state_out.begin(),
- e = m_state_out.end();
- for ( ; i != e; ++i)
+ for (auto &i : m_state_out)
{
- if (i->changed) // if SetState was called on this output
+ if (i.changed) // if SetState was called on this output
{
- if (-1 == i->id) // effect isn't currently uploaded
+ if (-1 == i.id) // effect isn't currently uploaded
{
- if (i->effect.type) // if outputstate is >0 this would be true
- if ((i->id = SDL_HapticNewEffect( m_haptic, &i->effect )) > -1) // upload the effect
- SDL_HapticRunEffect(m_haptic, i->id, 1); // run the effect
+ if (i.effect.type) // if outputstate is >0 this would be true
+ {
+ if ((i.id = SDL_HapticNewEffect(m_haptic, &i.effect)) > -1) // upload the effect
+ {
+ SDL_HapticRunEffect(m_haptic, i.id, 1); // run the effect
+ }
+ }
}
else // effect is already uploaded
{
- if (i->effect.type) // if ouputstate >0
+ if (i.effect.type) // if ouputstate >0
{
- SDL_HapticUpdateEffect(m_haptic, i->id, &i->effect); // update the effect
+ SDL_HapticUpdateEffect(m_haptic, i.id, &i.effect); // update the effect
}
else
{
- SDL_HapticStopEffect(m_haptic, i->id); // else, stop and remove the effect
- SDL_HapticDestroyEffect(m_haptic, i->id);
- i->id = -1; // mark it as not uploaded
+ SDL_HapticStopEffect(m_haptic, i.id); // else, stop and remove the effect
+ SDL_HapticDestroyEffect(m_haptic, i.id);
+ i.id = -1; // mark it as not uploaded
}
}
- i->changed = false;
+ i.changed = false;
}
}
#endif