Commit Graph

12210 Commits

Author SHA1 Message Date
Kp 6799aa5bdf Update c++std documentation 2022-11-06 18:18:57 +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 16c86edabc Fix cockpit switch in SDL-only build
The cockpit graphic is not scaled in the SDL build, so it is only
meaningful to show when the game window dimensions match the graphic's
dimensions.  Prior to 4a8d7c7574, this worked, because the
`initial_large_game_screen_mode` was the same as the graphic's
dimensions.  That commit changed `initial_large_game_screen_mode` to
prefer a larger screen resolution for new users.  It should have
retained the original dimensions for this test.  Make that change here.

Fixes: 4a8d7c7574 ("Default to 1024x768 for new users, not 640x480")
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 ae46a5b3b0 Simplify SDL gr_flip: nullptr implies copy all
Per the header comments, passing nullptr for source or destination
copies the entire region.  Use that instead of explicitly requesting the
entire region.  This should be more efficient, since it bypasses the
source rectangle clipping code that SDL would otherwise run.
2022-11-06 18:18:57 +00:00
Kp fc9de58302 Raise clang version in INSTALL.markdown 2022-10-31 00:51:32 +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
Arne de Bruijn 3567a7bc98
Merge a31519dc08 into 7fc6879555 2022-10-29 18:07:22 +00:00
Arne de Bruijn a31519dc08 Fix score getting mangled after new ship 2022-10-29 20:03:08 +02:00
Kp 7fc6879555 Fix various Win32 build failures due to ambiguous operator[]()
gcc reports:

```
ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second
```

Fix the ambiguity by using an unsigned integer constant.
2022-10-23 23:00:24 +00:00
Kp 8501db1e64 Group Network_message GM_TEAM checks 2022-10-23 23:00:24 +00:00
Kp 4506d0f6f3 Change check_size_type_format_modifier to use ''.format 2022-10-23 23:00:24 +00:00
Kp ee4268bf9f Simplify variable binding in check_size_type_format_modifier 2022-10-23 23:00:24 +00:00
Kp 862c1f0aab Pass std::span to multi_process_bigdata 2022-10-23 23:00:24 +00:00
Kp 2277d90ccd Pass std::span to net_udp_process_mdata 2022-10-23 23:00:24 +00:00
Kp 21cf4b2eb8 Pass std::span to net_udp_noloss_got_ack 2022-10-23 23:00:24 +00:00
Kp cebc645e21 Pass std::span to net_udp_process_pdata 2022-10-23 23:00:24 +00:00
Kp 641a36b9fa Pass std::span to net_udp_process_pong 2022-10-23 23:00:24 +00:00
Kp 89bcb126ab Pass std::span to net_udp_process_ping 2022-10-23 23:00:24 +00:00
Kp 3fb11cecf1 Move net_udp_process_version_deny up
This allows the lower namespace{} block to change scope without changing
the namespace of net_udp_process_version_deny.
2022-10-23 23:00:24 +00:00
Kp 5bb61f71b5 Pass std::span to UDP_sequence_request_packet::build_from_untrusted 2022-10-23 23:00:24 +00:00
Kp d134645d1f Pass std::span to net_udp_process_dump 2022-10-23 23:00:24 +00:00
Kp c1a151fc8f Pass std::span to net_udp_check_game_info_request 2022-10-23 23:00:24 +00:00
Kp 6dfd405d90 Pass std::span to net_udp_process_version_deny 2022-10-23 23:00:24 +00:00
Kp e98650afb9 Pass std::span to net_udp_process_request 2022-10-23 23:00:24 +00:00
Kp 04af38638c Inline effect of object_rw_swap into multi_object_rw_to_object
Change from rewriting the object in place to byte-swap it, then copying
the byte-swapped values into the long term object to instead copy the
values into the object and perform byte-swapping as needed during the
copy.
2022-10-23 23:00:24 +00:00
Kp 23e75f3a45 Pass std::span to multi_do_fire 2022-10-23 23:00:24 +00:00
Kp 5f1877a4d6 multi_do_kill_*: use player number from network layer
The network layer already has the player number.  Use that instead of
reloading it from the message body.
2022-10-23 23:00:24 +00:00
Kp 22444d5377 multi_do_msgsend_state: use player number from network layer
The network layer already has the player number.  Use that instead of
reloading it from the message body.
2022-10-23 23:00:24 +00:00
Kp 8fd6ff2025 multi_do_escape: use player number from network layer
The network layer already has the player number.  Use that instead of
reloading it from the message body.
2022-10-23 23:00:24 +00:00
Kp 49698fbf86 multi_do_quit: use player number from network layer
The network layer already has the player number.  Use that instead of
reloading it from the message body.
2022-10-23 23:00:24 +00:00
Kp 064e971b28 multi_do_fire: use player number from network layer
The network layer already has the player number.  Use that instead of
reloading it from the message body.
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 f47bcb5cbc Fix buffer overread at startup
Commit 5b7fb9c402 incorrectly removed the trailing null from
`g_descent_version`.  Add an explicit null, since list initialization
does not imply a null.

Fixes: 5b7fb9c402 ("Reduce use of quotes for passing vers_id defines")
2022-10-19 01:17:33 +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 7981fd1b17 Revert incorrect logic changes from std::ranges conversion
Commit e385ff1c3b switched various sites to use projection to extract
a value and avoid use of a predicate.  Two of the converted sites need
to use a predicate in order to test for a value being unequal to a
constant, rather than testing for equality as e385ff1c3b did.

Fixes: e385ff1c3b ("Use std::ranges::find_if instead of std::find_if")
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 cb8303839c Revert incorrect robot collision logic change
Commit 37132ab887 rearranged the special rules around robot-vs-robot
vector intersection based on an obsolete comment from Descent 1.  In
Descent 2, robot-vs-robot collisions are always disabled, so that the
thief bot does not damage itself when flying past other robots.

Reported-by: Glumduk <https://github.com/dxx-rebirth/dxx-rebirth/issues/665>
Fixes: 37132ab887 ("Pass LevelSharedRobotInfoState in fvi_query")
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 5fea863a79 Remove obsolete reverse_traversal helper
This is unused as of bd739041f8.

Fixes: bd739041f8 ("Remove special case for SP homing missiles")
2022-10-09 23:15:21 +00:00
Kp b3a34f424f Pass std::ranges::subrange to drive_letter_menu 2022-10-09 23:15:21 +00:00
Kp efa3f97a00 Pass std::ranges::subrange to briefing_menu 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 31b2f1399c Pass std::ranges::subrange to find_hli_entry 2022-10-09 23:15:21 +00:00
Kp 6ca3a1ba99 Define operator<=> for dl_index 2022-10-09 23:15:21 +00:00
Kp 515e0abe11 Pass std::ranges::subrange to PHYSFSX_findFiles 2022-10-09 23:15:21 +00:00
Kp 2c7ed3cfce Pass std::ranges::subrange to PHYSFSX_findabsoluteFiles 2022-10-09 23:15:21 +00:00
Kp 052dff6dae Pass std::ranges::subrange to menu selection functions 2022-10-09 23:15:21 +00:00
Kp 57de180a2e Pass std::ranges::subrange to PHYSFSX_checkMatchingExtension 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