Fix sloppy connection logic.
This commit is contained in:
parent
12674b3164
commit
7f305ba822
|
@ -478,15 +478,14 @@ void TryToConnectWiimote(Wiimote* wm)
|
||||||
for (unsigned int i = 0; i != MAX_WIIMOTES; ++i)
|
for (unsigned int i = 0; i != MAX_WIIMOTES; ++i)
|
||||||
{
|
{
|
||||||
if (WIIMOTE_SRC_REAL & g_wiimote_sources[i]
|
if (WIIMOTE_SRC_REAL & g_wiimote_sources[i]
|
||||||
&& !g_wiimotes[i]
|
&& !g_wiimotes[i])
|
||||||
&& wm->Connect()
|
|
||||||
&& wm->Prepare(i))
|
|
||||||
{
|
{
|
||||||
g_wiimotes[i] = wm;
|
if (wm->Connect() && wm->Prepare(i))
|
||||||
|
{
|
||||||
wm->StartThread();
|
g_wiimotes[i] = wm;
|
||||||
|
wm->StartThread();
|
||||||
wm = NULL;
|
wm = NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -508,11 +507,13 @@ void DoneWithWiimote(int index)
|
||||||
for (unsigned int i = 0; i != MAX_WIIMOTES; ++i)
|
for (unsigned int i = 0; i != MAX_WIIMOTES; ++i)
|
||||||
{
|
{
|
||||||
if (WIIMOTE_SRC_REAL & g_wiimote_sources[i]
|
if (WIIMOTE_SRC_REAL & g_wiimote_sources[i]
|
||||||
&& !g_wiimotes[i]
|
&& !g_wiimotes[i])
|
||||||
&& g_wiimotes[index]->Prepare(i))
|
|
||||||
{
|
{
|
||||||
std::swap(g_wiimotes[i], g_wiimotes[index]);
|
if (g_wiimotes[index]->Prepare(i))
|
||||||
g_wiimotes[i]->StartThread();
|
{
|
||||||
|
std::swap(g_wiimotes[i], g_wiimotes[index]);
|
||||||
|
g_wiimotes[i]->StartThread();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue