Fix wrong logic on updating last local gamestate

This commit is contained in:
glax 2024-01-15 23:43:27 +01:00
parent b084b0e13f
commit 65b9b195ca

View File

@ -37,8 +37,6 @@ public class CS2GSI
JObject jsonObject = JObject.Parse(messageJson);
CS2GameState newState = CS2GameState.ParseFromJObject(jsonObject);
this.logger?.Log(LogLevel.Debug, $"Received State:\n{newState.ToString()}");
this._lastLocalGameState = newState.UpdateGameStateForLocal(_lastLocalGameState);
this.logger?.Log(LogLevel.Debug, $"Updated Local State:\n{_lastLocalGameState.ToString()}");
if (_lastLocalGameState is not null && _allGameStates.Count > 0)
{
@ -48,6 +46,8 @@ public class CS2GSI
this.logger?.Log(LogLevel.Debug, $"Events:\n\t{string.Join("\n\t", generatedEvents)}");
InvokeEvents(generatedEvents);
}
this._lastLocalGameState = newState.UpdateGameStateForLocal(_lastLocalGameState);
this.logger?.Log(LogLevel.Debug, $"Updated Local State:\n{_lastLocalGameState.ToString()}");
_allGameStates.Add(newState);
}