diff --git a/source/application/StarRenderer_opengl20.hpp b/source/application/StarRenderer_opengl20.hpp index 4d917d5..cbf3924 100644 --- a/source/application/StarRenderer_opengl20.hpp +++ b/source/application/StarRenderer_opengl20.hpp @@ -143,7 +143,7 @@ private: HashSet usedTextures; List vertexBuffers; - bool useMultiTexturing; + bool useMultiTexturing{true}; }; struct EffectParameter { diff --git a/source/base/StarCellularLighting.cpp b/source/base/StarCellularLighting.cpp index 49c5676..e4fe8dd 100644 --- a/source/base/StarCellularLighting.cpp +++ b/source/base/StarCellularLighting.cpp @@ -2,8 +2,13 @@ namespace Star { -CellularLightingCalculator::CellularLightingCalculator(bool monochrome) { - setMonochrome(monochrome); +CellularLightingCalculator::CellularLightingCalculator(bool monochrome) + : m_monochrome(monochrome) +{ + if (monochrome) + m_lightArray.setRight(ScalarCellularLightArray()); + else + m_lightArray.setLeft(ColoredCellularLightArray()); } void CellularLightingCalculator::setMonochrome(bool monochrome) { diff --git a/source/base/StarCellularLighting.hpp b/source/base/StarCellularLighting.hpp index 30aa489..c82032c 100644 --- a/source/base/StarCellularLighting.hpp +++ b/source/base/StarCellularLighting.hpp @@ -17,7 +17,7 @@ namespace Star { // individually. class CellularLightingCalculator { public: - CellularLightingCalculator(bool monochrome = false); + explicit CellularLightingCalculator(bool monochrome = false); typedef ColoredCellularLightArray::Cell Cell; diff --git a/source/frontend/StarCinematic.cpp b/source/frontend/StarCinematic.cpp index 40fc8d1..7b095a6 100644 --- a/source/frontend/StarCinematic.cpp +++ b/source/frontend/StarCinematic.cpp @@ -12,7 +12,6 @@ const float vWidth = 960.0f; const float vHeight = 540.0f; Cinematic::Cinematic() { - m_completionTime = 0; m_completable = false; m_suppressInput = false; } @@ -342,7 +341,7 @@ float Cinematic::currentTimecode() const { Cinematic::PanelValues Cinematic::determinePanelValues(PanelPtr panel, float timecode) { if (panel->endTime != 0) { if (timecode > panel->endTime) { - Cinematic::PanelValues result; + Cinematic::PanelValues result{}; result.alpha = 0; return result; } @@ -350,7 +349,7 @@ Cinematic::PanelValues Cinematic::determinePanelValues(PanelPtr panel, float tim if (panel->startTime != 0) { if (timecode < panel->startTime) { - Cinematic::PanelValues result; + Cinematic::PanelValues result{}; result.alpha = 0; return result; } else { diff --git a/source/frontend/StarCinematic.hpp b/source/frontend/StarCinematic.hpp index 96f40e7..a86523a 100644 --- a/source/frontend/StarCinematic.hpp +++ b/source/frontend/StarCinematic.hpp @@ -109,33 +109,33 @@ private: // these include the time for background fades so they may not reflect the completion timecode Clock m_timer; - float m_completionTime; + float m_completionTime{}; Maybe m_backgroundColor; - float m_backgroundFadeTime; + float m_backgroundFadeTime{}; - float m_cameraZoom; - Vec2F m_cameraPan; + float m_cameraZoom{1.0f}; + Vec2F m_cameraPan{}; - float m_drawableScale; - Vec2F m_drawableTranslation; - Vec2F m_windowSize; - RectI m_scissorRect; + float m_drawableScale{1.0f}; + Vec2F m_drawableTranslation{}; + Vec2F m_windowSize{}; + RectI m_scissorRect{}; - bool m_scissor; - bool m_letterbox; + bool m_scissor{true}; + bool m_letterbox{true}; PlayerPtr m_player; - Vec2F m_offset; + Vec2F m_offset{}; - bool m_skippable; - bool m_suppressInput; + bool m_skippable{true}; + bool m_suppressInput{false}; - bool m_muteSfx; - bool m_muteMusic; + bool m_muteSfx{false}; + bool m_muteMusic{false}; - bool m_completable; + bool m_completable{false}; }; } 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); diff --git a/source/frontend/StarMainInterface.hpp b/source/frontend/StarMainInterface.hpp index adba4e6..91a63ab 100644 --- a/source/frontend/StarMainInterface.hpp +++ b/source/frontend/StarMainInterface.hpp @@ -154,11 +154,11 @@ private: void displayScriptPane(ScriptPanePtr& scriptPane, EntityId sourceEntity); - GuiContext* m_guiContext; + GuiContext* m_guiContext{nullptr}; MainInterfaceConfigConstPtr m_config; InterfaceCursor m_cursor; - RunningState m_state; + RunningState m_state{Running}; UniverseClientPtr m_client; WorldPainterPtr m_worldPainter; @@ -192,7 +192,7 @@ private: WirePanePtr m_wireInterface; ActionBarPtr m_actionBar; - Vec2I m_cursorScreenPos; + Vec2I m_cursorScreenPos{}; ItemSlotWidgetPtr m_cursorItem; Maybe m_cursorTooltip; @@ -201,29 +201,29 @@ private: GameTimer m_debugSpatialClearTimer; GameTimer m_debugMapClearTimer; - RectF m_debugTextRect; + RectF m_debugTextRect{RectF::null()}; NameplatePainterPtr m_nameplatePainter; QuestIndicatorPainterPtr m_questIndicatorPainter; ChatBubbleManagerPtr m_chatBubbleManager; - bool m_disableHud; + bool m_disableHud{false}; String m_lastCommand; LinkedList m_messages; HashMap> m_itemDropMessages; - unsigned m_messageOverflow; + unsigned m_messageOverflow{}; GuiMessagePtr m_overflowMessage; List>> m_queuedJoinRequests; - EntityId m_lastMouseoverTarget; + EntityId m_lastMouseoverTarget{NullEntityId}; GameTimer m_stickyTargetingTimer; - int m_portraitScale; + int m_portraitScale{}; - EntityId m_specialDamageBarTarget; - float m_specialDamageBarValue; + EntityId m_specialDamageBarTarget{NullEntityId}; + float m_specialDamageBarValue{}; ContainerInteractorPtr m_containerInteractor; }; diff --git a/source/game/StarSystemWorldServerThread.cpp b/source/game/StarSystemWorldServerThread.cpp index fb5cea5..55488e0 100644 --- a/source/game/StarSystemWorldServerThread.cpp +++ b/source/game/StarSystemWorldServerThread.cpp @@ -5,9 +5,11 @@ namespace Star { SystemWorldServerThread::SystemWorldServerThread(Vec3I const& location, SystemWorldServerPtr systemWorld, String storageFile) - : Thread(strf("SystemWorldServer: {}", location)), m_stop(false), m_storageFile(storageFile) { - m_systemLocation = location; - m_systemWorld = move(systemWorld); + : Thread(strf("SystemWorldServer: {}", location)) + , m_systemLocation(location) + , m_systemWorld(move(systemWorld)) + , m_storageFile(storageFile) +{ } SystemWorldServerThread::~SystemWorldServerThread() { diff --git a/source/game/StarSystemWorldServerThread.hpp b/source/game/StarSystemWorldServerThread.hpp index f81749e..6e09260 100644 --- a/source/game/StarSystemWorldServerThread.hpp +++ b/source/game/StarSystemWorldServerThread.hpp @@ -48,9 +48,9 @@ private: Vec3I m_systemLocation; SystemWorldServerPtr m_systemWorld; - atomic m_stop; - float m_periodicStorage; - bool m_triggerStorage; + atomic m_stop{false}; + float m_periodicStorage{300.0f}; + bool m_triggerStorage{ false}; String m_storageFile; shared_ptr> m_pause; diff --git a/source/game/StarWorldServer.hpp b/source/game/StarWorldServer.hpp index 24436b6..ff93c81 100644 --- a/source/game/StarWorldServer.hpp +++ b/source/game/StarWorldServer.hpp @@ -362,7 +362,7 @@ private: StringMap m_scriptContexts; WorldGeometry m_geometry; - uint64_t m_currentStep; + uint64_t m_currentStep{}; mutable CellularLightIntensityCalculator m_lightIntensityCalculator; SkyPtr m_sky; diff --git a/source/rendering/StarEnvironmentPainter.hpp b/source/rendering/StarEnvironmentPainter.hpp index 7367095..d439acd 100644 --- a/source/rendering/StarEnvironmentPainter.hpp +++ b/source/rendering/StarEnvironmentPainter.hpp @@ -69,7 +69,7 @@ private: double m_timer; PerlinF m_rayPerlin; - uint64_t m_starsHash; + uint64_t m_starsHash{}; List m_starTextures; shared_ptr>> m_starGenerator; List, double>>> m_debrisGenerators;