diff options
| author | oy <Tom_Adams@web.de> | 2010-10-08 22:06:12 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-10-08 22:06:12 +0200 |
| commit | 7ad4d3224c22216b1131df56172995be33d48405 (patch) | |
| tree | ae5d799ec1aec7ceba7c6ee145a8471728d2efbf /src/game/editor | |
| parent | a0758893123cec707dc898bbf4b8f9721c6f827b (diff) | |
| download | zcatch-7ad4d3224c22216b1131df56172995be33d48405.tar.gz zcatch-7ad4d3224c22216b1131df56172995be33d48405.zip | |
use file dialog when saving a map which was not loaded from the maps save path
Diffstat (limited to 'src/game/editor')
| -rw-r--r-- | src/game/editor/ed_editor.cpp | 8 | ||||
| -rw-r--r-- | src/game/editor/ed_editor.h | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp index e1924eba..5f4347ec 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -565,6 +565,7 @@ static void CallbackOpenMap(const char *pFileName, int StorageType, void *pUser) if(pEditor->Load(pFileName, StorageType)) { str_copy(pEditor->m_aFileName, pFileName, 512); + pEditor->m_ValidSaveFilename = StorageType == IStorage::TYPE_SAVE && pEditor->m_pFileDialogPath == pEditor->m_aFileDialogCurrentFolder; pEditor->SortImages(); pEditor->m_Dialog = DIALOG_NONE; } @@ -592,7 +593,10 @@ static void CallbackSaveMap(const char *pFileName, int StorageType, void *pUser) } if(pEditor->Save(pFileName)) + { str_copy(pEditor->m_aFileName, pFileName, sizeof(pEditor->m_aFileName)); + pEditor->m_ValidSaveFilename = StorageType == IStorage::TYPE_SAVE && pEditor->m_pFileDialogPath == pEditor->m_aFileDialogCurrentFolder; + } pEditor->m_Dialog = DIALOG_NONE; } @@ -614,7 +618,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) // ctrl+s to save if(Input()->KeyDown('s') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL))) { - if(m_aFileName[0]) + if(m_aFileName[0] && m_ValidSaveFilename) CallbackSaveMap(m_aFileName, IStorage::TYPE_SAVE, this); else InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, Localize("Save map"), Localize("Save"), "maps", "", CallbackSaveMap, this); @@ -2817,7 +2821,7 @@ int CEditor::PopupMenuFile(CEditor *pEditor, CUIRect View) View.HSplitTop(12.0f, &Slot, &View); if(pEditor->DoButton_MenuItem(&s_SaveButton, Localize("Save"), 0, &Slot, 0, Localize("Saves the current map"))) { - if(pEditor->m_aFileName[0]) + if(pEditor->m_aFileName[0] && pEditor->m_ValidSaveFilename) CallbackSaveMap(pEditor->m_aFileName, IStorage::TYPE_SAVE, pEditor); else pEditor->InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, Localize("Save map"), Localize("Save"), "maps", "", CallbackSaveMap, pEditor); diff --git a/src/game/editor/ed_editor.h b/src/game/editor/ed_editor.h index 9388a671..bf6e6dec 100644 --- a/src/game/editor/ed_editor.h +++ b/src/game/editor/ed_editor.h @@ -458,6 +458,7 @@ public: m_pTooltip = 0; m_aFileName[0] = 0; + m_ValidSaveFilename = false; m_FileDialogStorageType = 0; m_pFileDialogTitle = 0; @@ -533,6 +534,7 @@ public: const char *m_pTooltip; char m_aFileName[512]; + bool m_ValidSaveFilename; enum { |