Commit graph

4203 commits

Author SHA1 Message Date
Kp 5eff03dd88 Store ranges::subrange in newmenu_layout 2022-12-31 16:21:47 +00:00
Kp 3bba60d1b7 Pass ranges::subrange to multi_all_players_alive 2022-12-31 16:21:47 +00:00
Kp 86515f6903 Pass ranges::subrange to multi_interactive_deny_save_game 2022-12-31 16:21:47 +00:00
Kp 0decae2328 Pass ranges::subrange to multi_common_deny_save_game 2022-12-31 16:21:47 +00:00
Kp c428fdee0f Pass ranges::subrange to bitmap_index_read_n 2022-12-31 16:21:47 +00:00
Kp f804d98825 Make enumerate inherit ranges::subrange directly
Remove the intermediate layer of partial_range_t.
2022-12-31 16:21:47 +00:00
Kp 41184654e8 Pass ranges::subrange to reactor_read_n 2022-12-31 16:21:47 +00:00
Kp 299c4e6300 Pass ranges::subrange to event_poll_state::process_event_batch 2022-12-31 16:21:47 +00:00
Kp ca913240d0 Return ranges::subrange from robot_get_anim_state 2022-12-31 16:21:47 +00:00
Kp d3ffcb0dab Store range_type, not range_iterator_type, in zip<> signature
This is initial setup to enabling use of zip() on sentinel based ranges.
Store the range's type in the zip signature, and store the types of
std::begin/std::end for the iterators, rather than assuming that
std::begin and std::end return the same type.
2022-12-31 16:21:47 +00:00
Kp 1aab6ace2a Extend zip() to examine multiple end iterators
Allow the caller to pick which sequences can terminate the zip iterator.
For compatibility and performance, default to the historical behavior of
examining only the first sequence.  The zip iteration terminates when
any of the examined sequences reaches its end, even if other sequences
have not reached their respective end.
2022-12-31 16:21:47 +00:00
Kp 0921b88028 Change zip unit tests to use requires()
This usually produces better error messages on failure.
2022-12-31 16:21:47 +00:00
Kp 23551716b3 Add static_assert checks on zip difference_type 2022-12-31 16:21:47 +00:00
Kp 4071cd0cbf Replace range_owns_iterated_storage with ranges::borrowed_range
The standard type imposes some additional requirements that are not
necessary here, but using this concept allows standard containers to be
classified correctly without specific overrides.
2022-12-31 16:21:47 +00:00
Kp e3553586c1 Use enum class for bitmap_index 2022-12-31 16:21:47 +00:00
Kp 147dd52f7d Preserve input type in deleted enumerated_array::operator[]()
Any integer type can convert to match this signature, but the diagnostic
will only report that this deleted function was matched.  Switch to a
template function so that the diagnostic can report the unconverted
integer type.
2022-12-31 16:21:47 +00:00
Kp df8e998721 Remove unnecessary morph_data helper constructors 2022-12-18 23:10:39 +00:00
Kp 01fd4079ba Remove unnecessary enumerate constructor 2022-12-18 23:10:39 +00:00
Kp e41e72c667 Use #if for DXX_HAVE_CXX_BUILTIN_FILE_LINE 2022-12-18 23:10:39 +00:00
Kp ae4b3b4c87 Make window_send_event a method of window
Switch from using a macro to capture __FILE__,__LINE__ to using
__builtin_FILE(),__builtin_LINE().  Make the event an explicit argument,
instead of assuming it is a variable named `event`.  Move the
implementation out of line.
2022-12-18 23:10:39 +00:00
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 3f65ae0ca3 Replace PHYSFSX_read* macros with a template function object
This produces better error messages on misuse.
2022-12-17 13:16:28 +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 0c8ab5d70d Remove unnecessary explicit definition of valptridx<T>::ptr::operator!= 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 ca1e3b1540 Remove unnecessary definition of exact_type<T>::operator!= 2022-11-13 21:17:23 +00:00
Kp 1cb33638c0 Fix -Wuseless-cast on Win32 in PhysFS size checking macro
Win32 aliases `size_t` to `unsigned int`, causing
`static_cast<size_t>(V)` to be a useless cast when `V` has type
`unsigned int`.  Switch to using direct initialization, which is not a
cast and so does not trigger a warning, but does produce the correct
type.  This form disallows narrowing, so inputs that might change in
value as a result of the conversion are an error.  Since this is a
sanity checking macro, that is a useful safety measure.

Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/678#issue-1437577368>
2022-11-10 02:04:09 +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 7effca68f0 Use RAII_SDL_Surface to track SDL-only main canvas surface
The Rebirth main screen grd_curscreen borrows the memory allocated by
SDL_CreateRGBSurface to store its data.  Store the pointer to that
surface inside grd_curscreen and make grd_curscreen responsible for
freeing the surface.
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