Fix bug where replies to unknown players went to the wrong place
This commit is contained in:
parent
787a5331c8
commit
e676979630
Binary file not shown.
|
@ -126,7 +126,7 @@ void ns_coopnet_update(void) {
|
||||||
static int ns_coopnet_network_send(u8 localIndex, void* address, u8* data, u16 dataLength) {
|
static int ns_coopnet_network_send(u8 localIndex, void* address, u8* data, u16 dataLength) {
|
||||||
if (!coopnet_is_connected()) { return 1; }
|
if (!coopnet_is_connected()) { return 1; }
|
||||||
//if (gCurLobbyId == 0) { return 2; }
|
//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; }
|
if (localIndex == 0 && address != NULL) { userId = *(u64*)address; }
|
||||||
coopnet_send_to(userId, data, dataLength);
|
coopnet_send_to(userId, data, dataLength);
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,10 @@ void coopnet_set_local_user_id(uint64_t userId) {
|
||||||
sLocalUserId = userId;
|
sLocalUserId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s64 coopnet_raw_get_id(u8 localIndex) {
|
||||||
|
return (s64)sNetworkUserIds[localIndex];
|
||||||
|
}
|
||||||
|
|
||||||
s64 ns_coopnet_get_id(u8 localIndex) {
|
s64 ns_coopnet_get_id(u8 localIndex) {
|
||||||
if (localIndex == 0) { return (s64)sLocalUserId; }
|
if (localIndex == 0) { return (s64)sLocalUserId; }
|
||||||
return (s64)sNetworkUserIds[localIndex];
|
return (s64)sNetworkUserIds[localIndex];
|
||||||
|
|
|
@ -12,6 +12,7 @@ void coopnet_set_user_id(uint8_t localIndex, uint64_t userId);
|
||||||
uint64_t coopnet_get_local_user_id(void);
|
uint64_t coopnet_get_local_user_id(void);
|
||||||
void coopnet_set_local_user_id(uint64_t userId);
|
void coopnet_set_local_user_id(uint64_t userId);
|
||||||
|
|
||||||
|
s64 coopnet_raw_get_id(u8 localIndex);
|
||||||
s64 ns_coopnet_get_id(u8 localIndex);
|
s64 ns_coopnet_get_id(u8 localIndex);
|
||||||
void ns_coopnet_save_id(u8 localIndex, s64 networkId);
|
void ns_coopnet_save_id(u8 localIndex, s64 networkId);
|
||||||
void ns_coopnet_clear_id(u8 localIndex);
|
void ns_coopnet_clear_id(u8 localIndex);
|
||||||
|
|
Loading…
Reference in New Issue