diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 971340fec..18f053e53 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -4445,16 +4445,12 @@ void CEditor::RenderImagesList(CUIRect ToolBox) { m_SelectedImage = i; - static int s_PopupImageID = 0; if(Result == 2) { - CEditorImage *pImg = m_Map.m_vpImages[m_SelectedImage]; - int Height; - if(pImg->m_External || IsVanillaImage(pImg->m_aName)) - Height = 73; - else - Height = 56; - UiInvokePopupMenu(&s_PopupImageID, 0, UI()->MouseX(), UI()->MouseY(), 120, Height, PopupImage); + const CEditorImage *pImg = m_Map.m_vpImages[m_SelectedImage]; + const int Height = pImg->m_External || IsVanillaImage(pImg->m_aName) ? 73 : 56; + static int s_PopupImageId; + UiInvokePopupMenu(&s_PopupImageId, 0, UI()->MouseX(), UI()->MouseY(), 120, Height, PopupImage); } } } diff --git a/src/game/editor/popups.cpp b/src/game/editor/popups.cpp index 654655dc5..b6392f179 100644 --- a/src/game/editor/popups.cpp +++ b/src/game/editor/popups.cpp @@ -1282,7 +1282,7 @@ int CEditor::PopupImage(CEditor *pEditor, CUIRect View, void *pContext) } if(s_SelectionPopupContext.m_pSelection != nullptr) { - bool WasExternal = pImg->m_External; + const bool WasExternal = pImg->m_External; ReplaceImage(s_SelectionPopupContext.m_pSelection->c_str(), IStorage::TYPE_ALL, pEditor); pImg->m_External = WasExternal; s_SelectionPopupContext.Reset(); @@ -1546,11 +1546,17 @@ int CEditor::PopupEvent(CEditor *pEditor, CUIRect View, void *pContext) if(pEditor->DoButton_Editor(&s_OkButton, "Ok", 0, &Label, 0, nullptr) || pEditor->Input()->KeyPress(KEY_RETURN) || pEditor->Input()->KeyPress(KEY_KP_ENTER)) { if(pEditor->m_PopupEventType == POPEVENT_EXIT) + { g_Config.m_ClEditor = 0; + } else if(pEditor->m_PopupEventType == POPEVENT_LOAD) + { pEditor->InvokeFileDialog(IStorage::TYPE_ALL, FILETYPE_MAP, "Load map", "Load", "maps", "", CEditor::CallbackOpenMap, pEditor); + } else if(pEditor->m_PopupEventType == POPEVENT_LOADCURRENT) + { pEditor->LoadCurrentMap(); + } else if(pEditor->m_PopupEventType == POPEVENT_NEW) { pEditor->Reset();