Complain when pasting save data with missing elements

This commit is contained in:
Tamás Bálint Misius 2023-12-15 14:53:06 +01:00
parent 324745f24d
commit b4d7d276a2
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
3 changed files with 10 additions and 1 deletions

View File

@ -1358,6 +1358,10 @@ void GameModel::SetPlaceSave(std::unique_ptr<GameSave> save)
transformedPlaceSave.reset();
placeSave = std::move(save);
notifyPlaceSaveChanged();
if (placeSave && placeSave->missingElements)
{
Log("Paste content has missing custom elements", false);
}
}
void GameModel::TransformPlaceSave(Mat2<int> transform, Vec2<int> nudge)

View File

@ -575,7 +575,7 @@ void PreviewView::NotifySaveChanged(PreviewModel * sender)
savePreview = SaveRenderer::Ref().Render(save->GetGameSave(), false, true);
if (savePreview)
savePreview->ResizeToFit(RES / 2, true);
missingElementsButton->Visible = missingElements.identifiers.size() || missingElements.ids.size();
missingElementsButton->Visible = missingElements;
UpdateLoadStatus();
}
else if (!sender->GetCanOpen())

View File

@ -7,4 +7,9 @@ struct MissingElements
{
std::map<ByteString, int> identifiers;
std::set<int> ids;
operator bool() const
{
return identifiers.size() || ids.size();
}
};