diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/cheatMenu.cpp | 16 | ||||
-rw-r--r-- | src/gui/cheatMenu.h | 8 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/gui/cheatMenu.cpp b/src/gui/cheatMenu.cpp index e37f584fd..9949becc3 100644 --- a/src/gui/cheatMenu.cpp +++ b/src/gui/cheatMenu.cpp @@ -78,7 +78,7 @@ void CheatMenu::drawEntry(video::IVideoDriver *driver, std::string name, } void CheatMenu::draw(video::IVideoDriver *driver, bool show_debug) - +{ ClientScripting *script{ getScript() }; if (!script || !script->m_cheats_loaded) return; @@ -89,16 +89,16 @@ void CheatMenu::draw(video::IVideoDriver *driver, bool show_debug) CHEAT_MENU_ENTRY_TYPE_HEAD); int category_count = 0; - for (const auto &menu_item : m_cheat_categories) { + for (const auto &menu_item : script->m_cheat_categories) { bool is_selected = category_count == m_selected_category; - drawEntry(driver, menu_item.m_name, category_count, 0, is_selected, + drawEntry(driver, menu_item->m_name, category_count, 0, is_selected, false, CHEAT_MENU_ENTRY_TYPE_CATEGORY); if (is_selected && m_cheat_layer) { int cheat_count = 0; - for (const auto &sub_menu_item : menu_item.m_cheats) { - drawEntry(driver, sub_menu_item.m_name, category_count, cheat_count, - cheat_count == m_selected_cheat, - sub_menu_item.is_enabled()); + for (const auto &sub_menu_item : menu_item->m_cheats) { + drawEntry(driver, sub_menu_item->m_name, category_count, + cheat_count, cheat_count == m_selected_cheat, + sub_menu_item->is_enabled()); cheat_count++; } } @@ -166,4 +166,4 @@ void CheatMenu::selectConfirm() if (m_cheat_layer) script->toggle_cheat(script->m_cheat_categories[m_selected_category] ->m_cheats[m_selected_cheat]); -}
\ No newline at end of file +} diff --git a/src/gui/cheatMenu.h b/src/gui/cheatMenu.h index 018b63ae0..dfe92798b 100644 --- a/src/gui/cheatMenu.h +++ b/src/gui/cheatMenu.h @@ -16,7 +16,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once +#include "client/client.h" #include "irrlichttypes_extrabloated.h" +#include "script/scripting_client.h" #include <cstddef> #include <string> @@ -25,8 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc., if (!script || !script->m_cheats_loaded) \ return; -class Client; - enum CheatMenuEntryType { CHEAT_MENU_ENTRY_TYPE_HEAD, @@ -39,7 +39,7 @@ class CheatMenu public: CheatMenu(Client *client); - Client* getScript() + ClientScripting *getScript() { return m_client->getScript(); } @@ -76,4 +76,4 @@ private: gui::IGUIFont *m_font = nullptr; v2u32 m_fontsize; -};
\ No newline at end of file +}; |