Commit graph

2245 commits

Author SHA1 Message Date
Kp b4866b8e09 Let self_return_iterator use an implicit operator!= 2022-12-18 18:32:14 +00:00
Kp 64eae78dcc Prefer direct initialization for bitmap_index 2022-12-18 18:32:14 +00:00
Kp 4257391a47 Use enum class for polygon_model_index 2022-12-18 18:32:14 +00:00
Kp cba14b91e4 Pass std::span to piggy_find_sound 2022-12-17 13:16:28 +00:00
Kp 102d19ec28 Pass std::span to piggy_find_bitmap 2022-12-17 13:16:28 +00:00
Kp 8bd94c4f5c Pass std::span to piggy_register_sound 2022-12-17 13:16:28 +00:00
Kp 5f39ffc2f5 Use enum class for sound_channel 2022-12-17 13:16:28 +00:00
Kp afb7406127 Pass std::span to callsign_t::copy_lower 2022-12-10 18:09:54 +00:00
Kp 1b92a56648 Use unique_ptr to manage digi_sound allocation 2022-12-10 18:09:54 +00:00
Kp 3ef8cb1e14 Let self_return_iterator::operator== use an implicit T::operator== 2022-12-10 18:09:54 +00:00
Kp 8decd6ec99 Simplify DXX_ALWAYS_ERROR_FUNCTION
Since this should never be invoked, simplify the definition.  The new
version is slightly less informative in case a logic error causes it to
be called, but is far shorter and easier to understand.
2022-12-10 18:09:54 +00:00
Kp d1b55a15ac Pass robot_info to move_towards_segment_center 2022-12-02 04:09:20 +00:00
Kp d84b362f33 Use uint16_t for newmenu input text length 2022-11-13 21:17:23 +00:00
Kp a193af2e16 Use direct initialization for newmenu::type 2022-11-13 21:17:23 +00:00
Kp 211d6167b2 Inline object_create_muzzle_flash into callers
object_create_muzzle_flash delegated to
object_create_explosion_without_damage, adding one parameter that
callers ought to provide instead.  Inline object_create_muzzle_flash into
callers and change them to provide `Vclip`.
2022-11-13 21:17:23 +00:00
Kp 562fee9d09 Use #if for DXX_HAVE_CXX_BUILTIN_FILE_LINE 2022-11-10 02:04:09 +00:00
Kp e2c61f6aee Pass context to init_morphs 2022-11-07 01:59:34 +00:00
Kp 70505e69d0 Use enum class for delta_light_index 2022-11-07 01:59:34 +00:00
Kp e9b4711d87 Inline object_create_explosion into callers
`object_create_explosion` delegated to
`object_create_explosion_without_damage`, adding one parameter that
callers ought to provide instead.  Inline `object_create_explosion` into
callers and change them to provide `Vclip`.
2022-11-07 01:59:34 +00:00
Kp da779e27b7 Generalize zip get_static_size to use tuple_size
This allows it to work on pairs, tuples, and any types that define a
reasonable overload of tuple_size.

Add unit tests for the known supported types.
2022-11-07 01:59:34 +00:00
Kp 962a37e75e Backport more ranges support for OS X clang
Apple clang is currently version 14, but Apple's libc++ is version 13,
and so lacks even more std::ranges support than previously reported.
Add more stub backports to work around this.
2022-11-06 18:18:57 +00:00
Kp 3d5de92058 Fix OS X clang build
OS X still uses clang-14, which lacks sufficient std::ranges support for
recent Rebirth changes.

- Rewrite uses of std::ranges::SYMBOL to ranges::SYMBOL
- Add a stub header that, on gcc, provides for each SYMBOL a statement
  `using std::ranges::SYMBOL;`, to delegate back to the standard library
  implementation.
- On clang, define a minimal implementation of the required symbols,
  without constraint enforcement.  Compile-testing with gcc will catch
  constraint violations.

Once OS X clang ships a standard library with the required features,
this stub header will be removed and the uses changed back to their full
names.
2022-10-31 00:51:32 +00:00
Kp 862c1f0aab Pass std::span to multi_process_bigdata 2022-10-23 23:00:24 +00:00
Kp f6c45d0f6f Use enum class for multiplayer_command_t 2022-10-23 23:00:24 +00:00
Kp 16698137ea Enable gcc attribute suggestion warnings
Adding `final` can allow gcc to devirtualize a call.  Request compiler
warnings wherever `final` would improve this.  As of this writing, there
are no places where `final` would be helpful and would also be wrong, so
this is enabled everywhere.
2022-10-16 23:20:34 +00:00
Kp 2dd538eb4d Add workaround for i686 where std::size_t is unsigned int
enumerated_bitset expects that typename `E` and `std::size_t` are
distinct types.  On some i686 targets, `std::size_t` is an alias for
`unsigned int`, so setting `E = uint32_t` causes `std::size_t` and `E`
to be the same type.

Add a workaround by using `unsigned int` or `unsigned long`, whichever
one `std::size_t` is not.  This will become unnecessary once
`playernum_t` becomes an `enum class`.

Reported-by: pkubaj <https://github.com/dxx-rebirth/dxx-rebirth/issues/662>
2022-10-09 23:15:21 +00:00
Kp a8ecc000bf Return sentinel from segment_object_range_t 2022-10-09 23:15:21 +00:00
Kp d9c06e25c5 Pass std::ranges::subrange to multi_execute_save_game 2022-10-09 23:15:21 +00:00
Kp 6ca3a1ba99 Define operator<=> for dl_index 2022-10-09 23:15:21 +00:00
Kp 90d3d82d8e Default disable VR side-by-side for OpenGL ES
VR requires glDrawBuffer, which Mesa OpenGL ES does not offer.  Default
VR to disabled for OpenGL ES users.  Users who want to try it anyway can
still set use_stereo_render=1 in the SCons environment.
2022-10-09 23:15:20 +00:00
Kp bb0711001f Make xrange_endpoint value mutable
The concept std::ranges::range<T> requires that std::ranges::end(T) be
well-formed.  An input with a `const` qualified member fails this test,
and causes std::ranges::range<T> to reject an otherwise satisfiable
range.
2022-10-09 23:15:20 +00:00
Kp bde7c9b3c4 Return sentinel type from enumerate::end() 2022-10-09 23:15:20 +00:00
Kp dded433d2b Return sentinel type from xrange::end() 2022-10-09 23:15:20 +00:00
Kp b5775f1680 Use std::ranges::begin/end for partial_range
Remove custom adl_begin and rely on std::ranges.
2022-10-09 23:15:20 +00:00
Kp 229766e9cb Use enum class for polygon_simpler_model_index
This type is stored with an off-by-one bias from the regular model
index, so use a distinct enum type to avoid implicit conversions.
2022-10-09 23:15:20 +00:00
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 7c0fb7b12a Use std::span for load_bitmap_replacements argument level_name 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 017e786139 Use explicitly defaulted font_scale_proportion::operator== 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 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