aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCraig Robbins <kde.psych@gmail.com>2015-03-17 16:44:17 +1000
committerCraig Robbins <kde.psych@gmail.com>2015-03-17 17:07:39 +1000
commit34c5a5b377413cd937c2262fe367290c7baa6603 (patch)
tree600db5ae3379f8edbd06fea5fb2d91a91b9405ab /src
parent699d42efc64cb1e317efbdf21dd55fdbef4c108c (diff)
downloadminetest-34c5a5b377413cd937c2262fe367290c7baa6603.tar.gz
minetest-34c5a5b377413cd937c2262fe367290c7baa6603.tar.bz2
minetest-34c5a5b377413cd937c2262fe367290c7baa6603.zip
Minor cleanup: game.cpp
* Sort includes * Remove unnecessary includes * Ensure the parameter name for GameRunData is consistent for class member functions
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp144
1 files changed, 67 insertions, 77 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 937f6cb23..df0895ae1 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -18,64 +18,59 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "game.h"
-#include "irrlichttypes_extrabloated.h"
-#include <IGUICheckBox.h>
-#include <IGUIEditBox.h>
-#include <IGUIButton.h>
-#include <IGUIStaticText.h>
-#include <IGUIFont.h>
-#include <IMaterialRendererServices.h>
-#include "IMeshCache.h"
+
+#include <iomanip>
+#include "camera.h"
#include "client.h"
-#include "server.h"
-#include "guiPasswordChange.h"
-#include "guiVolumeChange.h"
-#include "guiKeyChangeMenu.h"
-#include "guiFormSpecMenu.h"
-#include "tool.h"
-#include "guiChatConsole.h"
-#include "config.h"
-#include "version.h"
+#include "client/tile.h" // For TextureSource
+#include "clientmap.h"
#include "clouds.h"
-#include "particles.h"
-#include "camera.h"
-#include "mapblock.h"
-#include "settings.h"
-#include "profiler.h"
-#include "mainmenumanager.h"
-#include "gettext.h"
+#include "config.h"
+#include "content_cao.h"
+#include "drawscene.h"
+#include "event_manager.h"
+#include "fontengine.h"
+#include "itemdef.h"
#include "log.h"
#include "filesys.h"
-// Needed for determining pointing to nodes
-#include "nodedef.h"
-#include "nodemetadata.h"
-#include "main.h" // For g_settings
-#include "itemdef.h"
-#include "client/tile.h" // For TextureSource
-#include "shader.h" // For ShaderSource
+#include "gettext.h"
+#include "guiChatConsole.h"
+#include "guiFormSpecMenu.h"
+#include "guiKeyChangeMenu.h"
+#include "guiPasswordChange.h"
+#include "guiVolumeChange.h"
+#include "hud.h"
#include "logoutputbuffer.h"
-#include "subgame.h"
+#include "mainmenumanager.h"
+#include "mapblock.h"
+#include "nodedef.h" // Needed for determining pointing to nodes
+#include "nodemetadata.h"
+#include "particles.h"
+#include "profiler.h"
#include "quicktune_shortcutter.h"
-#include "clientmap.h"
-#include "hud.h"
+#include "server.h"
+#include "settings.h"
+#include "shader.h" // For ShaderSource
#include "sky.h"
+#include "subgame.h"
+#include "tool.h"
+#include "util/directiontables.h"
+#include "util/pointedthing.h"
+#include "version.h"
+
#include "sound.h"
+
#if USE_SOUND
-#include "sound_openal.h"
+ #include "sound_openal.h"
#endif
-#include "event_manager.h"
-#include <iomanip>
-#include <list>
-#include "util/directiontables.h"
-#include "util/pointedthing.h"
-#include "drawscene.h"
-#include "content_cao.h"
-#include "fontengine.h"
#ifdef HAVE_TOUCHSCREENGUI
-#include "touchscreengui.h"
+ #include "touchscreengui.h"
#endif
+extern Settings *g_settings;
+extern Profiler *g_profiler;
+
/*
Text input system
*/
@@ -565,16 +560,6 @@ public:
s32 graphh = 50;
s32 textx = x_left + m_log_max_size + 15;
s32 textx2 = textx + 200 - 15;
-
- // Draw background
- /*{
- u32 num_graphs = m_meta.size();
- core::rect<s32> rect(x_left, y_bottom - num_graphs*graphh,
- textx2, y_bottom);
- video::SColor bgcolor(120,0,0,0);
- driver->draw2DRectangle(bgcolor, rect, NULL);
- }*/
-
s32 meta_i = 0;
for (std::map<std::string, Meta>::const_iterator i = m_meta.begin();
@@ -1472,17 +1457,17 @@ protected:
// Main loop
- void updateInteractTimers(GameRunData *args, f32 dtime);
+ void updateInteractTimers(GameRunData *runData, f32 dtime);
bool checkConnection();
bool handleCallbacks();
void processQueues();
- void updateProfilers(const GameRunData &run_data, const RunStats &stats,
+ void updateProfilers(const GameRunData &runData, const RunStats &stats,
const FpsControl &draw_times, f32 dtime);
void addProfilerGraphs(const RunStats &stats, const FpsControl &draw_times,
f32 dtime);
void updateStats(RunStats *stats, const FpsControl &draw_times, f32 dtime);
- void processUserInput(VolatileRunFlags *flags, GameRunData *interact_args,
+ void processUserInput(VolatileRunFlags *flags, GameRunData *runData,
f32 dtime);
void processKeyboardInput(VolatileRunFlags *flags,
float *statustext_time,
@@ -1862,10 +1847,11 @@ void Game::shutdown()
}
-
+/****************************************************************************/
/****************************************************************************
Startup
****************************************************************************/
+/****************************************************************************/
bool Game::init(
const std::string &map_dir,
@@ -2326,20 +2312,21 @@ bool Game::getServerContent(bool *aborted)
}
-
+/****************************************************************************/
/****************************************************************************
Run
****************************************************************************/
+/****************************************************************************/
-inline void Game::updateInteractTimers(GameRunData *args, f32 dtime)
+inline void Game::updateInteractTimers(GameRunData *runData, f32 dtime)
{
- if (args->nodig_delay_timer >= 0)
- args->nodig_delay_timer -= dtime;
+ if (runData->nodig_delay_timer >= 0)
+ runData->nodig_delay_timer -= dtime;
- if (args->object_hit_delay_timer >= 0)
- args->object_hit_delay_timer -= dtime;
+ if (runData->object_hit_delay_timer >= 0)
+ runData->object_hit_delay_timer -= dtime;
- args->time_from_last_punch += dtime;
+ runData->time_from_last_punch += dtime;
}
@@ -2402,7 +2389,7 @@ void Game::processQueues()
}
-void Game::updateProfilers(const GameRunData &run_data, const RunStats &stats,
+void Game::updateProfilers(const GameRunData &runData, const RunStats &stats,
const FpsControl &draw_times, f32 dtime)
{
float profiler_print_interval =
@@ -2421,7 +2408,7 @@ void Game::updateProfilers(const GameRunData &run_data, const RunStats &stats,
}
update_profiler_gui(guitext_profiler, g_fontengine,
- run_data.profiler_current_page, run_data.profiler_max_page,
+ runData.profiler_current_page, runData.profiler_max_page,
driver->getScreenSize().Height);
g_profiler->clear();
@@ -2502,7 +2489,7 @@ void Game::updateStats(RunStats *stats, const FpsControl &draw_times,
****************************************************************************/
void Game::processUserInput(VolatileRunFlags *flags,
- GameRunData *interact_args, f32 dtime)
+ GameRunData *runData, f32 dtime)
{
// Reset input if window not active or some menu is active
if (device->isWindowActive() == false
@@ -2533,18 +2520,18 @@ void Game::processUserInput(VolatileRunFlags *flags,
#endif
// Increase timer for double tap of "keymap_jump"
- if (m_cache_doubletap_jump && interact_args->jump_timer <= 0.2)
- interact_args->jump_timer += dtime;
+ if (m_cache_doubletap_jump && runData->jump_timer <= 0.2)
+ runData->jump_timer += dtime;
processKeyboardInput(
flags,
- &interact_args->statustext_time,
- &interact_args->jump_timer,
- &interact_args->reset_jump_timer,
- &interact_args->profiler_current_page,
- interact_args->profiler_max_page);
+ &runData->statustext_time,
+ &runData->jump_timer,
+ &runData->reset_jump_timer,
+ &runData->profiler_current_page,
+ runData->profiler_max_page);
- processItemSelection(&interact_args->new_playeritem);
+ processItemSelection(&runData->new_playeritem);
}
@@ -4186,9 +4173,11 @@ void Game::showOverlayMessage(const wchar_t *msg, float dtime,
}
+/****************************************************************************/
/****************************************************************************
Shutdown / cleanup
****************************************************************************/
+/****************************************************************************/
void Game::extendedResourceCleanup()
{
@@ -4212,10 +4201,11 @@ void Game::extendedResourceCleanup()
}
-
+/****************************************************************************/
/****************************************************************************
extern function for launching the game
****************************************************************************/
+/****************************************************************************/
void the_game(bool *kill,
bool random_input,