Fix errors in cheatMenu.
This commit is contained in:
parent
7af3dee31c
commit
f236476af9
@ -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]);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user