Commit graph

93 commits

Author SHA1 Message Date
Kp 0c3e99f14c Split side uses based on shared vs unique 2018-06-24 05:06:15 +00:00
Kp 6d0d68d188 Split some segment uses based on shared vs unique
Leave `sides` in `shared_segment` to minimize churn.  Parts of it must
move to `unique_segment` before this project finishes.
2018-06-24 05:06:14 +00:00
Kp 93789f0666 Use valptridx for Dl_indices 2018-06-06 04:53:45 +00:00
Kp 90d2a61c1d Simplify visited_segment_mask_t 2018-04-09 00:58:28 +00:00
Kp 5eec2a5ce5 Use valptridx for Vertices 2017-08-11 23:43:54 +00:00
Kp 7a51b26f91 Remove obsolete serial typedefs 2017-08-11 23:43:54 +00:00
Kp d1c6b89f17 Move dsx::segment -> dcx::segment
d2x::segment has all members of d1x::segment, as well as two new members
exclusive to d2x::segment.  Structure layout is such that d1x::segment
requires the same size allocation, and places anonymous pad members in
the locations that become named members in d2x::segment.  Thus, reusing
d2x::segment for d1x::segment does not change the size of the structure
nor the offsets of any members used.  This reuse may enable some
functions to be better shared by the dsx project.
2017-07-26 03:15:58 +00:00
Kp 596ecbb38d Rename segment::value to segment::station_idx
`value` is generic and unclear.  It is always meant to be used as an
index into the Station array, so rename it `station_idx` to show this.

Define and consistently use `station_none` to represent that no station
is assigned.
2017-07-08 18:17:49 +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 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 0f00cf51b0 Make segment vertices unsigned 2017-02-19 19:33:37 +00:00
Kp 092d947830 Optimize change_light search
Use std::equal_range to find the upper and lower bounds in a single
binary search, rather than relying on a linear search to find the first
sought element.
2017-01-15 00:03:14 +00:00
Kp fa1f8488f0 Use uint8_t for sidenum 2016-12-24 22:44:08 +00:00
Kp 47eae7176d Split valptridx declarations
The declaration of valptridx_specialized_types needed to be found by
Argument Dependent Lookup, but this was inconvenient for some types.
Split the declaration of valptridx_specialized_types out from the
definition of valptridx global subtype.
2016-12-24 18:12:17 +00:00
Kp 012238ba14 Fold segnum.h into fwd-segment.h 2016-12-24 18:12:17 +00:00
Kp 6a3ded191f Move EDITOR to dxxsconf.h; rename to DXX_USE_EDITOR
Rename symbol EDITOR to DXX_USE_EDITOR to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -wl EDITOR -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(EDITOR\)\>/#if DXX_USE_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(EDITOR\))/#\1if \2DXX_USE_\3/' -e 's/^\s*#ifndef \(EDITOR\)\>/#if !DXX_USE_\1/'
2016-09-11 18:49:16 +00:00
Kp 86b5427906 Fix -Wshadow warning in visited_segment_multibit_array_t::bitproxy_t
bitproxy_t inherits a method named `shift` and its constructor took a
parameter named `shift`.  This is unambiguous in the language, but causes
a warning from gcc's -Wshadow in gcc before 5.x.  Rename the parameter
to eliminate the warning.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/200>
2016-06-01 01:52:45 +00:00
Kp eea74aefb7 Fix -Wshadow warning in visited_segment_multibit_array_t::tmpl_multibit_proxy_t
tmpl_multibit_proxy_t inherits a method named `shift` and its constructor took a
parameter named `shift`.  This is unambiguous in the language, but causes
a warning from gcc's -Wshadow in gcc before 5.x.  Rename the parameter
to eliminate the warning.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/200>
2016-06-01 01:52:45 +00:00
Kp 0cdc1dea72 Fix -Wshadow warning in visited_segment_mask_t::tmpl_maskproxy_t
tmpl_maskproxy_t inherits a method named `shift` and its constructor took a
parameter named `shift`.  This is unambiguous in the language, but causes
a warning from gcc's -Wshadow in gcc before 5.x.  Rename the parameter
to eliminate the warning.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/200>
2016-06-01 01:52:45 +00:00
Kp 359f6f58ee Fix -Wshadow warning in visited_segment_bitarray_t::bitproxy_t
bitproxy_t inherits a method named `shift` and its constructor took a
parameter named `shift`.  This is unambiguous in the language, but causes
a warning from gcc's -Wshadow in gcc before 5.x.  Rename the parameter
to eliminate the warning.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/200>
2016-06-01 01:52:45 +00:00
Kp aa4ad79fbe Fix -Wshadow warning in visited_segment_bitarray_t::tmpl_bitproxy_t
tmpl_bitproxy_t inherits a method named `shift` and its constructor took a
parameter named `shift`.  This is unambiguous in the language, but causes
a warning from gcc's -Wshadow in gcc before 5.x.  Rename the parameter
to eliminate the warning.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/200>
2016-06-01 01:52:45 +00:00
Kp 487547050b Fix -Wshadow warning in visited_segment_mask_t::base_maskproxy_t
base_maskproxy_t has a method named `shift` and its constructor took a
parameter named `shift`.  This is unambiguous in the language, but causes
a warning from gcc's -Wshadow in gcc before 5.x.  Rename the parameter
to eliminate the warning.

Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/197>
2016-05-29 17:46:32 +00:00
Kp 608467161b Remove obsolete arguments from DEFINE_VALPTRIDX_SUBTYPE 2016-04-06 03:34:13 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp bb5d1bb7e5 Use valptridx array type for Walls 2016-02-06 22:12:54 +00:00
Kp 8e86a3586d Use #ifdef dsx to guard dsx namespace 2016-01-09 16:38:15 +00:00
Kp 0be0475309 Move valptridx array highest to base class 2016-01-09 16:38:14 +00:00
Kp 96898bab0a Block direct changes to Highest_segment_index
Route updates through helper functions.
2016-01-09 16:38:12 +00:00
Kp db9fb0ed42 Move more symbols into namespace dcx/dsx 2015-12-22 04:18:50 +00:00
Kp 26e948d5f1 Uninline namespace dsx 2015-12-13 18:00:49 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp 34d89d5139 Use inline namespace dsx for segment.h 2015-12-05 22:57:25 +00:00
Kp bb41075adb Add preprocessor guards around types that vary by game 2015-11-26 02:56:55 +00:00
Kp 6f10a67c09 Move segment::sides to end
sides[] is large and caused all members after it to require disp32
offsets.  Move it to the end so that all members can use disp8 offsets.

