mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-04-29 15:46:17 +08:00
Update generic savedata Update function
This commit is contained in:
parent
42a53dbb57
commit
aff371836c
@ -38,19 +38,13 @@ func Update(uuid []byte, slot int, save any) error {
|
|||||||
return fmt.Errorf("invalid system data")
|
return fmt.Errorf("invalid system data")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = db.UpdateAccountStats(uuid, save.GameStats, save.VoucherCounts)
|
return UpdateSystem(uuid, save)
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to update account stats: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return db.StoreSystemSaveData(uuid, save)
|
|
||||||
|
|
||||||
case defs.SessionSaveData: // Session
|
case defs.SessionSaveData: // Session
|
||||||
if slot < 0 || slot >= defs.SessionSlotCount {
|
if slot < 0 || slot >= defs.SessionSlotCount {
|
||||||
return fmt.Errorf("slot id %d out of range", slot)
|
return fmt.Errorf("slot id %d out of range", slot)
|
||||||
}
|
}
|
||||||
return db.StoreSessionSaveData(uuid, save, slot)
|
|
||||||
|
|
||||||
|
return UpdateSession(uuid, slot, save)
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("invalid data type")
|
return fmt.Errorf("invalid data type")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user