Commit graph

4137 commits

Author SHA1 Message Date
Kp 43e1c841f0 Pass polymodel& to polymodel_read 2022-10-09 23:15:20 +00:00
Kp acae546a90 Pass polymodel& to draw_model_picture, draw_polygon_model 2022-10-09 23:15:20 +00:00
Kp 910ac7fd4a Use template alias for per-team arrays 2022-10-09 23:15:20 +00:00
Kp fcb6beb3e8 Add check that d_array<E> is not unsigned int or unsigned long
`std::size_t` is `unsigned int` on i686-pc-linux-gnu, but is `unsigned
long` on x86_64-pc-linux-gnu.  This mismatch allows d_array<E =
std::size_t> to be well-formed on x86_64, but trigger a duplicate
definition of operator[](E) on i686.  Add a requires() check that
forbids both types for E, so that code which would break the i686 build
is also diagnosed in the x86_64 build.
2022-10-09 23:15:20 +00:00
Kp f61db8ae7a Make enumerate() default to std::size_t for index_type
Change from `uint_fast32_t` to `std::size_t` for consistency with how
arrays are typically indexed.

Change the decltype() lookup to use a non-template function for the
fallback case.

Move the remove_reference logic into the caller, to allow fewer
instantiations of `array_index_type`.
2022-10-09 23:15:20 +00:00
Kp 9716d42ea0 Use enum class for pig_hamfile_version 2022-10-09 23:15:20 +00:00
Kp e385ff1c3b Use std::ranges::find_if instead of std::find_if
std::ranges::find_if permits use of a sentinel instead of a full
iterator, and supports std::ranges::find as an alternative to certain
simple uses of std::find_if.

Where possible, use the form that takes a range, rather than the form
that takes two iterators.

Add a declared, but not defined, default constructor for
self_return_iterator to satisfy the standard library's concept
`semiregular`, which insists that sentinels be default-constructible,
even for those functions that never need to do so.

Add a defined, but unused, operator++(postfix) for zip_iterator to
satisfy a standard library concept for `forward_iterator`.
2022-10-09 23:15:20 +00:00
Kp 0ebcc64ac5 Test whether change_filename_extension succeeded before using its output 2022-10-09 23:15:20 +00:00
Kp b0ebe3b82c Tighten change_filename_extension handling of overflow 2022-10-09 23:15:20 +00:00
Kp a9142bb65a Use std::span for change_filename_extension arguments 2022-10-09 23:15:20 +00:00
Kp 7c0fb7b12a Use std::span for load_bitmap_replacements argument level_name 2022-10-09 23:15:20 +00:00
Kp 38adcc7729 Simplify change_filename_extension
The called function skipped over a leading dot in the extension.  Remove
that logic and change all callers not to supply a leading dot.
2022-10-09 23:15:20 +00:00
Kp 9c4c49fe5e Return std::unique_ptr from d_strdup 2022-10-09 23:15:20 +00:00
Kp d74dbeb79d Add constexpr to SConf operator== test
This allows using static_assert instead of a runtime comparison.
2022-10-09 23:15:20 +00:00
Kp fbc184500d Use explicitly defaulted operator== for vms_vector 2022-10-09 23:15:19 +00:00
Kp 017e786139 Use explicitly defaulted font_scale_proportion::operator== 2022-10-09 23:15:19 +00:00
Kp c638a1f237 Make valptridx comparison operators constexpr 2022-10-09 23:15:19 +00:00
Kp 32e819a9e7 Remove unnecessary explicit definition of WALL_IS_DOORWAY_result_t::operator!= 2022-10-09 23:15:19 +00:00
Kp beb4cde9cb Remove definition of segment_object_range_t<T>::iterator::operator!= 2022-10-09 23:15:19 +00:00
Kp 49fccd64ad Use explicitly defaulted callsign_t::operator== 2022-10-09 23:15:19 +00:00
Kp 5d412f3c19 Remove unnecessary explicit definition of enumerated_iterator::operator!= 2022-10-09 23:15:19 +00:00
Kp 1a42696a2b Remove unnecessary explicit definition of valptridx<T>::ptridx::operator!= 2022-10-09 23:15:19 +00:00
Kp a4fe31c972 Remove unnecessary explicit definition of valptridx<T>::idx::operator!= 2022-10-09 23:15:19 +00:00
Kp f40b7ba315 Use explicitly defaulted rgb_t::operator== 2022-10-09 23:15:19 +00:00
Kp dd1aed76c5 Remove unnecessary explicit definition of null_sentinel_iterator::operator!= 2022-10-09 23:15:19 +00:00
Kp d443151f84 Remove unnecessary explicit definition of ntstring::operator!= 2022-10-09 23:15:19 +00:00
Kp 4279e56948 Remove unnecessary explicit definition of screen_mode::operator!= 2022-10-09 23:15:19 +00:00
Kp 0b62b62619 Remove unnecessary explicit definition of tmap_drawer_type::operator!= 2022-10-09 23:15:19 +00:00
Kp c1a8a3b8e3 Explicitly default xrange_iterator::operator==
Replace operator!= with an implicitly defaulted definition, which will
use the new explicitly defaulted operator==.
2022-10-09 23:15:19 +00:00
Kp f5258f95b1 Simplify partial_range check_range_index_type_vs_provided_index_type 2022-10-02 19:51:36 +00:00
Kp 3379078f04 Pass std::span to PHYSFSX_puts 2022-10-02 19:51:36 +00:00
Kp e0123dead5 Remove special case for 0 argument PHYSFSX_printf
Fix the remaining sites that were redirected by this.  Remove the
redirection macro.
2022-10-02 19:51:36 +00:00
Kp 01c07156bd Remove special case for 0 argument HUD_init_message
Fix the one remaining site that was redirected by this.  Remove the
redirection macro, so that the literal and variadic forms can have
differing types for their string field.
2022-10-02 19:51:36 +00:00
Kp 98b7679732 Remove obsolete MacOS C source files
These are not referenced in SConstruct.  messagebox.c uses C linkage for
symbols that would be referenced from a C++ file, so this has likely
been broken since the common code moved to C++.
2022-10-02 19:51:36 +00:00
Kp f3d4dff941 Use enum class for clipping_code
Adjust code_window_point to use the same masks as clipping_code.
Previously, it had top and bottom swapped.  However, since its output
was only ever compared for equality to 0, this transposition should not
affect the observable behavior.
2022-10-02 19:51:35 +00:00
Kp 6c32eb3970 Remove unused return value of g3_add_delta_vec 2022-10-02 19:51:35 +00:00
Kp 1808b6badd Use enum class for projection_flag 2022-10-02 19:51:35 +00:00
Kp aaac0e69fa Use std::span for piggy_new_pigfile argument pigname 2022-10-02 19:51:35 +00:00
Kp eca189e8aa Use enum class for SoundOffset
Change piggy_register_sound to take the sound offset as a parameter,
rather than assuming the caller will set SoundOffset accordingly.

