diff options
| author | oy <Tom_Adams@web.de> | 2011-03-22 00:31:42 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-03-22 00:31:42 +0100 |
| commit | eaef2ce48a36a786dc60248dcc5e746865570b2d (patch) | |
| tree | 0e82b7f702afbfe6a62172a881709b944afb563d /src/game/client | |
| parent | 588a411666de052fd237f9aaa857278ade420b51 (diff) | |
| download | zcatch-eaef2ce48a36a786dc60248dcc5e746865570b2d.tar.gz zcatch-eaef2ce48a36a786dc60248dcc5e746865570b2d.zip | |
added notification for unsaved map data and a confirmation for overwriting an existing map in the editor. Closes #115
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/components/menus.cpp | 17 | ||||
| -rw-r--r-- | src/game/client/gameclient.cpp | 2 | ||||
| -rw-r--r-- | src/game/client/gameclient.h | 2 |
3 files changed, 17 insertions, 4 deletions
diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 415ff646..cd8b7760 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -9,11 +9,12 @@ #include "menus.h" #include "skins.h" +#include <engine/editor.h> #include <engine/graphics.h> -#include <engine/textrender.h> -#include <engine/serverbrowser.h> #include <engine/keys.h> +#include <engine/serverbrowser.h> #include <engine/storage.h> +#include <engine/textrender.h> #include <engine/shared/config.h> #include <game/version.h> @@ -889,6 +890,7 @@ int CMenus::Render() { pTitle = Localize("Quit"); pExtraText = Localize("Are you sure that you want to quit?"); + ExtraAlign = -1; } else if(m_Popup == POPUP_FIRST_LAUNCH) { @@ -923,10 +925,17 @@ int CMenus::Render() CUIRect Yes, No; Box.HSplitBottom(20.f, &Box, &Part); Box.HSplitBottom(24.f, &Box, &Part); + + // additional info + Box.HSplitTop(10.0f, 0, &Box); + Box.VMargin(20.f/UI()->Scale(), &Box); + if(m_pClient->Editor()->HasUnsavedData()) + UI()->DoLabelScaled(&Box, Localize("There's an unsaved map in the editor, you might want to save it before you quit the game.\nQuit anyway?"), + 20.f, -1, Part.w); + + // buttons Part.VMargin(80.0f, &Part); - Part.VSplitMid(&No, &Yes); - Yes.VMargin(20.0f, &Yes); No.VMargin(20.0f, &No); diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 20fad034..a7e9e66f 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -1,5 +1,6 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ +#include <engine/editor.h> #include <engine/engine.h> #include <engine/graphics.h> #include <engine/textrender.h> @@ -113,6 +114,7 @@ void CGameClient::OnConsoleInit() m_pDemoPlayer = Kernel()->RequestInterface<IDemoPlayer>(); m_pDemoRecorder = Kernel()->RequestInterface<IDemoRecorder>(); m_pServerBrowser = Kernel()->RequestInterface<IServerBrowser>(); + m_pEditor = Kernel()->RequestInterface<IEditor>(); // setup pointers m_pBinds = &::gs_Binds; diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 0c899805..e807592f 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -42,6 +42,7 @@ class CGameClient : public IGameClient class IDemoPlayer *m_pDemoPlayer; class IDemoRecorder *m_pDemoRecorder; class IServerBrowser *m_pServerBrowser; + class IEditor *m_pEditor; CLayers m_Layers; class CCollision m_Collision; @@ -78,6 +79,7 @@ public: class CRenderTools *RenderTools() { return &m_RenderTools; } class CLayers *Layers() { return &m_Layers; }; class CCollision *Collision() { return &m_Collision; }; + class IEditor *Editor() { return m_pEditor; } int NetobjNumCorrections() { return m_NetObjHandler.NumObjCorrections(); } const char *NetobjCorrectedOn() { return m_NetObjHandler.CorrectedObjOn(); } |