File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
#include " ../player/PlayerManager.h"
4
4
5
+ std::map<std::string, bool > scheduledForDelete;
6
+
5
7
MenuManager::MenuManager ()
6
8
{
7
9
}
@@ -23,7 +25,10 @@ void MenuManager::UnregisterMenu(std::string id)
23
25
{
24
26
if (this ->menu_ids .find (id) == this ->menu_ids .end ())
25
27
return ;
28
+ if (scheduledForDelete.find (id) != scheduledForDelete.end ())
29
+ return ;
26
30
31
+ scheduledForDelete.insert ({id, true });
27
32
for (uint16_t i = 0 ; i < g_playerManager->GetPlayerCap (); i++)
28
33
{
29
34
Player *player = g_playerManager->GetPlayer (i);
@@ -34,14 +39,14 @@ void MenuManager::UnregisterMenu(std::string id)
34
39
if (!player->HasMenuShown ())
35
40
continue ;
36
41
37
- if (player->GetMenu ())
38
- if (player->GetMenu ()->GetID () == id)
39
- player->HideMenu ();
42
+ if (player->GetMenu ()->GetID () == id)
43
+ player->HideMenu ();
40
44
}
41
45
42
46
Menu *menu = this ->menu_ids .at (id);
43
47
delete menu;
44
48
this ->menu_ids .erase (id);
49
+ scheduledForDelete.erase (id);
45
50
}
46
51
47
52
Menu *MenuManager::FetchMenu (std::string menu_id)
You can’t perform that action at this time.
0 commit comments