mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-07 12:27:13 +00:00
feat: keep every brick by brick save before it is split into models
The save is stored as the client sent it in the new ugc_unsplit table, and each model split from it points back to it (ugc.unsplit_id), so the whole build can be looked at or restored later. A save is kept while any model split from it exists: deleting models removes saves no model points to any more, and deleting a character removes its saves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2530,6 +2530,12 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream& inStream, Entity* ent
|
||||
outFile.close();
|
||||
}
|
||||
|
||||
// Keep the save as the client sent it before splitting it; every model made from it points back to it
|
||||
const auto accountId = entity->GetCharacter()->GetParentUser()->GetAccountID();
|
||||
const LWOOBJID unsplitId = ObjectIDManager::GetPersistentID();
|
||||
std::stringstream unsplitData(str);
|
||||
Database::Get()->InsertUnsplitUgcModel(unsplitData, unsplitId, accountId, entity->GetCharacter()->GetID());
|
||||
|
||||
auto splitLxfmls = Lxfml::Split(asStr);
|
||||
LOG_DEBUG("Split into %zu models", splitLxfmls.size());
|
||||
|
||||
@@ -2567,7 +2573,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream& inStream, Entity* ent
|
||||
// Save each model to the database
|
||||
sd0.FromData(reinterpret_cast<const uint8_t*>(splitLxfmls[i].lxfml.data()), splitLxfmls[i].lxfml.size());
|
||||
auto sd0AsStream = sd0.GetAsStream();
|
||||
Database::Get()->InsertNewUgcModel(sd0AsStream, blueprintID, entity->GetCharacter()->GetParentUser()->GetAccountID(), entity->GetCharacter()->GetID());
|
||||
Database::Get()->InsertNewUgcModel(sd0AsStream, blueprintID, accountId, entity->GetCharacter()->GetID(), unsplitId);
|
||||
|
||||
// Insert the new property model
|
||||
IPropertyContents::Model model;
|
||||
|
||||
Reference in New Issue
Block a user