From 0ebaed430ad5cd2523d78d2e2c051576e948fe13 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Wed, 3 Jan 2018 14:28:55 +0100 Subject: 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 --- src/client.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/client.h') diff --git a/src/client.h b/src/client.h index 6093d6a6f..f5929e055 100644 --- a/src/client.h +++ b/src/client.h @@ -112,7 +112,7 @@ private: }; class ClientScripting; -struct GameUIFlags; +class GameUI; class Client : public con::PeerHandler, public InventoryManager, public IGameDef { @@ -133,7 +133,7 @@ public: ISoundManager *sound, MtEventManager *event, bool ipv6, - GameUIFlags *game_ui_flags + GameUI *game_ui ); ~Client(); @@ -400,12 +400,7 @@ public: void pushToEventQueue(ClientEvent *event); - void showGameChat(bool show = true); - void showGameHud(bool show = true); void showMinimap(bool show = true); - void showProfiler(bool show = true); - void showGameFog(bool show = true); - void showGameDebug(bool show = true); const Address getServerAddress(); @@ -570,6 +565,8 @@ private: // own state LocalClientState m_state; + GameUI *m_game_ui; + // Used for saving server map to disk client-side MapDatabase *m_localdb = nullptr; IntervalLimiter m_localdb_save_interval; @@ -580,7 +577,6 @@ private: std::unordered_map m_mod_storages; float m_mod_storage_save_timer = 10.0f; std::vector m_mods; - GameUIFlags *m_game_ui_flags; bool m_shutdown = false; -- cgit v1.2.3