diff options
| author | oy <Tom_Adams@web.de> | 2011-01-05 22:22:07 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-01-05 22:22:07 +0100 |
| commit | 13902fef6c04697f334f4c6b1815e50eb17fdbfc (patch) | |
| tree | aaad283357f6187749e3acbee9d859e74a994774 /src/game | |
| parent | 64e36b5095fc4838692bede15e36bf953cd44459 (diff) | |
| download | zcatch-13902fef6c04697f334f4c6b1815e50eb17fdbfc.tar.gz zcatch-13902fef6c04697f334f4c6b1815e50eb17fdbfc.zip | |
show an error popup when demo deletion fails
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/components/menus.cpp | 15 | ||||
| -rw-r--r-- | src/game/client/components/menus.h | 1 | ||||
| -rw-r--r-- | src/game/client/components/menus_demo.cpp | 16 |
3 files changed, 13 insertions, 19 deletions
diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 3d84f2d3..257c278b 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -53,7 +53,6 @@ CMenus::CMenus() m_NeedSendinfo = false; m_MenuActive = true; m_UseMouseButtons = true; - m_DemolistDelEntry = false; m_EscapePressed = false; m_EnterPressed = false; @@ -1034,7 +1033,19 @@ int CMenus::Render() if(DoButton_Menu(&s_ButtonTryAgain, Localize("Yes"), 0, &Yes) || m_EnterPressed) { m_Popup = POPUP_NONE; - m_DemolistDelEntry = true; + // delete demo + if(m_DemolistSelectedIndex >= 0 && !m_DemolistSelectedIsDir) + { + char aBuf[512]; + str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename); + if(Storage()->RemoveFile(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType)) + { + DemolistPopulate(); + DemolistOnUpdate(false); + } + else + PopupMessage(Localize("Error"), Localize("Unable to delete the demo"), Localize("Ok")); + } } } else if(m_Popup == POPUP_FIRST_LAUNCH) diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index c44b9dab..5e93a90a 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -180,7 +180,6 @@ class CMenus : public CComponent sorted_array<CDemoItem> m_lDemos; char m_aCurrentDemoFolder[256]; - bool m_DemolistDelEntry; int m_DemolistSelectedIndex; bool m_DemolistSelectedIsDir; int m_DemolistStorageType; diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index b56f4d7f..8d0a5469 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -477,22 +477,6 @@ void CMenus::RenderDemoList(CUIRect MainView) s_Inited = 1; } - // delete demo - if(m_DemolistDelEntry) - { - if(m_DemolistSelectedIndex >= 0 && !m_DemolistSelectedIsDir) - { - char aBuf[512]; - str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename); - if(Storage()->RemoveFile(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType)) - { - DemolistPopulate(); - DemolistOnUpdate(false); - } - } - m_DemolistDelEntry = false; - } - char aFooterLabel[128] = {0}; if(m_DemolistSelectedIndex >= 0) { |