This saves ~1300 bytes of text on an editor+debug build.
2015-10-18 21:01:20 +00:00
Kp ad8b4230df Move fwdsegment.h -> fwd-segment.h for consistency 2015-10-10 03:44:14 +00:00
Kp 71ffbdf719 Replace fill(0) with ={} 2015-09-29 02:41:22 +00:00
Kp 2155c417cb Move array_managed_type into valptridx<T> 2015-08-22 20:43:04 +00:00
Kp 20b1db3483 Expand dxx_explicit_operator_bool to "explicit"
Many files now use "explicit", so compilers which reject
explicit operator bool() will not work.  Remove the macro.
2015-08-03 03:11:25 +00:00
Kp 3015db64ad Guard segment.h for LTO -Wodr 2015-07-18 21:01:55 +00:00
Kp 745de17c41 Use T::index_type for highest_valid 2015-07-13 01:09:36 +00:00
Kp c53b734abb Compute slide segments early
Store slide flag in segment to save one byte per segment.
2015-05-17 20:37:59 +00:00
Kp 9dc22b1ee6 Expand DXX_CXX11_EXPLICIT_DELETE
Various functions use the non-macro form, so support for =delete is
already mandatory.  Remove the remnants of support for compilers which
lack =delete and replace it with a hard stop when the compiler rejects
declaring explicitly deleted functions.
2015-05-01 02:18:33 +00:00
Kp 90fbebf8fd Convert most global arrays to array<> 2015-04-02 02:36:52 +00:00
Kp a65533d477 Remove unused delta_light dummy 2015-02-28 19:36:01 +00:00
Kp 702ea40ade Move segment declarations to fwdsegment.h 2014-12-22 04:35:49 +00:00
Kp d63be88eb0 Propagate use of vsegptridx_t 2014-11-23 04:58:45 +00:00
Kp 80f3f83577 Use range_for for Delta_lights 2014-11-23 04:36:59 +00:00
Kp 80bbc9c69c Use range_for on Dl_indices 2014-11-23 04:36:58 +00:00