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.
* 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++
Ground vehicle z-level transitions requires that z-levels be enabled,
and getting rid of this option will also allow much of the map code to
be dramatically simplified.
* 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>
fixes error: Construction of 'tripoint' can be simplified using
overloaded arithmetic operators.
[cata-use-point-arithmetic,-warnings-as-errors]
Suggested fix by error output is to use:
const tripoint &pt = tripoint_zero + tripoint(
delta_x * wall_size,
delta_y * wall_size,
delta_z );
tripoint_zero is defined as tripoint(0, 0, 0), so arithmetic operations
would simplify further to just:
const tripoint &pt(
delta_x * wall_size,
delta_y * wall_size,
delta_z );
Further, while it does not cause an error to use a const reference here
it is unnecessary.
Fixes#34752
The solution to #32260 included in #34694 had three serious problems:
1. smashing a random floor tile would cause scores of nearby floor
tiles to collapse, possibly hundreds across multiple z-levels.
2. any vehicle that was above a collapsing floor would get bashed
into scrap metal
3. despite the collapse of all these floors and walls, the floors
on the next z-level up would remain.
So there was very weird behavior that didn't actually resolve the
issue of floating floors after the underlying level collapsed.
The solution is to substantially rewrite collapse_at(), as so:
1. collapse_at() is only called from bash_furn_ter() when a wall
supporting a roof collapses.
2. when a wall collapses, repeat the collapse check for any walls
on the z-level above it.
3. when a tile that is supporting a roof collapses, turn the tile
above it into open_air with no furniture but don't destroy it (which
might destroy any vehicles - unsupported vehicles should fall and
be destroyed that way).
Also, perform the collapse_at() checks for adjacent tiles during
bash_furn_ter() - collapse_at() already checks those adjacent tiles,
so that was doubling their chances of collapse.
collapse_check() now checks the terrain below the current terrain.
It is still possible for a wall supported on several sides but not
supported by anything below to not collapse, but it's less likely.
* 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.
Follows the example of the other tests for this problem area.
Doesn't run by default, and behavior will change depending on
ZLEVELS settings. Run with:
tests/cata_test --option_overrides=ZLEVELS:true "explosion_on_floor_with_rock_floor_basement"
The clear_map function also moved the player to level -2, which is a
little surprising. Move that functionality out to a new function.
For each of the places using clear_map, pick either the new or old
version to use as appropriate.
Also, clear fields in clear_map.