Commit graph

3583 commits

Author SHA1 Message Date
Kp 0259378860 Pass valptridx factories to static AI functions 2017-06-30 04:09:27 +00:00
Kp 54c573fb22 Adjust valptridx auto-instantiate for -O2 -fno-inline 2017-06-30 04:09:26 +00:00
Kp 9421c31b5a Replace "compiler-type_traits.h" with <type_traits>
Delete stub "compiler-type_traits.h" header.  Redirect all uses to the
standard <type_traits> header.

git grep -wlz 'compiler-type_traits.h' -- '*.cpp' '*.h' | xargs -0 perl -p -i <<EOF
    BEGIN {
	    $i = 0;
    }
    if (($i == 1 && $_ eq "\n") || ($i < 2 && /^#include "/)) {
	    # First blank line or first user-include after a system-include.
	    # Print, then never again for this file.
	    print "#include <type_traits>\n";
	    $i = 2;
    } elsif ($i == 0) {
	    $i = 1 if (/^#include </);
    } elsif ($_ eq "#include \"compiler-type_traits.h\"\n") {
	    # Remove this line if found.
	    $_ = '';
    }
    # Reset state machine when moving to next file.
    $i = 0 if eof;
EOF
2017-06-25 20:46:03 +00:00
Kp adcf02e454 Expand tt:: indirection to std::
All supported compilers have an acceptable <type_traits>.  Commit
4cb3d46148 ("Move <type_traits> test to Cxx11RequiredFeature") made
<type_traits> support mandatory in August and no one has objected.
Remove the indirection and use namespace std directly for type_traits
members.
2017-06-25 20:46:03 +00:00
Kp b550a5aa13 Unify segment2_read
Early unification efforts missed this one because it was in gamemine.c
for Descent 1, but segment.c for Descent 2.  Move it to gamemine.cpp for
both, so that it can be static for both games.
2017-06-17 23:05:16 +00:00
Kp aa47435009 Remove write-only field FuelCenter::MaxCapacity
This is a remnant of a pre-retail design that allowed fuel centers to
be exhausted.  No one has ever asked for this mechanic, so remove
support for it.
2017-06-17 23:05:16 +00:00
Kp 20b8a6738c Use range_for in paging_touch_walls 2017-06-17 23:05:16 +00:00
Kp 73d92bb509 Make wclip::num_frames uint16_t 2017-06-17 23:05:16 +00:00
Kp bca7823423 Use range_for+partial_range in paging_touch_model 2017-06-17 23:05:15 +00:00
Kp 8a038de506 Tighten Marker_viewer_num validation 2017-06-10 03:31:03 +00:00
Kp 0e57e9bbf7 Expand macro to fix gcc-7 portability warning
gcc-7 warns:

    similar/main/mglobal.cpp:119:5: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
     #if DXX_VALPTRIDX_ENABLE_FULL_TEMPLATE_INSTANTIATION

Fix this by using the long form of the definition.
2017-06-10 03:31:03 +00:00
Kp 2a8e7dc3b1 Simplify game log timestamp 2017-06-10 03:31:03 +00:00
Kp 7b16571cb2 Rename countarray method count -> size 2017-06-10 03:31:03 +00:00
Kp a03291b036 Rename countarray method size -> max_size 2017-06-10 03:31:03 +00:00
Kp 430f7832aa Move valptridx factories into array_managed_type 2017-06-10 03:31:03 +00:00
Kp 599ac9dee0 Always qualify valptridx type/factory
Previously, valptridx used PREFIX for allow-invalid+mutable, c#PREFIX
for allow-invalid+const, v#PREFIX for require-valid+mutable, vc#PREFIX
for require-valid+const.  Convert the types, factories, and all usage
sites to specify a qualifier for all four combinations:

	im#PREFIX -> allow-invalid+mutable
	ic#PREFIX -> allow-invalid+const
	vm#PREFIX -> require-valid+mutable
	vc#PREFIX -> require-valid+const

Changes to common/include/valptridx.h and common/include/fwd-valptridx.h
are manual.  All other changes are generated by:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\(v\?\)\(\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/\1m\2/g'

for the 'm' prefix and:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\([cm]\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/i&/g'

for the 'i' prefix.
2017-06-10 03:31:02 +00:00
Kp d077b32201 Disable newdemo strftime -Wformat-nonliteral warning
Disable gcc's -Wformat-nonliteral for this one call since unchecked
format strings are (1) under the user's control, (2) unable to cause
problems, and (3) very difficult to fully support with the warning
enabled.

Reported-by: parkerlreed <https://github.com/dxx-rebirth/dxx-rebirth/issues/338>
2017-06-07 02:44:54 +00:00
Kp b0cb681ae7 Add gcc-7 /*-fallthrough*/ comments for obvious cases
For switch cases where existing comments or code flow logic obviously
intended to fall through, add a gcc-7 /*-fallthrough*/ comment to
silence warnings about this.  Some cases which are less obvious are not
converted, so the code does not yet compile clean with
-Wimplicit-fallthrough.

Reported-by: parkerlreed <https://github.com/dxx-rebirth/dxx-rebirth/issues/338>
2017-06-07 02:44:54 +00:00
Kp e4ce907c1d Reduce scope of explicit instantiations 2017-06-07 02:44:54 +00:00
Kp 139ad58c72 Restore dropped hoard test
Commit 829e95b dropped a test for game_mode_hoard when computing light.
Since hoard orbs are in a union which overlaps the score in mission
mode, this caused a bug where a player in mission mode with non-zero
score would pulse light like a player carrying orbs in hoard mode.

Restore the test for hoard mode.

Fixes: 829e95b6f8 ("Separate hoard/proximity tracking")
2017-04-30 16:25:19 +00:00
Kp 26cb93d24f Preserve killer_objnum when a dead player takes additional damage 2017-04-30 16:25:19 +00:00
Kp 4f6c8575f2 Cache canvas in listbox_create_structure 2017-04-30 16:25:19 +00:00
Kp 8d2bc05624 Cache canvas in listbox_draw 2017-04-30 16:25:19 +00:00
Kp c2d45720c3 Pass canvas to check_face 2017-04-30 16:25:18 +00:00
Kp c12095dc4f Remove global canvas set in find_seg_side_face 2017-04-30 16:25:18 +00:00
Kp 601562b54b Pass canvas to render_segment 2017-04-30 16:25:18 +00:00
Kp 20b44fa856 Pass canvas to render_side 2017-04-30 16:25:18 +00:00
Kp 1b1cd54fb6 Pass canvas to check_render_face 2017-04-30 16:25:18 +00:00
Kp ab8859562e Pass canvas to do_render_object 2017-04-30 16:25:18 +00:00
Kp 4b4cb3a588 Pass canvas to outline_seg_side 2017-04-30 16:25:18 +00:00
Kp c4cff0df11 Fix missed canvas updates in scores_handler 2017-04-30 16:25:17 +00:00
Kp c8f93b7a5a Remove canvas juggling in state_callback 2017-04-30 16:25:17 +00:00
Kp 231ee1425f Remove canvas juggling in state_save_all_sub 2017-04-30 16:25:17 +00:00
Kp 53207b2ad0 Fix missed canvas updates in briefing_process_char 2017-04-30 16:25:17 +00:00
Kp 9558ca4eba Pass canvas to load_briefing_screen 2017-04-30 16:25:17 +00:00
Kp 22db18c10c Cache canvas in briefing_handler EVENT_WINDOW_DRAW 2017-04-30 16:25:17 +00:00
Kp 7aa764f975 Pass canvas to show_briefing_bitmap 2017-04-30 16:25:16 +00:00
Kp e425488329 Pass canvas to show_animated_bitmap 2017-04-30 16:25:16 +00:00
Kp 1a1e669bc6 Pass vms_angvec &to draw_model_picture 2017-04-30 16:25:16 +00:00
Kp 2bd7344bff Remove canvas juggling in show_spinning_robot_frame 2017-04-30 16:25:16 +00:00
Kp 79a4a19711 Pass player to init_player_stats_level 2017-04-30 16:25:16 +00:00
Kp bd82516983 Pass player position to teleport_boss 2017-04-30 16:25:15 +00:00
Kp 57bf5d6e41 Validate segment walls on load 2017-04-22 21:23:56 +00:00
Kp 9478d1e6a5 Add custom terminate handler on Windows 2017-04-22 21:23:56 +00:00
Kp b98053a34f Fix Windows net_udp.cpp build
The Windows implementation of inet_ntop incorrectly omits the `const`
qualifier on the input address.  This broke the Windows build, since
Rebirth passes a const-qualified input address, as permitted by POSIX.

Some Windows cross-compilers, such as mingw32, lack a definition of
inet_ntop entirely.  For such environments, fall back to inet_ntoa and
disallow building with IPv6.

Rework the formatting and add a Windows-specific test for whether
inet_ntop is available.  As inet_ntop is specified by POSIX, assume all
modern non-Windows platforms support it.
2017-04-22 21:23:56 +00:00
Kp 466536b101 Remove abandoned powerup_cap_state
Commit b32298df5a ("Rewrite powerup cap
code to centralize logic") centralized powerup cap code in the
powerup_cap_state class.

Commit 901a554e96 ("New powerup management
code: Addeed functions and packet type to ...") removed all use of
powerup_cap_state, but left the dead implementation present.

Commit 479f5ed584 ("Fix 'format specifies
type 'unsigned short' but the argument has type 'unsigned char''
warning") switched the already dead (but still compiled) code from %hu
to %hhu to fix a warning on OS X.  Although the commit was written by
Chris, it was my suggestion to use %hhu.  I neglected to test Windows
before suggesting it, so the change went in even though Windows does not
accept %hhu; this broke the Windows build.  Fortunately, the code had
been dead for 11 months when the change was made, so the fix for Windows
is to remove the long dead code.
2017-04-22 21:23:55 +00:00
Kp 9cfbf44834 Pass object &to toggle_headlight_active 2017-04-22 21:23:55 +00:00
Kp b5915abdcc Change station/robotmaker consistency check to LevelError 2017-04-15 17:46:44 +00:00
Kp 170d0ac777 Pass canvas &to nm_draw_background 2017-04-08 16:48:20 +00:00
Kp aaf7874235 Remove canvas juggling in nm_draw_background 2017-04-08 16:48:19 +00:00