g13d: Remove switch and handle all switch cases

This commit is contained in:
June Tate-Gans 2021-04-25 14:40:31 -05:00
parent 9c15e935a7
commit efe01fb850

View File

@ -49,18 +49,21 @@ G13_StickZone *G13_Stick::zone(const std::string &name, bool create) {
} }
void G13_Stick::set_mode(stick_mode_t m) { void G13_Stick::set_mode(stick_mode_t m) {
if (m == _stick_mode) if (m == _stick_mode) {
return; return;
if (_stick_mode == STICK_CALCENTER || _stick_mode == STICK_CALBOUNDS || }
if (_stick_mode == STICK_CALCENTER ||
_stick_mode == STICK_CALBOUNDS ||
_stick_mode == STICK_CALNORTH) { _stick_mode == STICK_CALNORTH) {
_recalc_calibrated(); _recalc_calibrated();
} }
_stick_mode = m; _stick_mode = m;
switch (_stick_mode) {
case STICK_CALBOUNDS: if (_stick_mode == STICK_CALBOUNDS) {
_bounds.tl = G13_StickCoord(255, 255); _bounds.tl = G13_StickCoord(255, 255);
_bounds.br = G13_StickCoord(0, 0); _bounds.br = G13_StickCoord(0, 0);
break;
} }
} }
@ -126,6 +129,9 @@ void G13_Stick::parse_joystick(unsigned char *buf) {
case STICK_CALBOUNDS: case STICK_CALBOUNDS:
_bounds.expand(_current_pos); _bounds.expand(_current_pos);
return; return;
default:
break;
}; };
// determine our normalized position // determine our normalized position