From d0099a6d790b66f21e4e266e569d64fb82fb0a81 Mon Sep 17 00:00:00 2001 From: Kai Blaschke Date: Mon, 19 Feb 2024 23:29:39 +0100 Subject: Fixed some uninitialized members May have caused undefined behavior in few cases, as most of the fixed members were used before being initialized. --- source/frontend/StarMainInterface.cpp | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'source/frontend/StarMainInterface.cpp') diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp index a0ed3ae..b7c93d1 100644 --- a/source/frontend/StarMainInterface.cpp +++ b/source/frontend/StarMainInterface.cpp @@ -65,24 +65,14 @@ GuiMessage::GuiMessage() : message(), cooldown(), springState() {} GuiMessage::GuiMessage(String const& message, float cooldown, float spring) : message(message), cooldown(cooldown), springState(spring) {} -MainInterface::MainInterface(UniverseClientPtr client, WorldPainterPtr painter, CinematicPtr cinematicOverlay) { - m_state = Running; - - m_guiContext = GuiContext::singletonPtr(); - - m_client = client; - m_worldPainter = painter; - m_cinematicOverlay = cinematicOverlay; - - m_disableHud = false; - - m_cursorScreenPos = Vec2I(); - m_state = Running; - - m_config = MainInterfaceConfig::loadFromAssets(); - - m_containerInteractor = make_shared(); - +MainInterface::MainInterface(UniverseClientPtr client, WorldPainterPtr painter, CinematicPtr cinematicOverlay) + : m_guiContext(GuiContext::singletonPtr()) + , m_config(MainInterfaceConfig::loadFromAssets()) + , m_client(std::move(client)) + , m_worldPainter(std::move(painter)) + , m_cinematicOverlay(std::move(cinematicOverlay)) + , m_containerInteractor(make_shared()) +{ GuiReader itemSlotReader; m_cursorItem = convert(itemSlotReader.makeSingle("cursorItemSlot", m_config->cursorItemSlot)); @@ -90,9 +80,7 @@ MainInterface::MainInterface(UniverseClientPtr client, WorldPainterPtr painter, m_debugSpatialClearTimer = GameTimer(m_config->debugSpatialClearTime); m_debugMapClearTimer = GameTimer(m_config->debugMapClearTime); - m_debugTextRect = RectF::null(); - m_lastMouseoverTarget = NullEntityId; m_stickyTargetingTimer = GameTimer(m_config->monsterHealthBarTime); m_inventoryWindow = make_shared(this, m_client->mainPlayer(), m_containerInteractor); @@ -183,7 +171,7 @@ MainInterface::MainInterface(UniverseClientPtr client, WorldPainterPtr painter, m_paneManager.registerPane(MainInterfacePanes::PlanetText, PaneLayer::Hud, planetName); m_nameplatePainter = make_shared(); - m_questIndicatorPainter = make_shared(client); + m_questIndicatorPainter = make_shared(m_client); m_chatBubbleManager = make_shared(); m_paneManager.displayRegisteredPane(MainInterfacePanes::ActionBar); -- cgit v1.2.3