NetPlayServer: Make pad data unpacking nicer to read

This commit is contained in:
mathieui 2016-01-26 21:32:16 +01:00
parent 1c808a2835
commit 34ae512d91
1 changed files with 20 additions and 2 deletions

View File

@ -500,7 +500,16 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player)
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;
// If the data is not from the correct player,
// then disconnect them.
@ -512,7 +521,16 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player)
// Relay to clients
sf::Packet spac;
spac << (MessageId)NP_MSG_PAD_DATA;
spac << map << pad.button << pad.analogA << pad.analogB << pad.stickX << pad.stickY << pad.substickX << pad.substickY << pad.triggerLeft << pad.triggerRight;
spac << map
<< pad.button
<< pad.analogA
<< pad.analogB
<< pad.stickX
<< pad.stickY
<< pad.substickX
<< pad.substickY
<< pad.triggerLeft
<< pad.triggerRight;
SendToClients(spac, player.pid);
}