From 405a578e8c91ed43743a75ded942001c2e794566 Mon Sep 17 00:00:00 2001 From: Up Date: Wed, 8 May 2024 01:28:33 +0200 Subject: [PATCH] manually parse all save states for now --- api/account/info.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/api/account/info.go b/api/account/info.go index 868d17b..6b3b94e 100644 --- a/api/account/info.go +++ b/api/account/info.go @@ -31,12 +31,20 @@ type InfoResponse struct { func Info(username string, uuid []byte) (InfoResponse, error) { response := InfoResponse{Username: username, LastSessionSlot: -1} - slot, err := db.GetLatestSessionSaveDataSlot(uuid) - if err != nil { - response.LastSessionSlot = -1 + highest := -1 + for i := 0; i < defs.SessionSlotCount; i++ { + data, err := db.ReadSessionSaveData(uuid, i) + if err != nil { + continue + } + + if data.Timestamp > highest { + highest = data.Timestamp + response.LastSessionSlot = i + } } - if slot >= defs.SessionSlotCount { + if response.LastSessionSlot < 0 || response.LastSessionSlot >= defs.SessionSlotCount { response.LastSessionSlot = -1 }