clang becomes confused trying to determine which vm_distance_squared
constructor to use for a literal input of 0x7fffffffffffffff, even
though the size of the input requires it to be `long` and only one
constructor can take a `long`. Switch from an explicit
0x7fffffffffffffff to the symbolic constant INT64_MAX, which has the
same value, but a platform-appropriate suffix to force the compiler to
pick the right type.
For general clarity, switch some other instances of integer maximum
literals to symbolic constants of the same value.
This commit has no effect on the generated code (except for changes to
line numbers).
Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/pull/324>
Fixes: 17208cca79 ("Disallow int for vm_distance_squared")
zicodxx reports that f7d0c85 made the thief bot passive and timid.
His analysis suggests that the problem is because f7d0c85 changed
find_connected_distance to return vm_distance::maximum_value() in places
where it previously returned magic values that were not maximum (caching
a distance of F1_0*1000 and returning a distance of -1). Rather than
try to fix the underlying code that relied on these magic values, revert
those return paths to return these unusual values. Move the unusual
values to named constants in file scope so that they are easier to find
and correlate.
Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/286>
Analyzed-by: zicodxx
Fixes: f7d0c853ba ("Use special types for distance/magnitude")
Some callers want the side effect of normalizing the argument and do not
need the magnitude. Per report from btb, the warning broke the OS X
build.
Reported-by: btb <5e4bd5c73f (commitcomment-10899878)>
Fixes: 5e4bd5c73f ("vm_vec_delta_ang: check for vm_vec_copy_normalize failure")
derhass reports that Raspbian g++-4.8.2 rejects vecmat.cpp for
-Wmaybe-uninitialized on t0, t1. Fix it by adding code to return 0 if
vm_vec_copy_normalize leaves the temporary uninitialized.
Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/55>
clang -Wunused-function warns about a 'static constexpr' function
defined in a header if the header is ever included in a file which does
not call the function. Move the function into class scope to silence
the warning and prevent the compiler from considering it when resolving
operator*(T1,T2).
Reported-by: btb <https://github.com/dxx-rebirth/dxx-rebirth/pull/54#issuecomment-86252750>