- crouch cover and the always-visible own tile are overrides on the
avatar's copy of the transparency cache
- they were reapplied only when that cache was rebuilt, so they stayed
where the avatar had been; in fog a map shift showed a 4x3 patch
- each build now restores the cells it overrode last time and applies
the new ones; the manual dirty calls for crouching go away
- use_amount_stack template in map.cpp is only used inside the TU
- npc_pickup_from_stack template in npcmove.cpp is only used inside the TU
- silences misc-use-internal-linkage
Skip the 3x3 color blur in generate_lightmap when no colored light
source was applied. Track via level_cache::has_colored_lights flag
set in apply_light_source and apply_light_arc.
Replace rl_dist(tripoint::zero, delta) in castLight inner loop with
a precomputed 61x61 LUT for trigdist mode and inline Chebyshev for
square distance mode. Eliminates sqrt from the hottest code path.
* ledge coverage
* update vision mod formula
* creature size determines eye level
* rename params
* only low to high elevation
* add furniture to calc
* prevent vision mod 0
* typo
* astyle
* rename params in h
* fix tangent calc
* cap minimum coverage
* support ledge coverage looking down
* downwards ledge coverage fixes
* change param to creature
* viewer eye level crouch prone support
* add ledge coverage to lightmap
* fix incorrect ledge distance calculation
* remove redundant calc
* update test
* set default furniture coverage to 0
* separate cache process function
* remove unused includes
* fix tests
* ledge_coverage support tripoint to tripoint
* use origin for post processing
only relevant for tests where origin might not match player position
* fix ledge coverage not applying underground
* update test
previous change in test result was caused by an invalid viewer position used in ledge calculation
* Update tests/shadowcasting_test.cpp
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* make function const
* fix crouch and prone not affecting lightmap
* use 3d range setting
* unify above ledge and below ledge code
* use trig_dist instead of rl_dist
* tweak furniture eye level adjustment
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
In LLVM 16 this check was a lot more effective. So, it was briefly
disabled during the migration. This fixes all its warnings again, and
re-enables it.
* Enable clang-tidy check modernize-avoid-c-arrays
Convert various arrays to std::array
* Fix more array warnings
These issues were found in CI due to it compiling with different
features than me.
* Don't us sizeof( std::array )
It's clearer to use .size().
Some common uses of cata::mdarray have very predictable sizes. Define
some default sizes for those cases to reduce verbosity at use sites.
For example, when using point_bub_ms coordinates, the size is probably
MAPSIZE_X x MAPSIZE_Y.
This check looks for uses of std::bind and suggests replacement by
lambda expressions.
The replacements were usually pretty ugly and sometimes didn't work at
all so I rewrote them all.
Unfortunately, astyle is not good at formatting lambda expressions, so
the results are still often ugly. But I claim that they are easier to
follow than the bind expressions, especially for folks who don't know
what bind does.
The Windows stack size limit is smaller than Linux, so need to tweak
some code to avoid large objects on the stack.
(Not all of these changes were actually causing stack overflows. I set
the limit for the clang-tidy check at 100KiB, which is quite
conservative, but also reasonable, IMO. Such large objects are probably
best not put on the stack.
* Enable bugprone-branch-clone
This check looks for multiple branches of an else-if-chain or switch
that are the same. This is often a sign of a copy/paste error.
The cases that hit in these changes did not include any copy/paste
errors, as far as I could see, but they did highlight quite a few cases
where the code could be usefully refactored. I did that, and in other
cases I just suppressed the error.
Did fix one small bug related to furniture moving weariness, but that
was just because I happened to be pointed at nearby code, not because it
specifically related to the check.
* Move utf32_to_utf8 to json.cpp
When I deduplicated this function I previously kept the version in
catacharset.cpp, but that breaks the link for the json formatter, so
instead keep the version in json.cpp.
Co-authored-by: actual-nh <74678550+actual-nh@users.noreply.github.com>
Co-authored-by: Kevin Granade <kevin.granade@gmail.com>
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++
* fix#44068 (thick smoke causes character sprite to disappear completely)
fix related issue with character disappearance in the low light
document transparency and related caches
* introduce `VISIBILITY_FULL=1.0f` constant as the starting value for visibility calculation
remove `LIGHT_TRANSPARENCY_CLEAR` usage from tests
fix the crouching case that breaks the tests
* add vision test case for the avatar fully surrounded by walls (or smoke)
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.
* 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>
* Consolidate main_menu::LAST_TERM
* Add some point overloads for functions
Also a suppression for an SDL wrapper function
* Refactor calls to new functions
* Port function implementations
* 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.
* Fix missing declarations
Mark functions with no prior declarations as static, and remove the
unused ones.
* Move debug_is_safe_string definition
Put it inside !WIN32 since it's only used there.