On some systems, such as the Apple M1 (ARM-based Macs),
dylibbundler is in $PATH, but not in a directory found by the limited
path that SCons uses for Command() invocations. This causes the SConf
test to succeed (because it uses the full $PATH), but the Command() to
fail (because it uses a reduced path). Fix this by using the user's
$PATH, if defined, for this Command() invocation.
Along the way, rework tool_bundle.py to use SCons' Node() objects in
place of direct path manipulation. This lets SCons produce better error
messages in some cases.
Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/pull/610>
clang treats names introduced by structured bindings specially, and
refuses to capture them for a lambda, even when it should be capturing
an rvalue reference. gcc accepts this capture.
Switch to initializing a lambda local variable from the structured
binding in the outer scope, which works with both compilers.
Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/issues/609>
If std::common_type<range::index_type>... finds a common index_type
among all the zipped ranges, pass that common type through as
zip<...>::index_type. Otherwise, set zip<...>::index_type to void.
This allows enumerate(zip(...))) to report a better index_type.
This eliminates the only place that zip<>'s template parameter list is
written out in the source, which will allow later commits to change the
template parameter list.
Trim the bitmap's current width and height to be not more than its
parent. Otherwise, an automatic screen resize, such as triggered when
playing the robot briefings in Descent 2, will give the window a new
smaller bm_data, but continue to use the old dimensions. This then
causes load_briefing_screen -> gr_bitmap_scale_to -> scale_line to write
off the end of the smaller bm_data, causing memory corruption and
eventually a crash.
enum game_mode_flags must be visible in common code, which does not
define DXX_BUILD_DESCENT_II. To avoid One Definition Rule errors,
game_mode_flags must have the same definition in all files.
Fortunately, the DXX_BUILD_DESCENT_II definition is a superset of the
common definition, so the preprocessor guards can be replaced with
advisory comments.
Fixes: 2b718da343 ("Use enum class for Game_mode, Newdemo_game_mode")