22 Commits

Author SHA1 Message Date
moxian c44d65a8ae Run IWYU again to pick up the changes 2025-02-11 13:02:19 -08:00
moxian 2ee44002fd Mechanically IWYU the tests
python3 ~/github/include-what-you-use/iwyu_tool.py -j5 -p build $( find
src/ tests/ -maxdepth 1 -name '*.cpp' | grep -v -f
tools/iwyu/bad_files.txt )  --  -Xiwyu --comment_style=long -Xiwyu -
-max_line_length=1000 -Xiwyu --cxx17ns -Xiwyu
--mapping_file=../tools/iwyu/cata.imp   | tee out/iwyu/f-a-01.txt >
/dev/null

followed by

cat out/iwyu/f-a-02.txt | python3
~/github/include-what-you-use/fix_includes.py --reorder --nosafe_headers

followed by manual fixups of <stddef.h> -> <cstddef> and similar.

tests/generic_factory_test.cpp gets mangled very badly (IWYU bug) so
it's excluded from the list.

Code size:
includes:
$ cat obj/tiles/*.inc | wc
 288068  576136 17898260
$ cat tests/obj/tiles/*.inc | wc
 167044  334088 10465766

post-processed source (clang -E):
./make_preproc.sh src/
68567896 177775140 2134075721
./make_preproc.sh tests/
39341957 102891720 1243323710
2025-02-10 00:46:57 -08:00
PatrikLundell f89a647c9c Converted coordinate_conversions.h usages (#76754)
* Converted coordinate_conversions.h usages

* missed to remove an 'inline'

* sorting out merge issues

* Update src/iexamine.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* should alternate lines from the two sources in merge

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-11 22:33:47 -05:00
akrieger 0ca32b80f7 Make coord_point into coord_point_ob and parent class of coord_point_ib (#75376) 2024-08-01 21:09:58 -07:00
alef 46f811746a Only init game if we're running tests that need it (#70901)
* Only init game if no select tests have [nogame] tag

* Tests tagged [utility] never require a game object

* Add elapsed time for `[nogame]` too

* Obey astyle

* Obey clang-tidy

* Optimize for cases of invalid tags leading quitting

* Tag more tests with `[nogame]`

* Fix logic to derive `needs_game` from `[nogame]`

https://github.com/CleverRaven/Cataclysm-DDA/pull/70901#discussion_r1451648340

* Do not access `world_generator` when no game was initialized

https://github.com/CleverRaven/Cataclysm-DDA/pull/70901#discussion_r1451648830

* Obey astyle
2024-01-14 09:50:47 -06:00
prharvey 4132b430fb Remove unused variables. 2023-12-27 01:28:48 -07:00
prharvey 8d58cf5fee Add _ib variants of coord. 2023-12-27 01:28:48 -07:00
John Bytheway dd5b7af626 Apply clang-tidy fixes for C++17
A few small changes in C++17 mean that clang-tidy is now able to apply a
few more fixes.  Do so.
2023-03-14 19:26:16 -04:00
John Bytheway 72741cf290 Migrate map::abs_sub to typesafe point
It is now a tripoint_abs_sm, rather than simply a tripoint.  Also update
the accessor functions for it and various other related code.
2022-02-20 18:47:39 -05:00
John Bytheway ebd549b300 Fix StringMaker ODR violations in tests
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.
2021-07-03 07:42:06 -07:00
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
John Bytheway bf910e50e3 Declare lots of things static
Use the new clang-tidy check to convert a bunch of declarations to
static.

In a few cases, there were 'secret' dependencies being exposed without
headers.  Convert those to work via headers instead.
2020-09-05 23:13:04 -04:00
Kevin Granade c5ccf0c2c7 IWYU for tests (#42806) 2020-08-09 09:46:57 +03:00
John Bytheway b66068ac0c Add a few more functions for coord_point (#42141)
Things we want to be able to call on these new point types:
* square_dist
* trig_dist
* rl_dist
* manhattan_dist
* direction_from
* line_to
* midpoint

And tests for all the above.
2020-07-16 06:14:07 +00:00
John Bytheway c1719b1ab3 Add project_combine; revamp project_remain
It was never clear how project_remain should work for tripoints.  Should
the z coordinate be included in the quotient, the remainder, or both?

This implementation allows the client code to choose which of the two
will contain it (you must pick exactly one).

Add project_combine, which is the opposite operation, and a test that
one operation reverses the other.
2020-07-13 20:05:00 -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 9a0fdae34a Suppress cata-use-point-apis in some tests
We are specifically testing the APIs that this check would refactor the
code away from.
2020-07-07 09:46:14 -04:00
John Bytheway 7496683b0e Appease clang-tidy 2020-07-07 09:46:14 -04:00
John Bytheway 7051f4d041 Add more operators to coord_point
Using these points in a larger proof of concept revealed the need for
more operators.  Add them.

* Allow adding or subtracting raw points from coord_points (so that e.g.
  point_north, etc. can be used easily).
* Allow more mixed-dimension arithmetic.
* Allow subtracting two similarly-typed points to create a relative
  point.
* Allow non-const access to individual coordinates.
2020-07-07 09:46:13 -04:00
John Bytheway 65bd43858f Swap origin and scale everywhere
After reading this code more, I've decided that the notation and
mnemonics I'm adding are easier to understand if you put the origin
before scale.

e.g. point_sm_ms is a "submap map square", and point_rel_omt is a
"relative overmap terrain".
2020-07-07 09:46:13 -04:00
John Bytheway 11d587ac7b More coord_point features
Add arithmetic and comparison operator overloads, constructors, hashing.
2020-07-07 09:46:13 -04:00
John Bytheway f35eb51e31 Tests for the coord_point conversion functions
This tests project_to and project_remain.
2020-07-07 09:46:13 -04:00