- made tripoint_range end on its first point when min is above max
- made tripoint_range::size() return 0 for inverted bounds
- added inverted bounds tests to map_iterator_test
- added off-map center tests for map::points_in_radius
* Convert integer parsing test to use normal TEST_CASEs
* Rename test name too similar to another
* Test to enforce normalized test names
* Normalize TEST_CASE names (scripted)
In the aim of adding a circular points_in_radius function, and allowing
other extension to points_in_radius, expand tripoint_range to take an
(optional) 'predicate' function which determines whether or not a
selected point is 'valid' - whether it belongs in the range.
If a point does not match this predicate, we advance through the rest
of the range until we either find a point which does, or we reach the
end.
Due to the nature of allowing an arbitrary function to determine
membership in the range, the size function has been modified to go
through and manually count all points, otherwise it would not be
accurate. This is the motivation for making the predicate optional, as
opposed to simply using an 'always true' function for when no predicate
is specified.
The non-predicate size function is modified to construct the range
tripoint in a way that works for arbitrary point types, instead of only
tripoints.
The circle function may not be exactly what is expected due to requiring
an integer radius as opposed to a diameter. I did what I believed was
most correct, but others may have other expectations.
There's some template voodoo in the points_in_radius_where function to
allow passing in non-templated lambda functions, as it would be poorly
usable otherwise.
Catch2 provides a customization point for converting our types to
strings by specializing the StringMaker template.
We have some specializations in stringmaker.h, but this feature was only
working intermittently. I finally figured out that was due to an ODR
violation. The test files that didn't include stringmaker.h were
compiling a different specialization than the ones that did.
Re-jig the test includes so that any file including catch.hpp also
includes stringmaker.h, thereby ensuring that the custom
specializations are used everywhere and there is no ODR violation.
I achieved this by adding a new cata_catch.h header and making all
existing headers include catch.hpp via the new header.
Make the point type of tripoint_range be a template parameter, so that
it can work for coord_point types as well as simple tripoint.
Provide that template parameter wherever needed, and add a test.
* Initial version of UseNamedPointConstantsCheck
This is intended to convert hand-rolled point constants like
point( 0, 0 ) into point_zero.
* Apply refactoring pass
* Manual fixup of refactored code
Add various manual tweaks to the automatically refactored code where I
think it makes sense.
* Remove some unnecessary initializations
* Add IWYU pragma: keep
* Run IWYU and astyle
* Run IWYU a second time
* Prevent #include <cxxabi.h>
Unclear why IWYU thinks this is needed. It isn't, and it causes
problems on Visual Studio.
A first step towards IWYU support. Doing the sorting first because it
makes reviewing any additions or removals of headers much simpler.
The IWYU order is:
- Associated headers
- Misc system headers
- C++ STL headers
- Other project headers
The biggest change is moving system headers before project headers (they
are usually afterwards in Cata at the moment.
The associated header for a cpp file is the header file which declares
the functions defined in that cpp file. Normally that's the one which
shares the same name (up to extension), and if so IWYU figures it out
automatically.
However, in this project there are many corner cases, so we need to use
IWYU pragma: associated to tell it which header (or, in some cases,
which headers) is the associated header. We are unusual in having
multiple associated headers for some files, which might lead to
discovering some interesting IWYU bugs later, but in theory it is
supported.