From 0929ea5853e0dcf6629d2e0acf17a69cef7e48b7 Mon Sep 17 00:00:00 2001 From: Karl Robillard Date: Sat, 2 Nov 2024 09:15:27 -0400 Subject: [PATCH 1/4] Fix GCC -Wreorder warnings. --- src/SystemView.cpp | 8 ++++---- src/collider/CollisionContact.h | 4 ++-- src/galaxy/StarSystem.cpp | 2 +- src/pigui/PerfInfo.cpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/SystemView.cpp b/src/SystemView.cpp index 98e3adf6fc..c2b3714052 100644 --- a/src/SystemView.cpp +++ b/src/SystemView.cpp @@ -306,15 +306,15 @@ SystemMapViewport::SystemMapViewport(GuiApplication *app) : m_app(app), m_renderer(app->GetRenderer()), m_displayMode(SystemView::Mode::Orrery), + m_atlasZoom(1.0f), + m_atlasZoomTo(1.0f), + m_atlasPos(vector2f()), m_showGravpoints(false), m_showL4L5(LAG_OFF), m_shipDrawing(OFF), m_gridDrawing(GridDrawing::OFF), - m_atlasPos(vector2f()), - m_atlasZoom(1.0f), - m_atlasZoomTo(1.0f), - m_rot_y(0), m_rot_x(50), + m_rot_y(0), m_zoom(1.0f / float(AU)), m_trans(0.0), m_transTo(0.0), diff --git a/src/collider/CollisionContact.h b/src/collider/CollisionContact.h index 663f4f6fd9..196f5eeecd 100644 --- a/src/collider/CollisionContact.h +++ b/src/collider/CollisionContact.h @@ -36,9 +36,9 @@ struct CollisionContact { distance(0), timestep(dt), triIdx(-1), + geomFlag(0), userData1(u1), - userData2(u2), - geomFlag(0) + userData2(u2) {} }; diff --git a/src/galaxy/StarSystem.cpp b/src/galaxy/StarSystem.cpp index e75dbdffa1..989213d435 100644 --- a/src/galaxy/StarSystem.cpp +++ b/src/galaxy/StarSystem.cpp @@ -222,6 +222,7 @@ SystemPath StarSystem::GetPathOf(const SystemBody *sbody) const StarSystem::StarSystem(const SystemPath &path, RefCountedPtr galaxy, StarSystemCache *cache, Random &rand) : m_galaxy(galaxy), m_path(path.SystemOnly()), + m_pos(0.0), m_numStars(0), m_isCustom(false), m_faction(nullptr), @@ -229,7 +230,6 @@ StarSystem::StarSystem(const SystemPath &path, RefCountedPtr galaxy, Sta m_exploredTime(0.0), m_econType(GalacticEconomy::InvalidEconomyId), m_seed(0), - m_pos(0.0), m_tradeLevel(GalacticEconomy::Commodities().size() + 1, 0), m_commodityLegal(GalacticEconomy::Commodities().size() + 1, true), m_cache(cache) diff --git a/src/pigui/PerfInfo.cpp b/src/pigui/PerfInfo.cpp index 963ded548c..de2fbcc51b 100644 --- a/src/pigui/PerfInfo.cpp +++ b/src/pigui/PerfInfo.cpp @@ -63,12 +63,12 @@ PerfInfo::CounterInfo::CounterInfo(const char *n, const char *u, uint32_t recent } PerfInfo::PerfInfo() : - m_state(new ImGuiState({})), m_fpsCounter("Frame Time", "ms"), m_physCounter("Update Time", "ms"), m_piguiCounter("PiGui Time", "ms"), m_procMemCounter("Process memory usage", "MB", 1), - m_luaMemCounter("Lua memory usage", "MB", 1) + m_luaMemCounter("Lua memory usage", "MB", 1), + m_state(new ImGuiState({})) { } From feb1847381fadf3ef9b609aab9f08adbc7f8632c Mon Sep 17 00:00:00 2001 From: Karl Robillard Date: Sat, 2 Nov 2024 13:36:58 -0400 Subject: [PATCH 2/4] Fix GCC -Wunused-variable warning. --- src/pigui/Widgets.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pigui/Widgets.cpp b/src/pigui/Widgets.cpp index 78cea44ec6..4126db58f0 100644 --- a/src/pigui/Widgets.cpp +++ b/src/pigui/Widgets.cpp @@ -82,7 +82,6 @@ int Draw::RadialPopupSelectMenu(const ImVec2 center, const char *popup_id, int m if (drag_angle >= item_inner_ang_min && drag_angle < item_inner_ang_max) hovered = true; } - bool selected = false; int arc_segments = static_cast((64 * item_arc_span / (2 * IM_PI))) + 1; draw_list->_PathArcToN(center, RADIUS_MAX - border_inout, item_outer_ang_min, item_outer_ang_max, arc_segments); From 1c713bca27e6226b67fe820c8662458b875950e3 Mon Sep 17 00:00:00 2001 From: Karl Robillard Date: Mon, 4 Nov 2024 13:02:26 -0500 Subject: [PATCH 3/4] Fix three GCC -Wsign-compare warnings by using appropriate types. --- src/Background.cpp | 2 +- src/collider/GeomTree.cpp | 26 +++++++++++++------------- src/collider/GeomTree.h | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Background.cpp b/src/Background.cpp index bf6447dfe9..4cf1c00900 100644 --- a/src/Background.cpp +++ b/src/Background.cpp @@ -367,7 +367,7 @@ namespace Background { RefCountedPtr galaxy; const StarQueryInfo info; - const int32_t starsLimit; + const size_t starsLimit; StarInfo &stars; double &medianBrightness; }; diff --git a/src/collider/GeomTree.cpp b/src/collider/GeomTree.cpp index 4ba679d3e7..d0853f1a81 100644 --- a/src/collider/GeomTree.cpp +++ b/src/collider/GeomTree.cpp @@ -26,7 +26,7 @@ GeomTree::GeomTree(const int numVerts, const int numTris, const std::vector(vertices.size()) == m_numVertices); + assert(vertices.size() == m_numVertices); m_aabb.min = vector3d(FLT_MAX, FLT_MAX, FLT_MAX); m_aabb.max = vector3d(-FLT_MAX, -FLT_MAX, -FLT_MAX); @@ -133,7 +133,7 @@ GeomTree::GeomTree(const int numVerts, const int numTris, const std::vector> ed.v1i >> ed.v2i >> ed.len >> ed.dir >> ed.triFlag; } } m_vertices.resize(m_numVertices); - for (Sint32 iVert = 0; iVert < m_numVertices; ++iVert) { + for (uint32_t iVert = 0; iVert < m_numVertices; ++iVert) { m_vertices[iVert] = rd.Vector3f(); } - const int numIndicies(m_numTris * 3); + const uint32_t numIndicies(m_numTris * 3); m_indices.resize(numIndicies); - for (Sint32 iIndi = 0; iIndi < numIndicies; ++iIndi) { + for (uint32_t iIndi = 0; iIndi < numIndicies; ++iIndi) { m_indices[iIndi] = rd.Int32(); } m_triFlags.resize(m_numTris); - for (Sint32 iTri = 0; iTri < m_numTris; ++iTri) { + for (uint32_t iTri = 0; iTri < m_numTris; ++iTri) { m_triFlags[iTri] = rd.Int32(); } @@ -209,7 +209,7 @@ GeomTree::GeomTree(Serializer::Reader &rd) // TODO: triangle AABBs should be written to the SGM file similarly to edge AABBs m_triAABBs.reset(new AABBd[m_numTris]); - for (size_t i = 0; i < m_numTris; i++) { + for (uint32_t i = 0; i < m_numTris; i++) { const vector3d v0 = vector3d(m_vertices[m_indices[i * 3 + 0]]); const vector3d v1 = vector3d(m_vertices[m_indices[i * 3 + 1]]); const vector3d v2 = vector3d(m_vertices[m_indices[i * 3 + 2]]); @@ -292,26 +292,26 @@ void GeomTree::Save(Serializer::Writer &wr) const // loaded in future SGM versions rather than being re-computed on each load wr.Int32(m_numEdges); - for (Sint32 iAabb = 0; iAabb < m_numEdges; ++iAabb) { + for (uint32_t iAabb = 0; iAabb < m_numEdges; ++iAabb) { AABBd &aabb = m_edgeAABBs.get()[iAabb]; // Write back an old-style min-max-radius Aabb for compatibility with old SGM versions wr << aabb.min << aabb.max << double(0.0); } - for (Sint32 iEdge = 0; iEdge < m_numEdges; ++iEdge) { + for (uint32_t iEdge = 0; iEdge < m_numEdges; ++iEdge) { auto &ed = m_edges[iEdge]; wr << ed.v1i << ed.v2i << ed.len << ed.dir << ed.triFlag; } - for (Sint32 iVert = 0; iVert < m_numVertices; ++iVert) { + for (uint32_t iVert = 0; iVert < m_numVertices; ++iVert) { wr.Vector3f(m_vertices[iVert]); } - for (Sint32 iIndi = 0; iIndi < (m_numTris * 3); ++iIndi) { + for (uint32_t iIndi = 0; iIndi < (m_numTris * 3); ++iIndi) { wr.Int32(m_indices[iIndi]); } - for (Sint32 iTri = 0; iTri < m_numTris; ++iTri) { + for (uint32_t iTri = 0; iTri < m_numTris; ++iTri) { wr.Int32(m_triFlags[iTri]); } } diff --git a/src/collider/GeomTree.h b/src/collider/GeomTree.h index dc5823bd5c..8fe1d183a6 100644 --- a/src/collider/GeomTree.h +++ b/src/collider/GeomTree.h @@ -70,9 +70,9 @@ class GeomTree { void RayTriIntersect(int numRays, const vector3f &origin, const vector3f *dirs, int triIdx, isect_t *isects) const; private: - int m_numVertices; - int m_numEdges; - int m_numTris; + uint32_t m_numVertices; + uint32_t m_numEdges; + uint32_t m_numTris; double m_radius; Aabb m_aabb; From b10991b29447ba4a9ff5f1e1706034b564e57c1c Mon Sep 17 00:00:00 2001 From: Karl Robillard Date: Sat, 2 Nov 2024 17:42:35 -0400 Subject: [PATCH 4/4] lookup3.h: Remove SDL dependency. --- contrib/jenkins/lookup3.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/jenkins/lookup3.h b/contrib/jenkins/lookup3.h index 43a55e54cf..e7dbd13a0d 100644 --- a/contrib/jenkins/lookup3.h +++ b/contrib/jenkins/lookup3.h @@ -1,7 +1,8 @@ #ifndef _LOOKUP3_H #define _LOOKUP3_H -#include +#include +#include uint32_t lookup3_hashword( const uint32_t *k, /* the key, an array of uint32_t values */