aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/cheatMenu.cpp28
-rw-r--r--src/gui/cheatMenu.h14
-rw-r--r--src/script/cpp_api/s_cheats.cpp10
-rw-r--r--src/script/cpp_api/s_cheats.h5
-rw-r--r--src/script/lua_api/l_localplayer.h8
5 files changed, 33 insertions, 32 deletions
diff --git a/src/gui/cheatMenu.cpp b/src/gui/cheatMenu.cpp
index b22b8da30..b103e6301 100644
--- a/src/gui/cheatMenu.cpp
+++ b/src/gui/cheatMenu.cpp
@@ -37,8 +37,8 @@ CheatMenu::CheatMenu(Client *client) : m_client(client)
m_fontsize.Y = MYMAX(m_fontsize.Y, 1);
}
-void CheatMenu::drawEntry(video::IVideoDriver* driver, std::string name, int number,
- bool selected, bool active, CheatMenuEntryType entry_type)
+void CheatMenu::drawEntry(video::IVideoDriver *driver, std::string name, int number,
+ bool selected, bool active, CheatMenuEntryType entry_type)
{
int x = m_gap, y = m_gap, width = m_entry_width, height = m_entry_height;
video::SColor *bgcolor = &m_bg_color, *fontcolor = &m_font_color;
@@ -49,7 +49,7 @@ void CheatMenu::drawEntry(video::IVideoDriver* driver, std::string name, int num
bool is_category = entry_type == CHEAT_MENU_ENTRY_TYPE_CATEGORY;
y += m_gap + m_head_height +
(number + (is_category ? 0 : m_selected_category)) *
- (m_entry_height + m_gap);
+ (m_entry_height + m_gap);
x += (is_category ? 0 : m_gap + m_entry_width);
if (active)
bgcolor = &m_active_bg_color;
@@ -70,7 +70,7 @@ void CheatMenu::drawEntry(video::IVideoDriver* driver, std::string name, int num
void CheatMenu::draw(video::IVideoDriver* driver, bool show_debug)
{
CHEAT_MENU_GET_SCRIPTPTR
-
+
if (!show_debug)
drawEntry(driver, "Dragonfireclient", 0, false, false,
CHEAT_MENU_ENTRY_TYPE_HEAD);
@@ -97,11 +97,11 @@ void CheatMenu::draw(video::IVideoDriver* driver, bool show_debug)
void CheatMenu::selectUp()
{
CHEAT_MENU_GET_SCRIPTPTR
-
+
int max = (m_cheat_layer ? script->m_cheat_categories[m_selected_category]
- ->m_cheats.size()
- : script->m_cheat_categories.size()) -
- 1;
+ ->m_cheats.size()
+ : script->m_cheat_categories.size()) -
+ 1;
int *selected = m_cheat_layer ? &m_selected_cheat : &m_selected_category;
--*selected;
if (*selected < 0)
@@ -111,11 +111,11 @@ void CheatMenu::selectUp()
void CheatMenu::selectDown()
{
CHEAT_MENU_GET_SCRIPTPTR
-
+
int max = (m_cheat_layer ? script->m_cheat_categories[m_selected_category]
- ->m_cheats.size()
- : script->m_cheat_categories.size()) -
- 1;
+ ->m_cheats.size()
+ : script->m_cheat_categories.size()) -
+ 1;
int *selected = m_cheat_layer ? &m_selected_cheat : &m_selected_category;
++*selected;
if (*selected > max)
@@ -140,8 +140,8 @@ void CheatMenu::selectLeft()
void CheatMenu::selectConfirm()
{
CHEAT_MENU_GET_SCRIPTPTR
-
+
if (m_cheat_layer)
script->toggle_cheat(script->m_cheat_categories[m_selected_category]
- ->m_cheats[m_selected_cheat]);
+ ->m_cheats[m_selected_cheat]);
}
diff --git a/src/gui/cheatMenu.h b/src/gui/cheatMenu.h
index de369485c..3c4bec471 100644
--- a/src/gui/cheatMenu.h
+++ b/src/gui/cheatMenu.h
@@ -22,9 +22,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes_extrabloated.h"
#include <string>
-#define CHEAT_MENU_GET_SCRIPTPTR \
- ClientScripting *script = m_client->getScript(); \
- if (! script || ! script->m_cheats_loaded) \
+#define CHEAT_MENU_GET_SCRIPTPTR \
+ ClientScripting *script = m_client->getScript(); \
+ if (! script || ! script->m_cheats_loaded) \
return;
class Client;
@@ -39,11 +39,11 @@ typedef enum
class CheatMenu
{
public:
- CheatMenu(Client* client);
+ CheatMenu(Client *client);
- void draw(video::IVideoDriver* driver, bool show_debug);
+ void draw(video::IVideoDriver *driver, bool show_debug);
- void drawEntry(video::IVideoDriver* driver, std::string name, int number,
+ void drawEntry(video::IVideoDriver *driver, std::string name, int number,
bool selected, bool active,
CheatMenuEntryType entry_type = CHEAT_MENU_ENTRY_TYPE_ENTRY);
@@ -66,7 +66,7 @@ private:
video::SColor m_bg_color = video::SColor(192, 255, 145, 88);
video::SColor m_active_bg_color = video::SColor(192, 255, 87, 53);
video::SColor m_font_color = video::SColor(255, 0, 0, 0);
- video::SColor m_selected_font_color = video::SColor(255, 255, 252, 88);
+ video::SColor m_selected_font_color = video::SColor(255, 255, 252, 88);
Client *m_client;
diff --git a/src/script/cpp_api/s_cheats.cpp b/src/script/cpp_api/s_cheats.cpp
index 4ad62f2fe..45b75ff6d 100644
--- a/src/script/cpp_api/s_cheats.cpp
+++ b/src/script/cpp_api/s_cheats.cpp
@@ -23,14 +23,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "settings.h"
ScriptApiCheatsCheat::ScriptApiCheatsCheat(
- const std::string &name, const std::string &setting) :
+ const std::string &name, const std::string &setting) :
m_name(name),
m_setting(setting), m_function_ref(0)
{
}
-ScriptApiCheatsCheat::ScriptApiCheatsCheat(const std::string &name, const int &function) :
+ScriptApiCheatsCheat::ScriptApiCheatsCheat(const std::string &name, const int &function) :
m_name(name), m_setting(""), m_function_ref(function)
{
}
@@ -53,8 +53,7 @@ void ScriptApiCheatsCheat::toggle(lua_State *L, int error_handler)
g_settings->setBool(m_setting, !is_enabled());
}
-ScriptApiCheatsCategory::ScriptApiCheatsCategory(const std::string &name) :
- m_name(name)
+ScriptApiCheatsCategory::ScriptApiCheatsCategory(const std::string &name) : m_name(name)
{
}
@@ -102,7 +101,8 @@ void ScriptApiCheats::init_cheats()
lua_pushnil(L);
while (lua_next(L, -2)) {
if (lua_istable(L, -1)) {
- ScriptApiCheatsCategory *category = new ScriptApiCheatsCategory(lua_tostring(L, -2));
+ ScriptApiCheatsCategory *category =
+ new ScriptApiCheatsCategory(lua_tostring(L, -2));
category->read_cheats(L);
m_cheat_categories.push_back(category);
}
diff --git a/src/script/cpp_api/s_cheats.h b/src/script/cpp_api/s_cheats.h
index a93768659..9b5ace3e7 100644
--- a/src/script/cpp_api/s_cheats.h
+++ b/src/script/cpp_api/s_cheats.h
@@ -31,6 +31,7 @@ public:
std::string m_name;
bool is_enabled();
void toggle(lua_State *L, int error_handler);
+
private:
std::string m_setting;
int m_function_ref;
@@ -43,7 +44,7 @@ public:
~ScriptApiCheatsCategory();
std::string m_name;
void read_cheats(lua_State *L);
- std::vector<ScriptApiCheatsCheat*> m_cheats;
+ std::vector<ScriptApiCheatsCheat *> m_cheats;
};
class ScriptApiCheats : virtual public ScriptApiBase
@@ -53,5 +54,5 @@ public:
void init_cheats();
void toggle_cheat(ScriptApiCheatsCheat *cheat);
bool m_cheats_loaded = false;
- std::vector<ScriptApiCheatsCategory*> m_cheat_categories;
+ std::vector<ScriptApiCheatsCategory *> m_cheat_categories;
};
diff --git a/src/script/lua_api/l_localplayer.h b/src/script/lua_api/l_localplayer.h
index c59cef764..f43eb2a4d 100644
--- a/src/script/lua_api/l_localplayer.h
+++ b/src/script/lua_api/l_localplayer.h
@@ -34,13 +34,13 @@ private:
// get_velocity(self)
static int l_get_velocity(lua_State *L);
-
+
// set_velocity(self, vel)
static int l_set_velocity(lua_State *L);
// get_yaw(self)
static int l_get_yaw(lua_State *L);
-
+
// set_yaw(self, yaw)
static int l_set_yaw(lua_State *L);
@@ -52,7 +52,7 @@ private:
// get_wield_index(self)
static int l_get_wield_index(lua_State *L);
-
+
// set_wield_index(self)
static int l_set_wield_index(lua_State *L);
@@ -84,7 +84,7 @@ private:
// get_pos(self)
static int l_get_pos(lua_State *L);
-
+
// set_pos(self, pos)
static int l_set_pos(lua_State *L);