diff --git a/common/include/editor/editor.h b/common/include/editor/editor.h index a8693c66e..26d9952f0 100644 --- a/common/include/editor/editor.h +++ b/common/include/editor/editor.h @@ -353,7 +353,7 @@ void assign_default_uvs_to_side(vsegptridx_t segp, int side); void med_assign_uvs_to_side(vsegptridx_t con_seg, int con_common_side, vsegptr_t base_seg, int base_common_side, int abs_id1, int abs_id2); // Create coordinate axes in orientation of specified segment, stores vertices at *vp. -void create_coordinate_axes_from_segment(vsegptr_t sp,array &vertnums); +void create_coordinate_axes_from_segment(vsegptr_t sp, array &vertnums); // Set Vertex_active to number of occurrences of each vertex. // Set Num_vertices. diff --git a/common/main/gameseg.h b/common/main/gameseg.h index d4bd8b679..1282c921c 100644 --- a/common/main/gameseg.h +++ b/common/main/gameseg.h @@ -52,7 +52,7 @@ struct side_vertnum_list_t : array {}; struct vertex_array_list_t : array {}; struct vertex_vertnum_pair { - int vertex, vertnum; + unsigned vertex, vertnum; }; using vertex_vertnum_array_list = array; } diff --git a/common/main/render.h b/common/main/render.h index e1d128355..2845022a4 100644 --- a/common/main/render.h +++ b/common/main/render.h @@ -115,10 +115,10 @@ void render_start_frame(void); // Given a list of point numbers, rotate any that haven't been rotated // this frame -g3s_codes rotate_list(std::size_t nv, const int *pointnumlist); +g3s_codes rotate_list(std::size_t nv, const unsigned *pointnumlist); -template -static inline g3s_codes rotate_list(const array &a) +template +static inline g3s_codes rotate_list(const array &a) { return rotate_list(a.size(), &a[0]); } diff --git a/common/main/segment.h b/common/main/segment.h index 6069dcb35..46abbabbc 100644 --- a/common/main/segment.h +++ b/common/main/segment.h @@ -169,7 +169,7 @@ struct segment { #if defined(DXX_BUILD_DESCENT_II) uint8_t slide_textures; #endif - array verts; // vertex ids of 4 front and 4 back vertices + array verts; // vertex ids of 4 front and 4 back vertices ubyte special; // what type of center this is sbyte matcen_num; // which center segment is associated with. #if defined(DXX_BUILD_DESCENT_I) diff --git a/similar/editor/meddraw.cpp b/similar/editor/meddraw.cpp index 28f8513de..01274fc99 100644 --- a/similar/editor/meddraw.cpp +++ b/similar/editor/meddraw.cpp @@ -683,7 +683,7 @@ static void free_vert(int vert_num) // ----------------------------------------------------------------------------- static void draw_coordinate_axes(void) { - array Axes_verts; + array Axes_verts; vms_vector tvec; range_for (auto &i, Axes_verts) diff --git a/similar/editor/segment.cpp b/similar/editor/segment.cpp index aba1b15e9..3600dbb9f 100644 --- a/similar/editor/segment.cpp +++ b/similar/editor/segment.cpp @@ -1492,7 +1492,7 @@ void init_all_vertices(void) // ----------------------------------------------------------------------------- // Create coordinate axes in orientation of specified segment, stores vertices at *vp. -void create_coordinate_axes_from_segment(const vsegptr_t sp,array &vertnums) +void create_coordinate_axes_from_segment(const vsegptr_t sp, array &vertnums) { vms_matrix rotmat; vms_vector t; diff --git a/similar/main/automap.cpp b/similar/main/automap.cpp index 7a039d7ee..2f68781e6 100644 --- a/similar/main/automap.cpp +++ b/similar/main/automap.cpp @@ -104,7 +104,7 @@ namespace { struct Edge_info { - array verts; // 8 bytes + array verts; // 8 bytes array sides; // 4 bytes array segnum; // 16 bytes // This might not need to be stored... If you can access the normals of a side. ubyte flags; // 1 bytes // See the EF_??? defines above. diff --git a/similar/main/gameseg.cpp b/similar/main/gameseg.cpp index 0c9b22f00..728a9ad06 100644 --- a/similar/main/gameseg.cpp +++ b/similar/main/gameseg.cpp @@ -58,14 +58,14 @@ namespace { class abs_vertex_lists_predicate { - const array &m_vp; + const array &m_vp; const array &m_sv; public: abs_vertex_lists_predicate(const vcsegptr_t segp, uint_fast32_t sidenum) : m_vp(segp->verts), m_sv(Side_to_verts_int[sidenum]) { } - int operator()(const uint_fast32_t vv) const + unsigned operator()(const uint_fast32_t vv) const { return m_vp[m_sv[vv]]; } @@ -80,7 +80,7 @@ public: } vertex_vertnum_pair operator()(const uint_fast32_t vv) const { - return {this->abs_vertex_lists_predicate::operator()(vv), static_cast(vv)}; + return {this->abs_vertex_lists_predicate::operator()(vv), static_cast(vv)}; } }; diff --git a/similar/main/lighting.cpp b/similar/main/lighting.cpp index 4222749ba..00a6fdf15 100644 --- a/similar/main/lighting.cpp +++ b/similar/main/lighting.cpp @@ -508,7 +508,8 @@ void set_dynamic_light(render_state_t &rstate) auto &vp = Segments[segnum].verts; range_for (const auto vnum, vp) { - if (vnum<0 || vnum>Highest_vertex_index) { + if (vnum > Highest_vertex_index) + { Int3(); //invalid vertex number continue; //ignore it, and go on to next one } diff --git a/similar/main/render.cpp b/similar/main/render.cpp index 1504a9628..069a299e8 100644 --- a/similar/main/render.cpp +++ b/similar/main/render.cpp @@ -712,7 +712,7 @@ void render_start_frame() } //Given a lit of point numbers, rotate any that haven't been rotated this frame -g3s_codes rotate_list(std::size_t nv,const int *pointnumlist) +g3s_codes rotate_list(const std::size_t nv, const unsigned *const pointnumlist) { g3s_codes cc; const auto current_generation = s_current_generation; @@ -746,7 +746,7 @@ g3s_codes rotate_list(std::size_t nv,const int *pointnumlist) } //Given a lit of point numbers, project any that haven't been projected -static void project_list(const array &pointnumlist) +static void project_list(const array &pointnumlist) { range_for (const auto pnum, pointnumlist) { @@ -893,7 +893,7 @@ constexpr array< //given an edge, tell what side is on that edge __attribute_warn_unused_result -static int find_seg_side(const vcsegptr_t seg,const array &verts,unsigned notside) +static int find_seg_side(const vcsegptr_t seg, const array &verts, const unsigned notside) { if (notside >= MAX_SIDES_PER_SEGMENT) throw std::logic_error("invalid notside"); @@ -963,7 +963,7 @@ static bool compare_children(const vcsegptridx_t seg, sidenum_fast_t s0, sidenum if (Side_opposite[s0] == s1) return false; //find normals of adjoining sides - const array edge_verts = { + const array edge_verts = { {seg->verts[Two_sides_to_edge[s0][s1][0]], seg->verts[Two_sides_to_edge[s0][s1][1]]} }; if (edge_verts[0] == -1 || edge_verts[1] == -1)