Clear network players on disconnect

This commit is contained in:
MysterD 2022-05-11 01:27:14 -07:00
parent 780249ab21
commit 85ad7ed201
4 changed files with 26 additions and 18187 deletions

21
developer/discord.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
make DEBUG=1 DEVELOPMENT=1 STRICT=1 -j
else
make DEBUG=1 DEVELOPMENT=1 -j
fi
# find file
FILE=./build/us_pc/sm64.us.f3dex2e.exe
WINPTY=winpty
if [ ! -f "$FILE" ]; then
FILE=./build/us_pc/sm64.us.f3dex2e
WINPTY=
fi
# no debug, discord
$FILE --discord 2 --configfile sm64config_server.txt &
$FILE --discord 1 --configfile sm64config_client.txt &
exit

18186
grind.log

File diff suppressed because it is too large Load Diff

View File

@ -438,7 +438,8 @@ void network_shutdown(bool sendLeaving, bool exiting) {
free(gNetworkServerAddr);
gNetworkServerAddr = NULL;
}
gNetworkPlayerServer = NULL;
gNetworkType = NT_NONE;
if (exiting) { return; }

View File

@ -311,6 +311,8 @@ u8 network_player_disconnected(u8 globalIndex) {
smlua_call_event_hooks_mario_param(HOOK_ON_PLAYER_DISCONNECTED, &gMarioStates[i]);
memset(np, 0, sizeof(struct NetworkPlayer));
return i;
}
return UNKNOWN_GLOBAL_INDEX;
@ -381,6 +383,7 @@ void network_player_shutdown(void) {
gNetworkPlayerServer = NULL;
for (s32 i = 0; i < MAX_PLAYERS; i++) {
struct NetworkPlayer *networkPlayer = &gNetworkPlayers[i];
memset(networkPlayer, 0, sizeof(struct NetworkPlayer));
networkPlayer->connected = false;
gNetworkSystem->clear_id(i);
}