Add True and False tests for bitwise enums

This commit is contained in:
Jack Andersen
2019-04-02 18:28:39 -10:00
parent af4b1a4521
commit c1d3d040bf
9 changed files with 57 additions and 47 deletions

View File

@@ -68,7 +68,7 @@ void DolphinSmashAdapter::transferCycle() {
DolphinControllerState state;
bool rumble = false;
EDolphinControllerType type = parseState(&state, controller, rumble);
if (type != EDolphinControllerType::None && !(m_knownControllers & 1 << i)) {
if (True(type) && !(m_knownControllers & 1 << i)) {
m_leftStickCal[0] = state.m_leftStick[0];
m_leftStickCal[1] = state.m_leftStick[1];
m_rightStickCal[0] = state.m_rightStick[0];
@@ -77,7 +77,7 @@ void DolphinSmashAdapter::transferCycle() {
m_triggersCal[1] = state.m_analogTriggers[1];
m_knownControllers |= 1 << i;
m_callback->controllerConnected(i, type);
} else if (type == EDolphinControllerType::None && (m_knownControllers & 1 << i)) {
} else if (False(type) && (m_knownControllers & 1 << i)) {
m_knownControllers &= ~(1 << i);
m_callback->controllerDisconnected(i);
}