MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / HandlePlayerSetScore

Method HandlePlayerSetScore

Sources/Jazz2/Multiplayer/MpLevelHandler.cpp:1387–1402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1385 }
1386
1387 void MpLevelHandler::HandlePlayerSetScore(Actors::Player* player, std::int32_t value)
1388 {
1389 // TODO: Only called by RemotePlayerOnServer
1390 if (_isServer) {
1391 auto* mpPlayer = static_cast<MpPlayer*>(player);
1392 auto peerDesc = mpPlayer->GetPeerDescriptor();
1393
1394 if (peerDesc->RemotePeer) {
1395 MemoryStream packet(9);
1396 packet.WriteValue<std::uint8_t>((std::uint8_t)PlayerPropertyType::Score);
1397 packet.WriteVariableUint32(mpPlayer->_playerIndex);
1398 packet.WriteVariableInt32((std::int32_t)value);
1399 _networkManager->SendTo(peerDesc->RemotePeer, NetworkChannel::Main, (std::uint8_t)ServerPacketType::PlayerSetProperty, packet);
1400 }
1401 }
1402 }
1403
1404 void MpLevelHandler::HandlePlayerSetHealth(Actors::Player* player, std::int32_t count)
1405 {

Callers 1

AddScoreMethod · 0.80

Calls 4

WriteVariableUint32Method · 0.80
WriteVariableInt32Method · 0.80
SendToMethod · 0.80
GetPeerDescriptorMethod · 0.45

Tested by

no test coverage detected