NetPlayClient: Use std::array instead of C arrays for buffers
This commit is contained in:
parent
7304c863a6
commit
c434b5b3a9
|
@ -311,11 +311,20 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
|||
{
|
||||
PadMapping map = 0;
|
||||
GCPadStatus pad;
|
||||
packet >> map >> pad.button >> pad.analogA >> pad.analogB >> pad.stickX >> pad.stickY >> pad.substickX >> pad.substickY >> pad.triggerLeft >> pad.triggerRight;
|
||||
packet >> map
|
||||
>> pad.button
|
||||
>> pad.analogA
|
||||
>> pad.analogB
|
||||
>> pad.stickX
|
||||
>> pad.stickY
|
||||
>> pad.substickX
|
||||
>> pad.substickY
|
||||
>> pad.triggerLeft
|
||||
>> pad.triggerRight;
|
||||
|
||||
// trusting server for good map value (>=0 && <4)
|
||||
// Trusting server for good map value (>=0 && <4)
|
||||
// add to pad buffer
|
||||
m_pad_buffer[map].Push(pad);
|
||||
m_pad_buffer.at(map).Push(pad);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -331,9 +340,9 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
|||
for (unsigned int i = 0; i < size; ++i)
|
||||
packet >> nw[i];
|
||||
|
||||
// trusting server for good map value (>=0 && <4)
|
||||
// Trusting server for good map value (>=0 && <4)
|
||||
// add to Wiimote buffer
|
||||
m_wiimote_buffer[(unsigned)map].Push(nw);
|
||||
m_wiimote_buffer.at(map).Push(nw);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
@ -94,8 +95,8 @@ protected:
|
|||
|
||||
Common::FifoQueue<std::unique_ptr<sf::Packet>, false> m_async_queue;
|
||||
|
||||
Common::FifoQueue<GCPadStatus> m_pad_buffer[4];
|
||||
Common::FifoQueue<NetWiimote> m_wiimote_buffer[4];
|
||||
std::array<Common::FifoQueue<GCPadStatus>, 4> m_pad_buffer;
|
||||
std::array<Common::FifoQueue<NetWiimote >, 4> m_wiimote_buffer;
|
||||
|
||||
NetPlayUI* m_dialog = nullptr;
|
||||
|
||||
|
|
Loading…
Reference in New Issue