Send a packet to a direct play user
| 588 | |
| 589 | // Send a packet to a direct play user |
| 590 | int 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 | |
| 614 | void dp_DirectPlayDestroyPlayer(DPID who) { |
| 615 | HRESULT hr; |
no test coverage detected