18 Commits

Author SHA1 Message Date
Andrew Krieger f59eded3b7 Don't waste time clearing map memory when clearing maps for tests 2026-02-08 13:58:47 -08: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
Procyonae cff5cc8a6d Change C++ ids called "name" to something better too 2025-01-15 21:47:30 +00:00
RenechCDDA 43c2abf54a Fix some tests that relied on previous ordering, maybe 2024-12-21 02:22:39 -05:00
PatrikLundell 8f19d8e971 typified map.h + dependents, end of first pass (#76888) 2024-10-07 13:23:18 -07:00
Alexey 07356b65a5 Normalize TEST_CASE names (#66241)
* Convert integer parsing test to use normal TEST_CASEs

* Rename test name too similar to another

* Test to enforce normalized test names

* Normalize TEST_CASE names (scripted)
2023-06-17 13:57:19 -03:00
Alexey a351fd32ec Raise test margins for less test flakes (#66192) 2023-06-14 18:03:06 -03:00
Clarence "Sparr" Risher f93cbc35a6 Refactor city.cpp/.h out of overmap.cpp/.h 2023-03-31 18:47:42 -04:00
David Seguin 75e21e18a2 Handle mon_null in monster upgrade groups (#61672)
* mongroup: remove monster when upgrading to mon_null

* mongroup: documentation & tests
2022-10-14 11:24:49 +02:00
David Seguin 903757a0fd Mongroup: multi-spawn upgrades respect restrictions (#60324)
* mongroup: only multi-upgrade to entries that pass validation

* mongroup: unit tests for multi-upgrade restrictions
2022-08-26 15:35:04 +02:00
David Seguin f8bc23660c Mongroup: allow upgrading to entries with multiple spawns (#60000)
* Mongroup: allow monsters to upgrade into multiples from group

* Mongroup: unit test & documentation
2022-08-14 13:32:18 -03:00
John Bytheway 065cfb206b Fix excessive monster spawns (#59724)
Partially addresses #55104.

There was a bug in MonsterGroupManager::GetResultFromGroup where
sometimes it would return a spawn but not update *quantity accordingly,
where *quantity is supposed to be the number of monsters requested,
reduced by the number actually returned.  Because the quantity wasn't
updated, mapgen could get into a loop where it continued to spawn
monsters over and over again, potentially millions of times, wasting
many gigabytes of RAM.  It wouldn't actually be a problem in-game,
though; I think this is because all the monsters were spawned on the
same tile, and so only one actually came into existence when the map was
loaded.

The error was a result of the complex logic related to subgroup spawns.
The whole function was very convoluted and confusing, so it's not
surprising there was an issue with it.

I rewrote the whole function.  I think it's much clearer now.  It should
also be more performant, because it aborts early in more cases.  I think
I fixed one other corner case related to failed spawns from subgroups,
but I suspect that one wasn't being encountered in practice.

Also added a test for this issue.
2022-07-29 10:57:40 -04:00
John Bytheway 875cadf142 Enable performance-unnecessary-value-param (#59533)
This clang-tidy check looks for potentially-expensive-to-copy value
parameters which are only used as const values.

If they are only used once, in an assignment or initialization, then
their use will be converted to std::move.  This can save a copy in some
cases.

Otherwise, the parameter will be converted to a const reference, which
can also save a copy in some cases.
2022-07-23 19:29:45 -04:00
David Seguin 2f227d4490 Mongroup: subgroup spawning fixes (#59281)
* Mongroup: do not expand subgroup when spawning

* Mongroup: unit test

* Mongroup: use parent pack_size to select # of subentries + unit test
2022-07-19 14:50:59 -03:00
Binrui Dong 3acbcaaaf8 Move some template specializations of StringMaker<T>::convert<T> to a cpp file 2022-01-04 02:22:29 +08:00
David Seguin 9bbe06ec70 Fix overmap mongroup spawn logic (#53406)
* Normalize overmap spawns & maintain explicit null default monster
2021-12-18 10:23:10 -08:00
David Seguin dab95f7e61 Event-based monsters spawns (#53192)
* Event based monsters: add new field "event"
- Added new field "event to monster group entries
- If defined, use event to determine if the monster/group is spawnable
* Event based monsters: add option to control event monster spawns
* Event based monsters: add unit tests and fix spawn logic
* Event based monsters: astyle & linting corrections
* Event based monsters: added documentation
* Event based monsters: expand unit tests
Added additional tests to check spawns for event-only mongroups
* Event based monsters: fix empty check (clang-tidy)
* Event based monsters: cache all freq totals & return early
2021-12-12 18:05:55 -08:00