mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-27 20:41:42 +00:00
Fixed strange desync when a player left
This commit is contained in:
parent
5dba8daa4f
commit
726f10f231
2 changed files with 6 additions and 5 deletions
|
|
@ -19,11 +19,11 @@ static void print_sync_object_table(void) {
|
|||
|
||||
static void print_network_player_table(void) {
|
||||
LOG_INFO("Network Player Table");
|
||||
LOG_INFO("%5s %8s %8s %8s %8s %8s", "id", "course", "act", "level", "area", "valid");
|
||||
LOG_INFO("%5s %5s %8s %8s %8s %8s %8s", "gID", "lID", "course", "act", "level", "area", "valid");
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
||||
struct NetworkPlayer* np = &gNetworkPlayers[i];
|
||||
if (!np->connected) { continue; }
|
||||
LOG_INFO("%5d %8d %8d %8d %8d %8d", np->globalIndex, np->currCourseNum, np->currActNum, np->currLevelNum, np->currAreaIndex, np->currAreaSyncValid);
|
||||
LOG_INFO("%5d %5d %8d %8d %8d %8d %8d", np->globalIndex, np->localIndex, np->currCourseNum, np->currActNum, np->currLevelNum, np->currAreaIndex, np->currAreaSyncValid);
|
||||
}
|
||||
LOG_INFO(" ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ void network_send_level_area_inform(struct NetworkPlayer* np) {
|
|||
|
||||
for (int i = 1; i < MAX_PLAYERS; i++) {
|
||||
struct NetworkPlayer* np2 = &gNetworkPlayers[i];
|
||||
if (!np2->connected) { return; }
|
||||
if (!np2->connected) { continue; }
|
||||
if (np2->localIndex == np->localIndex) { continue; }
|
||||
|
||||
u16 seq = ++sLevelAreaInformSeq[np->globalIndex][i];
|
||||
|
|
@ -29,11 +29,10 @@ void network_send_level_area_inform(struct NetworkPlayer* np) {
|
|||
network_send_to(np2->localIndex, &p);
|
||||
}
|
||||
|
||||
LOG_INFO("tx level area inform");
|
||||
LOG_INFO("tx level area inform for global %d", np->globalIndex);
|
||||
}
|
||||
|
||||
void network_receive_level_area_inform(struct Packet* p) {
|
||||
LOG_INFO("rx level area inform");
|
||||
|
||||
assert(gNetworkType != NT_SERVER);
|
||||
|
||||
|
|
@ -50,6 +49,8 @@ void network_receive_level_area_inform(struct Packet* p) {
|
|||
packet_read(p, &levelSyncValid, sizeof(u8));
|
||||
packet_read(p, &areaSyncValid, sizeof(u8));
|
||||
|
||||
LOG_INFO("rx level area inform for global %d", globalIndex);
|
||||
|
||||
struct NetworkPlayer* np = network_player_from_global_index(globalIndex);
|
||||
if (np == NULL || np->localIndex == UNKNOWN_LOCAL_INDEX || !np->connected) {
|
||||
LOG_ERROR("Receiving level area inform from inactive player!");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue