MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / dp_DirectPlaySend

Function dp_DirectPlaySend

networking/directplay.cpp:590–612  ·  view source on GitHub ↗

Send a packet to a direct play user

Source from the content-addressed store, hash-verified

588
589// Send a packet to a direct play user
590int dp_DirectPlaySend(network_address *who_to, uint8_t *data, int len, bool reliable) {
591 DPID idTo;
592 HRESULT hr;
593 uint32_t send_flags;
594 if ((!DP_active) || (!lpDirectPlay4A)) {
595 mprintf(0, "Can't send DirectPlay message because DirectPlay isn't active!\n");
596 return 0;
597 }
598
599 ASSERT(who_to->connection_type == NP_DIRECTPLAY);
600
601 send_flags = DPSEND_ASYNC;
602 if (reliable)
603 send_flags |= DPSEND_GUARANTEED;
604
605 memcpy(&idTo, who_to->address, sizeof(DPID));
606 hr = lpDirectPlay4A->SendEx(NetPlayers[Player_num].dpidPlayer, idTo, send_flags, data, len, 0, 0, NULL, NULL);
607
608 if (FAILED(hr))
609 return 0;
610 else
611 return 1;
612}
613
614void dp_DirectPlayDestroyPlayer(DPID who) {
615 HRESULT hr;

Callers 2

nw_SendReliableFunction · 0.85
nw_SendWithIDFunction · 0.85

Calls 1

FAILEDFunction · 0.85

Tested by

no test coverage detected