From 1e845a4020644af38cad8fe032fe9002a3fc2141 Mon Sep 17 00:00:00 2001 From: Redix Date: Sun, 10 Sep 2017 04:09:38 +0200 Subject: [PATCH] Added reload button in ghost menu --- src/game/client/components/ghost.h | 2 +- src/game/client/components/menus_ingame.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/game/client/components/ghost.h b/src/game/client/components/ghost.h index 1b97ed649..a0bf2b737 100644 --- a/src/game/client/components/ghost.h +++ b/src/game/client/components/ghost.h @@ -85,7 +85,6 @@ private: static void GetNetObjCharacter(CNetObj_Character *pChar, const CGhostCharacter *pGhostChar); void AddInfos(const CNetObj_Character *pChar); - int GetSlot() const; void StartRecord(); void StopRecord(int Time = -1); @@ -107,6 +106,7 @@ public: virtual void OnMessage(int MsgType, void *pRawMsg); virtual void OnMapLoad(); + int GetSlot() const; int Load(const char *pFilename); void Unload(int Slot); diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index 728c5df74..2b70de5d1 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -1138,8 +1138,9 @@ void CMenus::RenderGhost(CUIRect MainView) static int s_GhostButton = 0; static int s_DeleteButton = 0; static int s_SaveButton = 0; + static int s_ReloadButton = 0; - if(pGhost->HasFile()) + if(pGhost->HasFile() && (pGhost->Active() || m_pClient->m_pGhost->GetSlot() != -1)) { Status.VSplitRight(120.0f, &Status, &Button); @@ -1176,4 +1177,12 @@ void CMenus::RenderGhost(CUIRect MainView) if(DoButton_Menu(&s_SaveButton, Localize("Save"), 0, &Button)) m_pClient->m_pGhost->SaveGhost(pGhost); } + + Status.VSplitLeft(120.0f, &Button, &Status); + + if(DoButton_Menu(&s_ReloadButton, Localize("Reload"), 0, &Button)) + { + m_pClient->m_pGhost->UnloadAll(); + GhostlistPopulate(); + } }