49 Commits

Author SHA1 Message Date
Andrew Krieger 0215b26cce Rewrite all tests to clear map without touching character map memory, for performance. 2026-02-08 23:05:55 -08:00
BalthazarArgall e9a39c6a56 Update drink containers (#83710)
* initial commit

* change itemgroups

* fix everything

* remove the sources from the code

* remove pale_ale from tested items in item_test.cpp

* remove more default containers

* fix morale test?

* annoying itype name conventions

* bruh

* fix UHT milk default container
2025-11-13 22:05:34 -06:00
RenechCDDA 51ebac5161 Remove cannibal's last consumption bonus (#81379)
* Remove cannibal's last consumption bonus
2025-06-21 02:32:32 -07:00
RenechCDDA 37f57f1c70 Remove almost all consumption bonuses from cannibals (#81357) 2025-06-19 17:37:03 -07: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
Procyonae 2a922a6c59 Appease our clang overlords
Failing to remember Z before a strikes again
2025-01-10 20:14:36 +00:00
Procyonae 982df19d0f Change /tests remaining uses of raw string item initialisation to use itype_id s
"remaining uses" being somewhat of an understatement -_-
2025-01-10 15:31:15 +00:00
Clarence "Sparr" Risher 8b27b967ae Replace point constants with static class members 2024-11-26 10:14:26 -05:00
PatrikLundell 456a199f5c typified a bit of map.cpp and dependents 2024-10-08 16:23:15 +02:00
PatrikLundell 027459c311 Typified a bit of map.h/cpp + dependents (#74979)
* Typified a bit of map.h/cpp + dependents

* demanded change

* demanded change
2024-07-17 08:47:51 -04:00
Procyonae fa1e64ec8f Remove the redundant includes bc I were just being lazy 2024-06-05 11:38:35 +01:00
Procyonae 47eb971c97 Forgot /tests 2024-05-31 21:48:49 +01:00
RenechCDDA d5394f8b98 Oops, update tests for cannibal vitamin 2024-03-09 07:05:27 -05: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
cakepie bd3116f0c2 Charges / item consumption for non-comestible healing; first aid items from comestible to generic (#63434)
* healing tools consumption

* move firstaid item defs

* firstaid comestible -> tool

* update tests

* TOOL -> GENERIC

* repackage small item spawns
2023-03-03 11:00:14 -04:00
David Seguin e130877ec6 Merge pull request #59914 from ZeroInternalReflection/GrossMeatAndVeggies
Fix meat and vegetable intolerance debuff messages
2022-08-06 12:29:22 -04:00
ZeroInternalReflection cde350e90f Update tests to use new antiveggy/antimeat morale types 2022-08-04 22:59:10 -04:00
John Bytheway 9ed64bcbb8 Port activity code to type-safe points
This work involved converting player_activity::placement to a
tripoint_abs_ms and then dealing with the fallout elsewhere.

For most activities, placement was already a global tripoint.  In a few
cases it was a local tripoint, so conversions needed to be added at each
side.

In one case (ACT_START_ENGINE) it was a position relative to the avatar.
That's because the player might be starting the engine in a moving
vehicle, so using a fixed location isn't reliable.  To support that use
case I added an additional relative_placement member to player_activity.

If and when ACT_START_ENGINE is migrated to activity_actor, that member
can be removed.

Also, added some documentation for the reality bubble coordinate system
and the conversion functions between global and local coordinates.
2022-08-01 08:26:22 -04:00
mqrause d688521e7b Character::i_add returns an item_location (#58191)
Co-authored-by: mqrause <martin@qrause.de>
2022-06-18 21:27:30 -04:00
Mylie b0b5bcf2c2 Mutation infrastructure and a Threshold calculation revamp (#56421)
* Tear down entire threshold calcs + rebuild them
* Debug options for testing mutation categories
* New character menu properly removes mutations
* Adds mutations to Nerd- I mean Manatouched
Co-authored-by: Maleclypse <54345792+Maleclypse@users.noreply.github.com>
2022-04-04 10:25:47 -07:00
KorGgenT 99a62861eb Create wrapper for worn items called outfit 2022-02-27 23:44:51 -05: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
mqrause e1a3575a09 private contents member and remove most item_contents.h includes 2021-07-23 00:23:22 +02:00
mqrause df54fe15b2 wrappers for item_contents::only_item and item_contents::favorite_settings_menu in item 2021-07-12 14:46:47 +02:00
John Bytheway 8cc6378fc5 clang-tidy modernize-use-emplace (#48661)
* Port code to emplace_back

This is clang-tidy making automated changes to convert push_back into
emplace_back whenever the argument to push_back is either a constructor
call for the type in question of an expression of a type implicitly
convertible to the type in question.

This should eliminate one move-construction of the inserted object for
each call.

* Enable clang-tidy modernize-use-emplace
2021-07-03 07:42:06 -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
ZhilkinSerg 413f54ceb2 Removed excessive empty lines and empty declarators 2020-11-08 00:34:52 +03:00
Aivean c32a629ceb replace all item flag constants with static string_ids
remove adapter has_flag (and related) methods that took string argument
change all remaining method signatures where item flags were passed as strings
2020-10-18 19:56:40 -07:00
John Bytheway d63d3bd35a Make mutation_category ids be string_ids
The mutation_category_trait objects have ids, but they were just
std::strings.  Make them be a string_id<mutation_category_trait>
instead.

This is a general move towards type safety, although the specific goal I
wanted to achieve was better validity checking of cata_variants.
2020-09-03 07:39:35 -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
Fris0uman 68e91cfe72 Move encumbrance to bodyparts (#41860) 2020-07-08 09:37:37 +03:00
Kevin Granade 8185212260 Map reference migration part eight 2020-06-28 22:21:07 +00:00
klorpa 7a0fae2373 Converts Material Tags To Arrays (#41250) 2020-06-13 08:18:43 +00:00
ZhilkinSerg fa980f35ea Use constant references in loops+modernize loops 2020-05-29 11:06:38 +03:00
ZhilkinSerg d327e413bb Remove redundant empty lines 2020-05-25 15:00:17 +03:00
KorGgenT e879fcd328 more test fixes 2020-05-02 16:05:11 -04:00
KorGgenT f3df832b04 Update modify_morale_test.cpp 2020-05-02 16:05:10 -04:00
KorGgenT e581a2d79e fix a few seg faults in the tests 2020-05-02 16:05:10 -04:00
Eric Pierce 3f8c654168 Remove table buff/debuff for medicine 2020-04-15 16:49:37 -06: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
Eric Pierce c0c25c033e Don't amplify morale bonus/penalty for non-ingested junk food (#39075)
* Remove junk food morale effects from gum

Comestibles with the NO_INGEST flag are now exempt from ALLERGEN_JUNK
penalties or bonuses in `modify_morale`.

The in-game effect is that characters with "Junk Food intolerance" will
no longer get penalized (with a "Yuck!" message) when eating gum or
caffeinated gum. Similarly, characters with "Sweet tooth" or "Sugar
loving" will not get extra morale bonuses for "Mmm, junk food" when
eating NO_INGEST items like gum.

Tested with 3 test cases, and tested in-game with junk food intolerance
and sweet tooth.

* Force allergen/no_ingest and explain why
2020-03-28 05:37:32 +00:00
ZhilkinSerg 3799315672 Revert string centralization 2020-03-18 21:37:31 +00:00
Eric Pierce c42c607231 Move the NO_INGEST check to table/chair section
Also include regression test cases
2020-03-16 03:40:13 +00:00
Eric Pierce 0151c208e2 Don't modify food morale for non-ingestibles
Return immediately from `Character::modify_morale` if the item has the
"NO_INGEST" flag. This prevents applying morale effects such as
ATE_WITH_TABLE when using non-food items such as bandages.

Includes two new regression tests that were failing before this fix was
made, and are now passing.
2020-03-10 18:06:34 -06:00
Eric Pierce d926e37e60 Add tests for food morale modifiers (#38586)
* Add first draft of modify_morale tests
* Add sweet tooth and saprophage test cases
* Tests for allergies and intolerances
* Simplify morale level checks
has_morale returns the modifier for that particualr morale type, so
using this for assertions should allow the contribution of `fun_for` to
be eliminated.
* Finish ursine honey test and tidy up
* Add tests for dining with table and chair
With and without strict table manners
* Hot food test, final cleanup
2020-03-08 02:01:59 +00:00