25 Commits

Author SHA1 Message Date
dobbry-vechur 5b26567057 Run the tiles memorize sweep only when its inputs changed
- added map_memory_sweep_pending to level_cache
- armed it from memory cache dirty writes, map shift and clear
- gated the sweep on draw points, pending writes and origin
- added test hooks that draw a cata_tiles on the fixture
- added end-to-end memorize sweep tests
2026-09-29 05:44:55 +04: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
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
irwiss 0bc43327b7 Use typed points in map memory 2023-07-13 12:55:35 +03:00
irwiss e10e9b7c10 Split memory map dirty caches and cleanup access functions 2023-07-13 12:55:27 +03:00
Alexey 654e02b61c Fix map memory clearing without vision on tile (#66327) 2023-06-20 22:39:19 -04:00
Alexey 220f00e9bb Make vpart rotation closer match to other rotations 2023-06-12 11:53:57 +03:00
Alexey 6ac1d1d2f5 Trim some excess bits from memorized_tile 2023-06-12 11:53:56 +03:00
Alexey 91ed6ec743 Tidy map memory functions 2023-06-12 11:53:56 +03:00
Alexey 71a94a7a67 Make map memory separate terrain and decorations 2023-06-12 11:53:56 +03:00
Alexey 0d9471c588 Fluff; rename class and move implementations to cpp file 2023-06-12 11:53:56 +03:00
John Bytheway c000771088 Re-enable cata-almost-never-auto
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.
2023-05-20 08:55:37 -04:00
Kevin Granade 0eead1fa58 Return an invalid mm_submap if the map_memory is not prepared 2021-07-13 22:19:30 -07:00
Kevin Granade c830c075e9 Silence more CT errors 2021-07-10 13:27:43 -07:00
Kevin Granade 789c7a4689 Unlimited map memory (#47253)
* Encapsulate map::drawsq() arguments and clarify their meaning

* Split map memory into submap-sized chunks

Note: this naive implementation significantly lowers FPS

* Optimize map memory access

Move memorized submaps that would be
affected during drawing into a 2d array.

* Save/load memorized submaps; migrate old mm file

* Remove leftovers from map memory limit

* Some map memory cleanup

* Don't save empty mm submaps

* Deallocate far-away mm submaps on save; report save failure

* Rework tests for map memory

* Don't re-allocate region if old region contains required submaps

* Remove map_memory.h from avatar.h

* Rename memorized_submap -> mm_submap

* Rename mm_submap::clean -> mm_submap::empty, add comments.

* Improve drawsq_params interface

* Remove map_memory.h from lru_cache.cpp

* Add function for rectangle overlapping

* Save mm_submaps in regions

* Fix save/load not using avatar's global pos, improve docs.

* When saving, compress mm_submaps using RLE

* Simplify map rendering in ascii mode

Collect map::draw code in one place, simplify indexing/bound checks.
Remove the "batch drawing" optimization: it doesn't help with drawing, but harms code clarity. Instead, convert all relevant draw methods to use 'wputch' and rely on caller to position the cursor properly.

* Memorize off-screen tiles in ascii mode

* Fix copypasted code

* Fix tile memory saving code, minor cleanup.

* Add debug logging for tile memory operations

* Fix broken saving for tile memory submaps with z != 0

* Lazy allocation for tile memory submaps

Co-authored-by: olanti-p <olanti-p@yandex.ru>
2021-07-08 20:08:30 -07: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
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 79e544f702 Port even more functions to point
Previously missed things in the test code.
2020-06-09 08:51:05 -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
John Bytheway ba319e75d8 Rename test files for consistency
Have all files containing tests be named *_test.cpp.
2020-01-11 11:05:54 -05:00