92 Commits

Author SHA1 Message Date
Anton Simakov 7d2228f85a use item_location in use actions instead of item * (#89473) 2026-11-17 12:07:16 -06:00
Curtis Merrill 258b80d42b change visitable to item_location, remove item inheritance from visitable, and add item_location inheritance from visitable.
Co-Authored-By: dobbry-vechur <259678433+dobbry-vechur@users.noreply.github.com>
2026-09-30 21:34:09 -04:00
GuardianDll ad4d49584d Streamline water purification application 2026-06-14 10:26:21 +02:00
dumb-kevin c8135ba6a3 Drain gas mask filter via ammo_consume on full absorption
- Revert iuse::gasmask filter drain to ammo_consume
- Add regression test for filter drain at gas_absorbed >= 60
2026-05-10 06:54:36 +04:00
PatrikLundell 8a85060800 Aligned water purification recipe/action + update action to active purifying water (#84051) 2025-12-04 22:21:26 -06:00
typeryougishiki 341116ec17 Rename map::add_item_ret_loc to add_item_or_charges_ret_loc (#80491)
* Rename map::add_item_ret_loc to add_item_or_charges_ret_loc

* Update src/map.cpp

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

* Update src/map.h

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

* Update tests/iuse_test.cpp

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>
2025-04-07 13:18:20 +02: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
PatrikLundell f9900fccc2 Merge pull request #79670 from PatrikLundell/mapify
mapify: split ammo remaining into link and non link
2025-02-16 14:49:56 -06:00
PatrikLundell 7bfa56fa99 Merge branch 'master' into mapify 2025-02-13 08:46:56 +01:00
moxian c44d65a8ae Run IWYU again to pick up the changes 2025-02-11 13:02:19 -08:00
PatrikLundell 0ac675121c mapified a little item prompting a lot of vehicle 2025-02-11 15:10:00 +01: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 40f0b39e62 Merge branch 'master' into RemoveStringInitialisingItems 2025-01-10 17:00:48 +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
PatrikLundell befd4486d1 sundry typification (#78985)
* sundry typification

* demanded work around
2025-01-06 22:26:26 -06:00
Clarence "Sparr" Risher 8b27b967ae Replace point constants with static class members 2024-11-26 10:14:26 -05:00
Zachary Johnson 98a16af4e6 Remove itch from conjunctivitis and make it even shorter when irrigated (#75725)
* Remove itch from chemical conjunctivitis

* Remove itch from chemical conjunctivitis

* Reduce minimum conjunctivitis duration

* Reduce vision penalty of conjunctivitis and add duration cap

* Lint effects.json

* Change eyedrops test and code to reflect new minimum duration

---------

Co-authored-by: zach.johnson <zach.johnson@Vaduminc.com>
Co-authored-by: Maleclypse <54345792+Maleclypse@users.noreply.github.com>
2024-09-29 21:35:20 -05:00
PatrikLundell 39185ca7fd astyle 2024-09-10 14:36:44 +02:00
PatrikLundell 912e302c6e fix water purification compilation issues 2024-09-10 14:35:59 +02:00
Maleclypse 927ac7ba50 Merge branch 'master' into WaterPurification 2024-09-06 13:27:28 -05:00
Zachary Johnson aa5d1b13b7 Add persistent boomer bile effect that causes a stench and skin irritation (#74920)
* Add bile effect

* Add EOC_boomer_bile_affliction

* Adjust resistances

* Add morale_bile

* Add morale effect to EOC_boomer_bile_affliction

* Add new scent sc_bile

* Split bile effect into bile_stink and bile_irritant

* Remove vomiting from boomered and add more resist_traits to bile_stink

* Update EOC_boomer_bile_affliction to reflect split of bile effect

* Allow towel to wipe off bile

* Add `bile_irritant` to `effects_description_for_creature`

* Allow swimming to remove bile from the skin

* Add bile_irritant to towel test

* Give resistance to bile morale impact with certain traits

* Apply suggestions from code review

Co-authored-by: Kevin Granade <kevin.granade@gmail.com>

* Remove social modifiers from bile_stink and add intimidate to bile_irritant

* Remove intimidation bonus from bile_irritant

* Fix misc_effect_on_condition.json merge conflict

* Tweak effect values

* Change health mods to daily health mods

* Add bite effect duration scaling

* Add decay messages

* Fix towel test

* Make being covered in bile not a happy occasion

* Fix IRRITANT_IMMUNE check

* Reorder effects

* Fix cringe merge conflicts

* Update data/json/effects.json

* Update data/json/effects.json

---------

Co-authored-by: Kevin Granade <kevin.granade@gmail.com>
Co-authored-by: Maleclypse <54345792+Maleclypse@users.noreply.github.com>
2024-07-22 19:16:19 -07:00
Zachary Johnson 9a03736169 Fix conjunctivitis duration stacking and eyedrops (#74970)
* Fix conjunctivitis stacking additively
* Fix eyedrops
* Add conjunctivitis to eyedrops test
* Remove unused int_dur_factor field from conjunctivitis
2024-07-12 16:23:01 -07: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
Maleclypse ca7f8b4c0c Merge branch 'master' into WaterPurification 2024-04-24 21:56:04 -05: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
ZeroInternalReflection bdfa309b47 Expand purification testing and ensure birthday is reset 2024-03-04 14:41:47 -05:00
ZeroInternalReflection 30b2298854 Move purification tablets to making a delayed-transform item 2024-03-04 14:41:47 -05:00
ZeroInternalReflection ce213a0bd6 Ensure pur_tablets purify 1 water each via crafting/activation 2024-03-04 14:41:46 -05:00
mqrause c4827eea26 charge removal:
- remove charges from solid comestibles
- default to migrating charges if an item shouldn't have any
- allow consuming comestibles without charges
2023-07-30 23:00:22 +02:00
Anton Simakov d0ae4ade05 Update smoke effect (#66660)
* Update effects.json

* further improvements

* Apply suggestions from code review

* Apply suggestions from code review

* fix tests and hardcoded effects using old smoke effect

* code is super confusing
2023-07-17 19:44:23 -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
Alexey 25f4e7331d Make more tests independent of order (#66231)
* Normalize avatar in iuse_test.cpp to create bodyparts for effects

./tests/cata_test --rng-seed 1686796277 "item cannot contain contents it already has","Sawed off fits in large holster","bag with restrictions and nested bag doesn't fit too large items","pocket_leak","stacking_over_time","item length sanity check","techniques when wielded","armor rigidity","armor_stats","book info","food character is allergic to","list of item actions","tool info","pocket info units - imperial or metric","ammo restriction info","tool transform when activated","eyedrops","antifungal","antiparasitic"

* Put water in bottles in crafting_test

./tests/cata_test --rng-seed 1686797449 "check amphetamine addiction effects","check_monster_behavior_tree_locust","check_monster_behavior_tree_theoretical_absorb","Bionic power capacity","bionic UIDs","bionic weapons","included bionics","fueled bionics","cardio is and isn't affected by certain traits","total crafting time with or without interruption","prompt for liquid containers - crafting 1 makeshift funnel","prompt for liquid containers - batch crafting 3 makeshift funnels","recipes inherit rot of components properly"

* Clear map in item degradation tests

./tests/cata_test --rng-seed 1686874819 "check mutagen addiction effects","body_part_sorting_all","body_part_sorting_main","mtype_species_test","cube_direction_add_om_direction","cube_direction_add_int","cube_direction_subtract_int","Damage indicator thresholds","Degradation on spawned items"

* Use invalidation function instead of moves hack
2023-06-16 12:30:30 -03:00
Hirmuolio 9c0715ca84 Refactor charge consumption on item activation (#60039)
* activation_consume

* consume amount

* activation_charges_sufficient

* return values

* charge consumption

* some test fixes

* test fixes

* astyle

* manhacks

* place_tra

* bionic and furniture

* int ammo_scale

* cleanup

* cleanup

* cleanup

* fix comparison

* dont access charges_to_use directly

* unused arguments

* unused arguments

* for nontools

* use ammo_consume for all

* mod bots

* fix flag

* use ammo_sufficient

* use ammo_sufficient

* no need to check for item deletion

* astyle

* default charges requried

* revert unneeded

* revert unneeded

* update comment

* move to cpp

* note about deletion
2022-08-26 23:44:01 -04: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
Jamuro-g dd08df5712 deprecated towel_soiled and replaced it with filthy tag (#46878) 2021-01-25 19:23:21 +03:00
John Bytheway b285a13080 Make time_point( int ) constructor explicit
Resolves a TODO on that constructor, and one more TODO elsewhere due to
the resulting refactoring.

time_point was implicitly convertible from int.  This led to unclear
code.  In particular, the item constructor took a time_point and a
quantity, and these two ints appeared adjacent with no obvious way to
see what they meant at call sites.

Make the constructor explicit, so the conversion is no longer implicit.
Update the rest of the code accordingly.

In most cases switched from 0 to calendar::turn_zero, which is
equivalent.  In a couple of places, used start_of_cataclysm instead,
when it seemed more appropriate (such as birthday of toilet water).
It's possible there are more cases which should have been something
other than turn_zero.
2020-11-10 11:21:02 -08: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
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
ZhilkinSerg 0ae7066ee0 Merge pull request #42430 from Fris0uman/wetcap
Fix infinite wetness
2020-07-28 14:23:59 +03:00
Fris0uman cac70754fe fix towel test 2020-07-27 20:23:15 +02:00
nexusmrsep 1e95339265 Antifungal drugs work over time (#42388) 2020-07-26 04:03:14 +00:00
Fris0uman 00baf2b753 Move remaining enum arrays to bodypart (#41877) 2020-07-20 01:09:33 +00:00
Fris0uman 0e5613a59a Move hp to bodypart object (#41194) 2020-06-26 08:50:39 +03:00
Fris0uman 2e2f8e9021 Remove body_part from item.cpp (#40866)
* Covers uses bodypart_id
* body_art_set is a cata::flat_set<bodypart_str_id>
2020-05-31 02:07:12 +00:00
DillonSimeone f006dfa172 Inhaler fix (#40790)
* Inhaler fix

Added pocket data to Inhaler, and ammo type for albuterol.

Copied the style of Oxygen Tank for the inhaler, and the style of oxygen for the albuterol.

* update the inhaler test

Co-authored-by: KorGgenT <curtis.r.merrill@gmail.com>
2020-05-30 03:06:18 +00:00