31 Commits

Author SHA1 Message Date
RenechCDDA da2aaffffd Add quick setup option to clear map 2026-06-22 15:07:51 -04:00
Andrew Krieger 0215b26cce Rewrite all tests to clear map without touching character map memory, for performance. 2026-02-08 23:05:55 -08:00
PatrikLundell 586cf5f1ce Mapify: character etc. sees + sundry others (#79699)
* Mapify: character etc. sees + sundry others

* demanded changes

* Corrected correction
2025-02-18 09:29:22 -06:00
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 537d9d12a1 Standardized get/set pos operations for talker/creature class hierarchy (#79206)
* Standardized get/set pos operations for talker/creature class hierarchy

* sort out merge failure
2025-01-20 08:20:58 +01:00
PatrikLundell f14346c5db Rename map:: get_global->get_abs, bub_from_abs->get_bub, omt_from_abs->get_omt (#79167)
* Renamed map:: getglobal->get_abs, bub_from_abs->get_bub, omt_from_abs->get_omt

* astyle
2025-01-16 09:15:04 +01:00
Clarence "Sparr" Risher 8b27b967ae Replace point constants with static class members 2024-11-26 10:14:26 -05:00
PatrikLundell 5648f805dc typified a bit of map.cpp + dependents 2024-10-12 13:12:23 +02:00
mqrause 8981dd679b use typed tripoints in magic.h and adjacent code 2024-09-28 05:28:58 +02:00
PatrikLundell ef6b53acfb typified a little bit of map.h + dependents (#76340)
* typified a little bit of map.h + dependents
2024-09-27 15:10:36 -07:00
mqrause 4c69e47b2a change target_handler::trajectory to std::vector<tripoint_bub_ms> and then fix errors until it compiles again (#76671)
Co-authored-by: mqrause <martin@qrause.de>
2024-09-27 12:10:50 -07:00
PatrikLundell ab062c5e8b typified a bit of map.h/cpp + some dependents (#75125)
* typified a bit of map.h/cpp + some dependents

* Macro crasher found by one compiler!

* demanded changes

* stupid wokaround for demanded changes

* Sort out conflict mess
2024-09-10 09:42:54 -05:00
RenechCDDA 679f1b13cd Rename fd_reality_tear back to fd_fatigue 2024-05-20 06:41:59 -04:00
I-am-Erk 0898a35860 Rename fatigue to sleepiness (#72708)
* Rename fatigue to sleepiness

I feel like this is going to break some stuff?

* seems my upstream was not up to date. fun.

* A few more I missed

* astyle, json style

gangnam style? Is that still a thing?

* docs

* rename fatigue.json

also catches a few bad f+r I missed

* Update itemgroups.json

* fd_fatigue --> fd_reality_tear

* Update data/mods/MindOverMatter/mapgen/microlab_rooms.json

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

* missed some fd_sleepiness

* fd_sleepines in tests

I really thought I got these already gr.

* Update doc/MAGIC.md

* some clang fizes

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-04-04 20:36:46 -05:00
ehughsbaird ec32b017b5 Use absolute tripoints in spell test
This was causing a failure on one of my PRs. As best I can tell, the
player had the same local position after teleporting due to a map shift.

Use absolute points so it's not vulnerable to map shift issues like
this.

Reproduces with tests/cata_test --rng-seed=1698113342
'show_available_recipes_with_item_as_an_ingredient,remove_field_fd_fatigue'
before this change.
2023-10-25 15:56:13 +00:00
Rewryte 0ef2fe12ca Fix visibility not updating properly when moving, peeking and autodriving (#68138)
* add visibility update

* vis update when peeking

* fix autodrive visibility

* revert visibility optimization

* only cache tile visibility on access

* use apparent_light_at to handle visibility cache

* Revert "use apparent_light_at to handle visibility cache"

This reverts commit 37f66fda9e.

* Revert "only cache tile visibility on access"

This reverts commit b52cd59827.

* pos and time visibility invalidation

Co-Authored-By: andrei <68240139+andrei8l@users.noreply.github.com>

* fix peek and look around

* fix tests

---------

Co-authored-by: andrei <68240139+andrei8l@users.noreply.github.com>
2023-09-25 22:23:37 -04:00
akrieger e97415e789 Convert everything to json_loader from JsonValue::from_* 2022-09-15 22:04:55 -07:00
akrieger 898708829f Fix test compilation 2022-09-15 22:04:54 -07:00
John Bytheway 888709f660 Revamp remove_field_fd_fatigue test
This test suffered from a rare failure case.  When removing one of the
fd_fatigue fields, the player is teleported.  This teleport could move
the map over by one or more submaps, which could bring more fd_fatigue
fields into the map, causing a test failure.

Work around the problem by not checking the entire map for fields; only
check the area where we expect them to be.  This entailed quite a lot of
refactoring of the test case.

Also tweak a few other things to make the test more reliable, such as
controlling light levels, and added more messages on test failure to
help with debugging.
2022-06-30 06:05:37 -04:00
andrei 262de91aa7 Partially revert #56231 (#57235)
This reverts commit 52d991bb44.
2022-05-04 10:45:44 -07:00
Mylie 52d991bb44 Monster cameras, vision optimizations, and an implementation through Slime (#56231)
* Added monster support and Slime Ocularium

Currently the Ocularium cannot be created, this is intentional - Slimewave is still useful through slime minions from Omnicellular

* Large camera and rendering changes

Makes cameras independent from player vision radius limits, dirties vision cache while cameras are active, and adds better vision falloff to cameras.
In addition, removes recalculation of seen_cache during long activities except on refresh frames - an optimization that arose from camera needs.

* Updates tests, bugfixes player half-seeing monsters

Player was able to detect a monster existed, especially on the compass, but not see their location, when the mosnter was outside of sight_max range (usually 9999, but sometimes much smaller for certain mutations and effects)

* Vision lightcasting now checks sightmax first

Also upped MYOPIC vision radius, preventing an adverse effect of excessive blindness - and somehow making a much nicer vision effect for short-sighted characters.

Mirrors were giving inaccurate vision ranges - also I nerfed mirrors because its now possible to nerf mirrors.

Co-authored-by: bombasticSlacks <dillon.matchett@gmail.com>
Co-authored-by: Kevin Granade <kevin.granade@gmail.com>
2022-03-26 19:35:26 -07:00
Rob Goodberry 34a604eeda Add spell effect to remove fields and artifact to close tears in reality (#53661)
* Add spell to remove fields, artifact to close tears and artifact spawn
Attempt to re-add functionality to close tear in reality
references #26226, references #42971
2022-01-27 21:32:36 -08:00
John Bytheway e95a4fc9b8 Promote string_id constants to global statics
Our string_id constants were a mixture of temporaries, locals, and
globals.  Pull them all out as globals, for consistency and efficiency.
The efficiency comes from the fact that each string_id instance caches
its respective int_id, and sharing one instance means that value need
not be recomputed.
2021-11-19 19:10:09 -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
KorGgenT 37222e361e Refactor spell_type to use a shape enum for spell aoe 2020-10-05 01:19:13 -04: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 a1e0ed824f Fix line_test's NPC
It's not OK to simply use a stack-based NPC in the tests; it messes with
the game's internal NPC tracking.  Must use spawn_npc instead.
2020-05-19 21:07:43 -04:00
OrenAudeles 4dfa4f07ec bugfix_line_spell: prevent narrow line spells from being stopped early (#40242)
* bugfix_line_spell: prevent narrow line spells from being stopped early

Line attack spells with narrow AOE (0 or 1) were being prevented from
actually working as intended. The exception added to the condition
prevents exiting early if the spell is a line attack.

* bugfix_line_spell: Split `spell_effect_area` for testability

Splits spell effect area calculation out of `spell_effect_area` to
allow independent testing without calling the drawing function
`explosion_handler::draw_custom_explosion`

* bugfix_line_spell: Generate test to ensure narrow beam spell consistency
2020-05-12 19:24:59 +00:00