|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-26 13:10:20
|
Module: performous
Branch: master
Commit: 339e94e9f8cff82560f14d0bcb742d6a33ea97b7
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Jul 26 15:53:26 2009 +0300
Restore that nice oneliner. The less lines of code, the better the program.
---
game/guitargraph.cc | 12 +-----------
1 files changed, 1 insertions(+), 11 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index a2b816c..9d1816b 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -43,17 +43,7 @@ void GuitarGraph::inputProcess() {
if (b >= 5) continue;
static const int gh[] = { 2, 0, 1, 3, 4 };
static const int rb[] = { 3, 0, 1, 2, 4 };
- switch( it->second.getType() ) {
- case Joystick::ROCKBAND:
- fretPressed[rb[b]] = (ev.type == JoystickEvent::BUTTON_DOWN);
- break;
- case Joystick::GUITARHERO:
- fretPressed[gh[b]] = (ev.type == JoystickEvent::BUTTON_DOWN);
- break;
- default:
- fretPressed[gh[b]] = (ev.type == JoystickEvent::BUTTON_DOWN);
- break;
- }
+ fretPressed[(it->second.getType() == Joystick::ROCKBAND ? rb : gh)[b]] = (ev.type == JoystickEvent::BUTTON_DOWN);
}
}
}
|