18 Commits

Author SHA1 Message Date
GuardianDll 96d084a1f7 Zombies and humanoid monsters in general have vital weakpoints 2026-06-06 19:29:12 +02:00
dumb-kevin 05ab42807e tests/: wrap TU-local test fixture types in anon namespaces
- addiction_test: wrap addict_effect_totals
- battery_density_test: wrap battery_chemistry_family
- comestible_test: wrap all_stats
- encumbrance_test: wrap add_trait
- invlet_test: fuse inventory_location + invlet_state + test_action enums
- throwing_test: fuse throw_test_data + throw_test_pstats, move operator<< inside anon-ns
- vehicle_test: wrap vehicle_preset, damage_preset, folded_item_damage_preset, fuse rack_activation + rack_preset
- vision_test: wrap vision_test_case
- water_movement_test: fuse 6 swimmer/swim structs into one block
- weakpoint_test: wrap weakpoint_test_data, weakpoint_expectation, weakpoint_report
2026-05-12 10:53:28 +04:00
Anton Simakov 0852037580 Minor weakpoint tweaks (#86868)
* make weakpoint duration specified in time units

* add test to print the weakpoint distribution

* Apply suggestions from code review

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

* Please iwyu

* please clang

* please IWYU again

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-05-06 10:50:51 -07: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 c380147ab2 typified creature.h and monster.h (#78565)
* typified creature.h and monster.h

* Update src/monmove.cpp

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

* Update src/monster.h

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

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-16 22:16:00 -06:00
Clarence "Sparr" Risher 8b27b967ae Replace point constants with static class members 2024-11-26 10:14:26 -05:00
Fris0uman 5fa102a572 Enforce mon_ prefix for monster id (#72734)
* Test for mon_ prefix

* Replace LIXA_ with mon_

* deal with pseudo monsters

* Check for prefix in vanilla monster during data load

* better cpp

* fix hardcoded ids

---------

Co-authored-by: Fris0uman <fris0uman@users.noreply.github.com>
2024-04-09 18:33:44 -04: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
David Seguin 6141f7651e damage_type: jsonify damage types
It turns out that a lot of loading code depends on
the availability of certain damage types.

I see two ways to resolve this:
1) Juggle the loading order of JSON types so that damage
   types always load first.
2) Add deferred processing for every type with inline
   damage type definitions.

I went with option 2, which is better but still
not great since new code that loads damage/resistance
definitions would need to also call finalize_damage_map
in the finalizing stage. Option 1 would cause problems
for mods, especially because the load order would matter.

None of this can be done piecemeal, it has to all be ripped
out in one go unless we want commits that don't compile
on their own.
2023-04-24 01:38:15 -04:00
Alexey c25b0ffa37 Widen test margins (#61509) 2022-10-08 20:25:05 -04:00
Alexey Kim 3e27a158bd Translate weakpoint name 2022-10-07 01:08:51 +03: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 da07ae8253 Weakpoints: unit test for deleting/overwriting single weakpoints 2022-06-27 01:30:43 -04:00
David Seguin 385a855d1e Defer weakpoint set loading (#56972)
* Defer weakpoint loading: defer processing weakpoint sets

* Defer weakpoint loading: unit test to check deferral
2022-04-21 17:14:13 -07:00
David Seguin 9fa047efed Weakpoint Sets (#53452)
* Preliminary work for loading weakpoint_sets

* Randomly select a weakpoint set

* Use sequential loading instead of storing separate sets

* Documentation

* Add unit tests, verify proper set order

* Extract strings from "weakpoint_set"

* Style corrections

* Fix string extractor for "weakpoint_set"
2021-12-16 19:47:43 -08:00
Joshua Chin 10db8a6bb9 Add test case 2021-10-07 22:02:08 -04:00
R. Stephens Summerlin 0144ecf5f2 Added basic weakpoint unittest (#51375)
* Added basic weakpoint unittest
* Using weakpoint hit access to get more specific and reliable
2021-09-11 10:44:07 -07:00