Remove a spurious sound reset in piggy_register_bitmap.  Based on the
duplicated comment, this was probably incorrectly copied from
piggy_register_sound, where it made sense, into piggy_register_bitmap,
where it does not.
2022-10-02 19:51:35 +00:00
Kp 14bf2dc59a Pass std::span to piggy_register_bitmap 2022-10-02 19:51:35 +00:00
Kp 1bda6f4792 Remove dead declaration of g3_check_codes 2022-10-02 19:51:35 +00:00
Kp ad8f970bf6 Pass g3s_point & to free_temp_point
Only one point is freed at a time, so pass by reference.
2022-10-02 19:51:35 +00:00
Kp a8c4aee5f0 Fix compilation of valptridx unit tests
Newer gcc has become more effective at propagating values and now proves
that certain tests will always throw.  This proof triggers a
compile-time error, which is desirable in the main program, but not in
the unit test.  Add an indirection to hide the value from the compiler
so that it is forced to emit runtime code, which can then throw and
catch as intended.
2022-10-02 19:51:35 +00:00
Kp f0d118ed42 Use std::span for PHYSFSX_fgets 2022-10-02 19:51:35 +00:00
Kp 8fe9b8322d Check return value of PHYSFSX_fgets 2022-10-02 19:51:35 +00:00
Kp a55579bb8f Flatten net_udp call chain for ntstring::copy_out 2022-10-02 19:51:35 +00:00
Kp 98916ca6b7 Remove obsolete ntstring methods 2022-10-02 19:51:35 +00:00
Kp e3faab0899 Use alias template per_player_array for arrays that are MAX_PLAYERS long
This removes the need to repeat MAX_PLAYERS in every usage, and prepares
for a future change to use enumerated_array instead of std::array.
2022-09-24 17:47:53 +00:00
Kp 53d81e78de Fix SDL2 double-free on failure to load music
Fixes: 0142c02edd ("Use Mix_LoadMUSType_RW for named files, too")
2022-09-24 17:47:53 +00:00
Kp 9d238eedf8 Pass std::span to callsign_t::copy 2022-09-24 17:47:53 +00:00