Commit Graph

12210 Commits

Author SHA1 Message Date
Kp 0512ea8d65 Use enum class for upid 2022-09-11 17:00:44 +00:00
Kp d32fc7acab Use enum class for kick_player_reason 2022-09-11 17:00:44 +00:00
Kp 4cf1eb328f Use std::array for prepare_kill_name storage 2022-09-11 17:00:44 +00:00
Kp 0a8bf6bfa8 Remove redundant test in multi_do_finish_game
This is only called from the dispatch switch which checked the type.
There is no need to check the type again.
2022-09-11 17:00:44 +00:00
Kp dac7b13f65 Pass optional parameters to multi_do_fire from caller
Remove the multi_do_fire branches that check the message type.  Delegate
those checks to the caller, so that multi_do_fire can work with the
common initial sequence of the three messages.
2022-09-11 17:00:44 +00:00
Kp 231acfe0ae Include git-describe data in archived snapshots 2022-08-31 01:46:58 +00:00
Kp 366b048879 Merge commit 'refs/pull/657/head' into master 2022-08-23 02:13:01 +00:00
Kp 0a1758f44f Ignore excess hostages during scoring
Descent 2 secret levels allow a player to rescue hostages that are not
counted in `total_hostages`, so a player can exit with more hostages
saved than were in the mine.  Change the scoring logic not to penalize a
player for saving these unaccounted hostages.
2022-08-22 01:24:49 +00:00
Kp cd09a742a0 Initialize aip->CURRENT_GUN in robot setup
In non-memory-poison builds, the zero initialization of the new object
will suffice to cover this.  In memory-poison builds, the new object
will be reset to a poison value, so the member must be given a
reasonable value here.
2022-08-22 01:24:49 +00:00
Kp 44cf8b83be Advise gcc to inline morph_data::operator new
This is only used in the file where it is defined, so it can be inlined
even though the definition is not in a header.  Enabling inlining
encourages gcc to see that the `operator new`/`operator delete` calls
are not mismatched.
2022-08-22 01:24:49 +00:00
Kp c64a584bfd Use enum class for robot_gun_number
Validate gun numbers on loading object data.  Factor out and normalize
the logic for advancing to a robot's next gun.
2022-08-22 01:24:49 +00:00
Kp c08b35ff45 Add SConf test for C++17 attribute [[nodiscard]]
This attribute is already in use in the code, but add an explicit test
to detect at configure time if the compiler lacks support for it.
2022-08-22 01:24:49 +00:00
Kp 0ffbc764af Store Windows HMP MIDIHDR inline in hmp_file
This avoids the need to make separate allocations for the individual
buffers, and to free them later.
2022-08-22 01:24:49 +00:00
Kp 4e66bff3f6 Fix SDL-only build of game.cpp
Fixes: 8be306efa7 ("Use enum class for cockpit_mode_t")
2022-08-22 01:24:49 +00:00
Kp b8313fdeb0 Filter out empty feature text fragments
Avoid generating a banner comment over an empty text fragment.
2022-08-22 01:24:49 +00:00
Kp 1fb55eebc2 Use enum class for robot_animation_state 2022-08-22 01:24:49 +00:00
Kp 7ac4016f55 Remove DXX_VALPTRIDX_STATIC_CHECK
clang-14 is detected as being able to optimize out unreachable paths,
but then triggers a build error reporting an unspecified invalid use
somewhere in multi.cpp.

Remove the static check, and rely on -Wsuggest-attribute=noreturn to
report any functions which are guaranteed to fail.  This is a weaker
check, but over the course of development, the static check has been hit
rarely, if ever, so keeping it provides little value.

```
In file included from similar/main/multi.cpp:38:
In file included from common/main/game.h:32:
In file included from common/main/robot.h:34:
In file included from common/main/object.h:40:
common/include/valptridx.h:229:2: error: call to unsigned int valptridx<dcx::player>::check_index_range_size<valptridx<dcx::player>::index_range_exception, std::__1::less>(char const*, unsigned int, unsigned long, valptridx<dcx::player>::array_managed_type const*)::DXX_ALWAYS_ERROR_FUNCTION::dxx_trap_handle_index_range_error() declared with 'error' attribute: invalid index used in array subscript
    DXX_VALPTRIDX_CHECK(Compare<std::size_t>()(s, array_size), handle_index_range_error, "invalid index used in array subscript", a, s);
    ^
common/include/valptridx.h:37:3: note: expanded from macro 'DXX_VALPTRIDX_CHECK'
        DXX_VALPTRIDX_STATIC_CHECK(dxx_valptridx_check_success_condition, dxx_trap_##ERROR, FAILURE_STRING);    \
        ^
common/include/valptridx.h:20:5: note: expanded from macro 'DXX_VALPTRIDX_STATIC_CHECK'
            (DXX_ALWAYS_ERROR_FUNCTION(FAILURE_FUNCTION, FAILURE_STRING), 0)    \
             ^
build/ulinux-clang++-14-64b10d04-ogl/dxxsconf.h:84:2: note: expanded from macro 'DXX_ALWAYS_ERROR_FUNCTION'
    DXX_ALWAYS_ERROR_FUNCTION::F(); \
    ^
1 error generated.
```
2022-08-22 01:24:49 +00:00
Kp 3ea0cc7053 Store Pof_addr at local scope
Pass it to called functions as needed.
2022-08-22 01:24:49 +00:00
Kp 6b7ba83a00 Move anim_angs into local scope, since it is copied out later 2022-08-22 01:24:49 +00:00
Kp 99577c4296 Simplify pof_read_string
The resulting string is discarded, so change it to skip without copying.
2022-08-22 01:24:49 +00:00
Kp a41908dece Move Pof_file_end to local scope
Rely on the extent in std::span for called code that needs to know
bounds.
2022-08-22 01:24:49 +00:00
Kp 3e13dcdf19 Use std::span to bound read_model_guns valid bytes 2022-08-22 01:24:49 +00:00
Kp 15e8ceeaa4 Use std::span to bound read_model_file valid bytes 2022-08-22 01:24:49 +00:00
Kp 42caec7e58 Use std::span for pof reading functions 2022-08-22 01:24:49 +00:00
Kp c5c5e8ea39 Simplify pof_read_angs
The caller passes a length of 1, so inline that and simplify the
function.
2022-08-22 01:24:49 +00:00
Kp 69579df368 Simplify pof_read_short
Use the general little-endian helper.
2022-08-22 01:24:49 +00:00
Kp 87c79206e8 Simplify pof_cfread
All callers pass a value of 1 for one of the two length terms, so inline
that and eliminate the multiplication.
2022-08-22 01:24:49 +00:00
Kp bfb7ed7efc Simplify pof_read_vecs
All callers pass a count of 1, so inline that and eliminate the loop.
2022-08-22 01:24:49 +00:00
Kp 26ab08d55f Add stub definitions of enum vertnum_t,wallnum_t
Given this code:

