summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2018-01-03 14:28:55 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2018-01-05 20:59:30 +0100
commit0ebaed430ad5cd2523d78d2e2c051576e948fe13 (patch)
tree275dd4945128012b6844f9db6b858b31f7a70af4 /src/client.cpp
parent549cfd9db80c858bdc8d23a237ea57ccf5f68400 (diff)
downloadminetest-0ebaed430ad5cd2523d78d2e2c051576e948fe13.tar.gz
minetest-0ebaed430ad5cd2523d78d2e2c051576e948fe13.tar.bz2
minetest-0ebaed430ad5cd2523d78d2e2c051576e948fe13.zip
GameUI refactor (part 1/X): GameUI object creation + GameUIFlags move to GameUI
Game class is too huge and has too specialization on various subjects, like UI, formspecs, client, renderer. Start to move UI related things to GameUI object and cleanup them Other improvements: * updateChat: more performance on error messages by remove string copies * Initialize all game class members in definition instead of constructor (with nullptr instead of NULL) * Drop unused Client::show{GameChat,GameHud,Profiler,GameFog} * Add GameUI unittests
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp32
1 files changed, 4 insertions, 28 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 6e29607ca..e6af5c324 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "network/networkpacket.h"
#include "threading/mutex_auto_lock.h"
#include "client/clientevent.h"
+#include "client/gameui.h"
#include "client/renderingengine.h"
#include "client/tile.h"
#include "util/auth.h"
@@ -74,7 +75,7 @@ Client::Client(
ISoundManager *sound,
MtEventManager *event,
bool ipv6,
- GameUIFlags *game_ui_flags
+ GameUI *game_ui
):
m_tsrc(tsrc),
m_shsrc(shsrc),
@@ -96,7 +97,7 @@ Client::Client(
m_chosen_auth_mech(AUTH_MECHANISM_NONE),
m_media_downloader(new ClientMediaDownloader()),
m_state(LC_Created),
- m_game_ui_flags(game_ui_flags),
+ m_game_ui(game_ui),
m_modchannel_mgr(new ModChannelMgr())
{
// Add local player
@@ -1771,34 +1772,9 @@ void Client::pushToEventQueue(ClientEvent *event)
m_client_event_queue.push(event);
}
-void Client::showGameChat(const bool show)
-{
- m_game_ui_flags->show_chat = show;
-}
-
-void Client::showGameHud(const bool show)
-{
- m_game_ui_flags->show_hud = show;
-}
-
void Client::showMinimap(const bool show)
{
- m_game_ui_flags->show_minimap = show;
-}
-
-void Client::showProfiler(const bool show)
-{
- m_game_ui_flags->show_profiler_graph = show;
-}
-
-void Client::showGameFog(const bool show)
-{
- m_game_ui_flags->force_fog_off = !show;
-}
-
-void Client::showGameDebug(const bool show)
-{
- m_game_ui_flags->show_debug = show;
+ m_game_ui->showMinimap(show);
}
// IGameDef interface