From 6d13e010d878166b47f75c80fb0335fe198a7291 Mon Sep 17 00:00:00 2001 From: MysterD Date: Tue, 11 Apr 2023 14:53:04 -0700 Subject: [PATCH] Make sure lag_compensation_get_local_state() always returns a MarioState --- src/pc/network/lag_compensation.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pc/network/lag_compensation.c b/src/pc/network/lag_compensation.c index 8c15c2ae..90052978 100644 --- a/src/pc/network/lag_compensation.c +++ b/src/pc/network/lag_compensation.c @@ -40,16 +40,16 @@ void lag_compensation_store(void) { } struct MarioState* lag_compensation_get_local_state(struct NetworkPlayer* otherNp) { - if (!otherNp) { return NULL; } - if (gNetworkType == NT_NONE) { return NULL; } - if (!sLocalStateHistoryReady) { return NULL; } + if (!otherNp) { return &gMarioStates[0]; } + if (gNetworkType == NT_NONE) { return &gMarioStates[0]; } + if (!sLocalStateHistoryReady) { return &gMarioStates[0]; } s32 pingToTicks = (otherNp->ping / 1000.0f) * 30; if (pingToTicks > (MAX_LOCAL_STATE_HISTORY-1)) { pingToTicks = (MAX_LOCAL_STATE_HISTORY-1); } //LOG_INFO("Ping: %s :: %u :: %d", otherNp->name, otherNp->ping, pingToTicks); - if (pingToTicks == 0) { return NULL; } + if (pingToTicks == 0) { return &gMarioStates[0]; } s32 index = (s32)sLocalStateHistoryIndex - pingToTicks; while (index < 0) { index += MAX_LOCAL_STATE_HISTORY; }