```
enum class X : unsigned;
X a{1};
```

gdb has an unfortunate behavior of reporting "incomplete type" and
refusing to show the underlying value of `a`, even when `a` is in scope.
Adding `enum class X : unsigned {}` fixes this and allows gdb to show
the value.
2022-08-22 01:24:49 +00:00
Tylor 6fee36638d Feat: Pitch unlocker 2022-08-21 16:16:40 -05:00
Kreeblah 25688635bb
Use Brewfile for macOS Github builds 2022-08-15 21:20:18 -07:00
Kp d49931d57b Merge commit 'github-packaging-c++20' into master 2022-08-16 03:15:32 +00:00
Kp 0d045ae3da Fix Windows net_udp build
Convert the RAIIsocket to a simple SOCKET before passing it to FD_SET.
Otherwise, the build fails with:

```
similar/main/net_udp.cpp: In function 'int {anonymous}::udp_general_packet_ready(dcx::{anonymous}::RAIIsocket&)':
similar/main/net_udp.cpp:969:2: error: use of deleted function 'bool dcx::{anonymous}::RAIIsocket::operator==(T) const [with T = long long unsigned int]'
  969 |  FD_SET(sock, &set);
      |  ^~~~~~
similar/main/net_udp.cpp:493:29: note: declared here
  493 |  template <typename T> bool operator==(T) const = delete;
      |                             ^~~~~~~~
```
2022-08-16 03:15:04 +00:00
Kreeblah bfdeff93b2
Added Brewfile and updated macOS compilation instructions 2022-08-14 19:36:02 -07:00
raptor 6440e387d6 Fix Linux/macOS builds with c++20 dialect 2022-08-14 19:00:18 -06:00
Kp daebb32925 Merge commit 'github-packaging' into master 2022-08-14 22:53:35 +00:00
raptor 1a10ffd031 Update macos package building scripts to install dylibbundler via brew and instruct scons to do the bundling 2022-08-11 21:52:06 -06:00
raptor 85a617386f Packaging changes:
- Split out builds in order to trigger them separately
- Anchor macdylibbundler to a specific revision
2022-08-10 09:25:08 -06:00
raptor 0e03692ec3 Packages for Windows, Linux, and macOS. Uses Github's Actions 2022-08-01 09:39:41 -06:00
Kp fb75a7900c Pass std::span to multi_do_message 2022-07-30 17:42:59 +00:00
Kp 81ab68e0f6 Pass std::span to multi_do_player_inventory 2022-07-30 17:42:59 +00:00
Kp 31b8d98e22 Pass std::span to multi_do_kill_client 2022-07-30 17:42:59 +00:00
Kp e76cefd846 Pass std::span to multi_do_kill_host 2022-07-30 17:42:59 +00:00
Kp 43c86b94af Split multi_do_kill to multi_do_kill_host+multi_do_kill_client
The kill messages have different lengths and conditional processing
based on whether the message is MULTI_KILL_CLIENT or MULTI_KILL_HOST.
Split the two into separate functions to simplify the implementation of
each.
2022-07-30 17:42:59 +00:00
Kp 127a1f15e6 Pass std::span to multi_do_gmode_update 2022-07-30 17:42:59 +00:00
Kp b24d61cd0a Pass std::span to multi_do_msgsend_state 2022-07-30 17:42:59 +00:00
Kp c5eeaa48cd Pass std::span to multi_do_bounty 2022-07-30 17:42:59 +00:00
Kp da138757e6 Pass std::span to multi_do_kill_goal_counts 2022-07-30 17:42:59 +00:00
Kp 79683690bd Pass std::span to multi_do_heartbeat 2022-07-30 17:42:59 +00:00
Kp 4893196138 Pass std::span to multi_do_restore_game 2022-07-30 17:42:59 +00:00