move CEditorMap::HandleMapDrop to CEditor

This commit is contained in:
marmare314 2023-08-29 22:03:11 +02:00
parent 12d0608dfd
commit 59df1d86d4
3 changed files with 11 additions and 17 deletions

View file

@ -7838,7 +7838,17 @@ bool CEditor::Save(const char *pFilename)
bool CEditor::HandleMapDrop(const char *pFileName, int StorageType)
{
return m_Map.HandleMapDrop(pFileName, IStorage::TYPE_ALL_OR_ABSOLUTE);
if(HasUnsavedData())
{
str_copy(m_aFileNamePending, pFileName);
m_PopupEventType = CEditor::POPEVENT_LOADDROP;
m_PopupEventActivated = true;
return true;
}
else
{
return Load(pFileName, IStorage::TYPE_ALL_OR_ABSOLUTE);
}
}
bool CEditor::Load(const char *pFileName, int StorageType)

View file

@ -473,7 +473,6 @@ public:
// io
bool Save(const char *pFilename);
bool Load(const char *pFilename, int StorageType, const std::function<void(const char *pErrorMessage)> &ErrorHandler);
bool HandleMapDrop(const char *pFilename, int StorageType);
void PerformSanityChecks(const std::function<void(const char *pErrorMessage)> &ErrorHandler);
// DDRace

View file

@ -179,18 +179,3 @@ void CEditorMap::MakeTuneLayer(const std::shared_ptr<CLayer> &pLayer)
m_pTuneLayer = std::static_pointer_cast<CLayerTune>(pLayer);
m_pTuneLayer->m_pEditor = m_pEditor;
}
bool CEditorMap::HandleMapDrop(const char *pFileName, int StorageType)
{
if(m_pEditor->HasUnsavedData())
{
str_copy(m_pEditor->m_aFileNamePending, pFileName);
m_pEditor->m_PopupEventType = CEditor::POPEVENT_LOADDROP;
m_pEditor->m_PopupEventActivated = true;
return true;
}
else
{
return m_pEditor->Load(pFileName, IStorage::TYPE_ALL_OR_ABSOLUTE);
}
}