mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Clear network players on disconnect
This commit is contained in:
parent
780249ab21
commit
85ad7ed201
4 changed files with 26 additions and 18187 deletions
21
developer/discord.sh
Executable file
21
developer/discord.sh
Executable 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
|
|
@ -438,6 +438,7 @@ void network_shutdown(bool sendLeaving, bool exiting) {
|
||||||
free(gNetworkServerAddr);
|
free(gNetworkServerAddr);
|
||||||
gNetworkServerAddr = NULL;
|
gNetworkServerAddr = NULL;
|
||||||
}
|
}
|
||||||
|
gNetworkPlayerServer = NULL;
|
||||||
|
|
||||||
gNetworkType = NT_NONE;
|
gNetworkType = NT_NONE;
|
||||||
|
|
||||||
|
|
|
@ -311,6 +311,8 @@ u8 network_player_disconnected(u8 globalIndex) {
|
||||||
|
|
||||||
smlua_call_event_hooks_mario_param(HOOK_ON_PLAYER_DISCONNECTED, &gMarioStates[i]);
|
smlua_call_event_hooks_mario_param(HOOK_ON_PLAYER_DISCONNECTED, &gMarioStates[i]);
|
||||||
|
|
||||||
|
memset(np, 0, sizeof(struct NetworkPlayer));
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return UNKNOWN_GLOBAL_INDEX;
|
return UNKNOWN_GLOBAL_INDEX;
|
||||||
|
@ -381,6 +383,7 @@ void network_player_shutdown(void) {
|
||||||
gNetworkPlayerServer = NULL;
|
gNetworkPlayerServer = NULL;
|
||||||
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct NetworkPlayer *networkPlayer = &gNetworkPlayers[i];
|
struct NetworkPlayer *networkPlayer = &gNetworkPlayers[i];
|
||||||
|
memset(networkPlayer, 0, sizeof(struct NetworkPlayer));
|
||||||
networkPlayer->connected = false;
|
networkPlayer->connected = false;
|
||||||
gNetworkSystem->clear_id(i);
|
gNetworkSystem->clear_id(i);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue