Commit graph

11721 commits

Author SHA1 Message Date
Kp 21aae1a352 Tighten symbol visibility for xrange
Switch to using protected inheritance, and expose the two base fields
that are needed outside the class.
2022-03-05 17:23:51 +00:00
Kp dc59b0b2cb Split out xrange init_begin ascending/descending paths
AlumiuN reports that mingw32-w64-gcc-8.1.0 incorrectly reports
`ascending` as unused-but-set.  This is clearly not true.  Reorder the
code to avoid saving `ascending`, and instead use the result of
`detail::get_xrange_ascending` directly.  This also improves the error
message in the DXX_ALWAYS_ERROR_FUNCTION path.

Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/626>
2022-03-05 17:23:51 +00:00
Kp b3f250f3b6 Fix openable_door_on_near_path for side WLEFT
openable_door_on_near_path should return 0 for no door and any non-zero
value for door-found.  Commit 9fdf6005df changed the logic to return 0
for no door, and the side number value for door-found.  This is wrong,
since WLEFT has integer value 0, so the caller will interpret a return
of door-found, side=WLEFT as no-door-found.

Fixes: 9fdf6005df ("Convert ai_static::GOALSIDE to sidenum_t")
2022-02-27 14:23:53 +00:00
Kp 9e58992296 Flatten constant_xrange hierarchy 2022-02-27 14:23:53 +00:00
Kp f51755c2e6 Use enum class for MBTN_* constants 2022-02-27 14:23:53 +00:00
Kp 6863dd3581 Reduce lifetime of joy_axis
It is only needed for the duration of kconfig_end_loop.  Move it from
the global Controls to local scope.
2022-02-27 14:23:53 +00:00
Kp 197a9cbd98 Move joystick interpretation to happen after the event loop
If two or more events are delivered in the same loop, the previous
implementation would count joystick motion multiple times.  Fix this by
moving the joystick interpretation to occur once, after all the events
have been processed.
2022-02-27 14:23:53 +00:00
Kp 9464bdf2e4 Use enumerated_array for indexing player input controls 2022-02-27 14:23:53 +00:00
Kp 165d5b892b Rename pitch -> pitch_ud for consistency
Other code uses pitch_ud.  Rename the kconfig pitch to match.
2022-02-27 14:23:53 +00:00
Kp 43bdfac56a Store copy_sensitivity values as std::integral_constant
Lists of these objects are unrolled by a template parameter pack
regardless of whether they are type compatible, so keeping the types
compatible does not improve code size.  Store more precise types in the
structure, and avoid needing to store the constant values into a
structure at runtime.
2022-02-27 14:23:53 +00:00
Kp e7fd31e3a6 Check return value of find_connect_side in more places 2022-02-19 14:52:17 +00:00
Kp 52403f104f Use symbolic sidenum values in Edge_to_sides 2022-02-19 14:52:17 +00:00
Kp 5611319962 Qualify references to sidenum_t members 2022-02-19 14:52:17 +00:00
Kp 68268e9a1f Use sidenum_t in more places 2022-02-19 14:52:17 +00:00
Kp 91c9055c90 Simplify do_endlevel_flythrough computation of next distance 2022-02-19 14:52:17 +00:00
Kp 2fe9a16613 Use dedicated type for mask of segment side numbers 2022-02-19 14:52:17 +00:00
Kp 8c037b7c26 Split player start generation
Move some of the logic to a separate function to enable use of `return`
instead of a `break` from a composite loop.
2022-02-19 14:52:17 +00:00
Kp b1278b8e39 Flatten type hierarchy for enumerated_iterator
Pass adjust_iterator_dereference_type directly, instead of passing
iterator_dereference_type and letting enumerated_iterator compute
adjust_iterator_dereference_type.
2022-02-19 14:52:17 +00:00
Kp f38a1b95a1 Simplify use of git-archive handling
The result of git-archive expanding `$Format:%H` will always be a valid
string.  Repeat the format specifier, so that the call to `.format()`
can be removed.
2022-02-13 19:13:38 +00:00
Kp 72064c62e7 Add unit tests for enumerate 2022-02-13 19:13:38 +00:00
Kp 17d1c3fb13 Pass range index_type through zip_iterator 2022-02-13 19:13:38 +00:00
Kp 7c2b8e1e6f Save full pkg-config stdout to sconf.log
Select flags parsed from pkg-config stdout were logged to the screen and
to sconf.log.  Add a line in sconf.log which shows the full stdout of
pkg-config.
2022-02-13 19:13:38 +00:00
Kp 3dd050ef98 Remove unused_ui_userdata 2022-02-13 19:13:38 +00:00
Kp c4985b8606 Move UI_GADGET list setup into constructor 2022-02-13 19:13:38 +00:00
Kp f2832e6248 Simplify _sockaddr IPv4/IPv6 logic
- Use std::integral_constant instead of a static function that returns
  the value
- Remove unused protocol_family
- Replace the enum with a typedef for the one type that the enum was
  used to define
2022-02-12 18:57:12 +00:00
Kp 8be306efa7 Use enum class for cockpit_mode_t 2022-02-12 18:57:12 +00:00
Kp 6b8a0a74c6 Fix some check_header_includes=1 failures 2022-02-12 18:57:12 +00:00
Kp 2be1a8ca85 Split game.h to fwd-game.h 2022-02-12 18:57:12 +00:00
Kp 8d9989024e Split inferno.h to fwd-inferno.h 2022-02-12 18:57:12 +00:00
Kp 504cbcc012 Split powerup.h to fwd-powerup.h 2022-02-12 18:57:12 +00:00
Kp f9c876572f Use std::move to compact Netgame.players on quit-joining 2022-02-12 18:57:12 +00:00
Kp 8fa4e6aa46 Simplify net_udp_welcome_player test order
Move the test for closed up, to avoid re-testing it.
2022-02-06 16:12:31 +00:00
Kp fe19f78fcd Simplify some uses of Highest_object_index 2022-02-06 16:12:31 +00:00
Kp da49df78f7 Split drop_powerup to return either an object id or a success code
If exactly one object will always be needed, use an overload that
returns the object id.  Otherwise, use an overload that only returns
whether at least one object was created.  This simplifies callers that
always request exactly one object.
2022-02-06 16:12:31 +00:00
Kp 04f0507942 Fix memory corruption if spit_powerup fails to drop a weapon
If spit_powerup fails, it returns object_none.  object_none is not a
valid index for use by map_objnum_local_to_remote.
2022-02-06 16:12:31 +00:00
Kp d5e520bc7b Fix failure to send robot creation message if one creation fails
If at least two robots would be dropped, and a drop failed, then
object_create_robot_egg would report failure to the caller.  Callers
that check the return code treat any failure as total failure, but that
is not guaranteed to be true.  If the game successfully dropped one
robot and failed when dropping a second, then the caller would receive a
status of failure.

Fix this by returning a status of whether at least one object was
created.
2022-02-06 16:12:31 +00:00
Kp 4a85b55865 Factor out drop_player_eggs creation of vulcan/gauss weapons 2022-02-06 16:12:31 +00:00
Kp 1a9fba804d Avoid repeated valptridx dereferences in multibot.cpp 2022-02-05 13:30:56 +00:00
Kp 1ad3377a83 Pass context to start_boss_death_sequence 2022-02-05 13:30:56 +00:00
Kp 29d6072f60 Pass context to drop_stolen_items 2022-02-05 13:30:56 +00:00
Kp 60c5fc5dc4 Pass object& to multi_drop_robot_powerups 2022-02-05 13:30:56 +00:00
Kp 6cc788e1cd Pass object_base& to object_create_robot_egg 2022-02-05 13:30:56 +00:00
Kp a0be091cd0 Avoid repeated valptridx dereferences in player_is_visible_from_object 2022-02-05 13:30:56 +00:00
Kp 7abcced9d0 Avoid repeated valptridx dereferences in init_ai_object 2022-02-05 13:30:56 +00:00
Kp ce8339fa5b Avoid repeated valptridx dereferences in ai_follow_path 2022-02-05 13:30:56 +00:00
Kp 9b2eda5bde Avoid repeated valptridx dereferences in create_path 2022-02-05 13:30:56 +00:00
Kp fd33402354 Avoid repeated valptridx dereferences in create_n_segment_path 2022-02-05 13:30:56 +00:00
Kp a418a0c7f9 Avoid repeated valptridx dereferences in create_path_to_station 2022-02-05 13:30:56 +00:00
Kp f7742a6e16 Avoid repeated valptridx dereferences in create_path_to_segment 2022-02-05 13:30:56 +00:00
Kp 13ca2112fd Avoid repeated valptridx dereferences in polish_path 2022-02-05 13:30:56 +00:00