mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-12-01 18:31:39 +00:00
Rebuilding a brick by brick autosave when a character loads no longer stops the world when the save can't be read, splits into more models than any build does, or fails to store: the save is logged and marked held (bbb_autosave.held_at), the open models and bricks go back, and the row stays as it is. A held autosave is not rebuilt again; the client's next autosave replaces it. A brick by brick save that fails to store answers with ModelGenerationFailed instead of stopping the world. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.4 KiB
C++
37 lines
1.4 KiB
C++
#ifndef __IBBBAUTOSAVE__H__
|
|
#define __IBBBAUTOSAVE__H__
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "dCommonVars.h"
|
|
|
|
// The brick by brick model a character was building when the client last sent SetBBBAutosave (the client's quick save:
|
|
// every five minutes, before an AFK kick and before quitting). The server rebuilds it into a model when the build ends
|
|
// without a save (see docs/BuildWorkflow.md).
|
|
class IBbbAutosave {
|
|
public:
|
|
struct Info {
|
|
std::string lxfml; // sd0 compressed LXFML as the client sent it
|
|
std::vector<LWOOBJID> sourceItems; // the models that were in the BBB inventory when it was sent
|
|
int64_t updatedAt{}; // Unix seconds
|
|
// When the server couldn't rebuild it (Unix seconds), 0 otherwise. A held autosave is kept for staff and not
|
|
// rebuilt again; the client's next autosave replaces it.
|
|
int64_t heldAt{};
|
|
};
|
|
|
|
virtual std::optional<IBbbAutosave::Info> GetBbbAutosave(const LWOOBJID characterId) = 0;
|
|
|
|
// Replaces the character's autosave
|
|
virtual void SetBbbAutosave(const LWOOBJID characterId, const IBbbAutosave::Info& info) = 0;
|
|
|
|
virtual void DeleteBbbAutosave(const LWOOBJID characterId) = 0;
|
|
|
|
// Marks the character's autosave as one the server couldn't rebuild, keeping its data
|
|
virtual void HoldBbbAutosave(const LWOOBJID characterId, const int64_t heldAt) = 0;
|
|
};
|
|
|
|
#endif //!__IBBBAUTOSAVE__H__
|