Commit Graph

16 Commits

Author SHA1 Message Date
Binrui Dong 9fdb7ef59c Run IWYU
* Change _ctype.h and __locale to cctype and clocale

* Change _wctype.h to cwctype in game.cpp

* Change __functional_base to functional

* Remove libcxx internal headers

* Remove UNIX system headers

* Fix clang-tidy error with -nostdinc++
2021-02-06 00:18:41 -05:00
Kevin Granade c5ccf0c2c7 IWYU for tests (#42806) 2020-08-09 09:46:57 +03:00
Kevin Granade 6d1841ac67 Precompiled Catch2 header (#42453)
* Hoist catch.hpp include to the top of files

* Precompile the catch header in tests
2020-07-29 01:28:26 +03:00
John Bytheway a17dba9c59 Genericise rectangle and cuboid
To make rectangle and cuboid work more smoothly with the new point
types, make their point type a template argument, and update uses
accordingly.

The new flexibility for these types is used in overmap and overmap_ui.
2020-07-23 09:38:01 -04:00
John Bytheway 0270d2e5df box -> cuboid
Turns out box is the name of an ncurses function, so we can't have a
class template with the same name.  Before I can change cox to a class
template, need to either rename it or put it in a namespace.

Chose to go with renaming it to cuboid.
2020-07-22 09:51:25 -04:00
John Bytheway 8ba3cc4be9 Move box and rectangle to a new header
Plan to expand their functionality to the point where it would bloat the
point.h header.
2020-07-22 07:10:57 -04:00
John Bytheway b3a7b78635 Suppress cata-use-point-apis for coord_point
We don't want to force people to always construct a coord_point from a
point.  Suppress the check in these cases.
2020-07-12 15:50:15 -04:00
John Bytheway 4f597dc72a Make closest_points_first work for all point types
Previously we had separate functions closest_points_first and
closest_tripoints_first.  We'd like to extend this functionality to
coord_point, but it's easier to do if both the raw underlying functions
have the same name (so the generic wrapper can be the same).

To that end, rename closest_tripoints_first to closest_points_first
(they are chosen between based on overload resolution), and add a
wrapper to allow coord_point to be used similarly.
2020-07-08 21:30:13 -04:00
John Bytheway 2fc02d5183 Refactor rectangle and box types
Previously rectangle and box were just a min and max.  Determining
whether the upper bound should be considered to be inclusive was done by
which function was called on it.

I now regret that design choice, and am changing it.  Now the inclusive
vs half-open is part of the rectangle or box type, and the functions are
generic.

This leads to less repetition in the code.

Also, the next step is to make it possible to iterate over rectangles
(to simplify a bunch of our nested for loops), and this design fits much
better for that.
2020-06-11 09:32:31 -04:00
John Bytheway 3e855ff303 Add conversion of points from strings 2020-06-01 09:38:30 -04:00
John Bytheway e189957ff2 Run IWYU 20200408 (#39364)
* Helper script to run IWYU

* Run IWYU

* Update deprecated headers

* Run IWYU again

* Re-suppress cxxabi.h

This pragma got accidentally removed because it was deemed to be a
comment attached to a #include.

* Remove extra SDL header includes

* Fix ime.cpp headers

Some tweaks to help IWYU not break this file by messing with
platform-specific stuff not relevant on Linux.

* Update game.h

* Move new point.h includes inside #ifdef

* Re-add platform_win.h to mapsharing.cpp

* Apply suggestions from code review

Co-authored-by: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
2020-04-10 12:16:19 +03:00
codemime 36402aab06 Improve overmapbuffer searching routines (#37482)
* Add simple unit tests for `closest_points` functions

* Minor simplification and optimization of `closest_points` functions

* Allow specifying minimal distance in `closest_points` functions

* Use `closest_points` functions for overmap buffer search
2020-01-29 21:50:09 +03:00
John Bytheway 7bda6884c3 Custom clang-tidy check to suggest use of named point constants (#33200)
* 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
2019-08-13 23:04:51 +03:00
John Bytheway 62448d28f8 Test for tripoint::xy 2019-07-09 22:14:43 +01:00
John Bytheway 28cbd6f70f Refactor generic_inbounds
Rather than having a free function for generic_inbounds, have two member
functions on each of rectangle and box to test bounds.

Rather than having an optional 'clearance' parameter, have two names for
the two common bounds types (inclusive and half-open ranges).

Refactor all uses to this new API.

The main goal here is to make it easier to use these bounds tests in
fewer lines of code for common cases.  I also think the member function
form reads more smoothly in code.
2019-07-07 20:54:56 +01:00
John Bytheway 3abb2e49de Add (tri)point::to_string() and tripoint::xy()
Some convenience member functions for these types.

And some tests.
2019-07-07 20:53:23 +01:00