Fix bug where replies to unknown players went to the wrong place

This commit is contained in:
MysterD 2023-04-15 01:16:59 -07:00
parent 787a5331c8
commit e676979630
4 changed files with 6 additions and 1 deletions

Binary file not shown.

View File

@ -126,7 +126,7 @@ void ns_coopnet_update(void) {
static int ns_coopnet_network_send(u8 localIndex, void* address, u8* data, u16 dataLength) {
if (!coopnet_is_connected()) { return 1; }
//if (gCurLobbyId == 0) { return 2; }
u64 userId = ns_coopnet_get_id(localIndex);
u64 userId = coopnet_raw_get_id(localIndex);
if (localIndex == 0 && address != NULL) { userId = *(u64*)address; }
coopnet_send_to(userId, data, dataLength);

View File

@ -75,6 +75,10 @@ void coopnet_set_local_user_id(uint64_t userId) {
sLocalUserId = userId;
}
s64 coopnet_raw_get_id(u8 localIndex) {
return (s64)sNetworkUserIds[localIndex];
}
s64 ns_coopnet_get_id(u8 localIndex) {
if (localIndex == 0) { return (s64)sLocalUserId; }
return (s64)sNetworkUserIds[localIndex];

View File

@ -12,6 +12,7 @@ void coopnet_set_user_id(uint8_t localIndex, uint64_t userId);
uint64_t coopnet_get_local_user_id(void);
void coopnet_set_local_user_id(uint64_t userId);
s64 coopnet_raw_get_id(u8 localIndex);
s64 ns_coopnet_get_id(u8 localIndex);
void ns_coopnet_save_id(u8 localIndex, s64 networkId);
void ns_coopnet_clear_id(u8 localIndex);