Clear network players on disconnect
This commit is contained in:
parent
780249ab21
commit
85ad7ed201
|
@ -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
|
|
@ -438,7 +438,8 @@ void network_shutdown(bool sendLeaving, bool exiting) {
|
|||
free(gNetworkServerAddr);
|
||||
gNetworkServerAddr = NULL;
|
||||
}
|
||||
|
||||
gNetworkPlayerServer = NULL;
|
||||
|
||||
gNetworkType = NT_NONE;
|
||||
|
||||
if (exiting) { return; }
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue