45 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
dobbry-vechur 97067ca137 Use Catch::Matchers:: namespace for all test matchers (#85907) 2026-03-18 08:04:02 -05:00
ShnitzelX2 41cd225e74 remove old use/can_use iuse_actor functions 2025-12-30 18:12:32 -05:00
Procyonae 703cc90a71 Remove STATIC() macro (#81780)
* Remove STATIC macro a-f

Fixes a typo in character_armor where a damage type was somehow being implicitly cast to a bool?

* Remove STATIC macro g-i

Trusts a post 0.H todo comment to do with cables, the PR was huge so I'm just hoping this got migrated properly

* Remove STATIC macro j-z

* Remove make_static.h includes

* Cleanup

* Remove STATIC macro /tests

* Remove comments yesterday me left for today me

* Update clang for STATIC macro removal

* Cleanup round 2

* Cleanup round 2

The A-Z before a-z thing gets me every time >-<
2025-07-15 13:29:50 +02: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 30b83d6c34 add needed includes 2025-02-13 09:15:16 +01:00
PatrikLundell 7bfa56fa99 Merge branch 'master' into mapify 2025-02-13 08:46:56 +01: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 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 ce52b295ea typified iuse & iuse_actor 2024-12-04 14:35:45 +01:00
Anton Simakov 9dfbd30a7a Sweep of sanification for electronic devices (#76029)
* sanify electronic

* more

* more

* fix few errors

* fix itemgroups after changes, fix battery test

* more test fixes

* add missed comment on heavy flashlight

* add shoulder strap because it's cool and it's part of irl item

* more test fixes

* Update tests/item_autopickup_test.cpp

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

* and more

* and more

* more

* more

* more

* further tweaks of heavy-duty flashlight

* more

* more

* more

* more

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-01 16:58:58 -05:00
Anton Simakov 2db2a2ea19 Second nail into the battery coffin (#75865)
* update batteries

* migrate all removed batteries, clean up

* sprinkle occasional batteries in boxes around the world

* fix density test fail

* fix wrong chemistry on some batteries

* obsolete medium_disposable_cell, replace current medium_battery_cell(D battery) with modern 18650 battery

* fix redefinition of 'itype_medium_battery_cell'

* remove light_disposable_cell, change the names and descriptions of baterries to match what they are

* migrate light_disposable_cell, astyle battery density test

* fix test failures

* swap battery to please ups crafting test

* swap ids for tool batteries to make more sense (and not replace all ids in the entire game)

* migrate removed vehicle parts, fix unreachable cell recipe

* fix missed afs battery
2024-08-26 12:43:26 -07:00
mqrause bd211963e6 move item_pocket::pocket_type to it's own header 2023-11-27 13:22:35 +01:00
Kamayana bde90cf985 Show insertion failure reasons in Insert menu and AIM (#68191)
* Reword some insertion errors

Volume error to "item is too big" to match the others, ammo error to the more gramatically correct "item is not ammunition"

* Show insertion errors in `put_into_container`

* Make plastic beverage bags start sealed

* Adjust bucket-handling in `pick_one_up`

* Don't use bucket-style containers in `character_best_pocket` test

* Show insert failure reasons by giving ret_val to all `can_contain` functions

* Show un-insertable items in insert menu, with denial reasons

* Remove `move_content`

I kept this outdated function around after my first AIM revision, worried it would be needed for something. I'm more confident now - it's unnecessary.

* Declaration order

* Reword parent pocket failures

* Protect against infinite loop when adding items

* Prompt player to remove bucket contents in drop action and AIM move

* Update src/advanced_inv.cpp

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

* Double spaces

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-09-19 19:30:00 -05:00
Hirmuolio c6f8dc39db Update all active items to new tick action system and remove old system (#67352)
* remove bool t uses

* remove bool t uses

* remove bool t uses

* split multicooker

* split remoteveh

* remove bool t uses

* lint

* unused

* radiocaron

* radiocontrol

* foodperson

* ehandcuffs

* Update data/json/items/tool/radio_tools.json

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

* laptop music

* robotcontrol

* portable_game

* gasmask

* dive_tank

* unused

* mp3

* geiger

* noise_emitter

* fish trap

* remove bool t

* merge fix

* mods

* merge fix

* merge fix

* better music

* fix mp3

* better messages

* better messages

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-08-06 08:44:51 -05:00
Hirmuolio ffe5a45099 Carrier for items on ground is nullptr (#66292)
* remove forced player

* multicooker

* radio controller

* mp3

* manage_exosuit

* electricstorage

* incendiary grnd

* crater mapgen

* put avatar back

* geiger

* gasmask

* fishing trap

* astyle

* ehandcuffs

* dive_tank

* style

* message_iuse

* remove activation

* iuse_actor switch from references to pointers

* astyle

* worn items

* p checks

* put thing back

* merge fix

* astyle

* invoke

* can_use

* revert can_use

* transforming item in processing

* unused var

* throw activation test

* remove reference to nullptr

* fix previous commit

* fix fireweapon

* astyle
2023-07-11 15:29:16 -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
John Bytheway d6c0bc8b57 Support ret_val<void> and replace ret_val<bool> (#59468)
ret_val<T> is supossed to be a T value *and also* a bool (and optionally
a string message).  However, all uses of ret_val<bool> were setting the
two bool values to the same thing.  Really they wanted ret_val<void>,
but that didn't compile.

Make it so that ret_val<void> does work, and replace all uses of
ret_val<bool> with it.  I found zero instances of 'true' ret_val<bool>
where a bool was being conveyed in addition to the success/failure info.
2022-07-21 21:02:58 -04:00
Eric Pierce 3eaaf60b1a Add test for item_contents::empty(_with_no_mods) 2022-01-16 12:30:13 -07:00
Hirmuolio 0f3ea21bba Reloadability check refactoring (#53102)
* use item instead of item_id
* watertight containers are reloadable
* mods are reloadable, same_contents checks contents of contents
* add large number of new tests
2021-12-12 18:03:27 -08: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
Hirmuolio 85414d7ee8 Allow flag limits for magazine well compatibility (#51027) 2021-08-28 15:59:23 -07:00
Eric 51520f6245 Move more player to character (#50971)
* player to character

* Update npc_talk_test.cpp
2021-08-23 00:58:51 -07:00
mqrause e1a3575a09 private contents member and remove most item_contents.h includes 2021-07-23 00:23:22 +02:00
mqrause 061329b3ce wrappers for item_contents::has_pocket_type and item_contents::has_any_with in item 2021-07-07 15:56:05 +02: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
Hirmuolio 207a94de84 Add missing NO_RELOAD flags (#48592) 2021-04-21 18:02:36 +03: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
Aivean 6303014b84 mass-rename flag_str_id to flag_id 2020-11-19 19:24:50 -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
Aivean e66387a377 refactor direct access to item::item_tags and itype::item_tags to accessor and mutator methods 2020-10-07 18:48:30 -07:00
akirashirosawa f33b3055e2 added debugmsg to put_in, fixed a few container issues 2020-09-02 09:35:19 +03:00
akirashirosawa 458d309da1 add debugmsg capture for tests 2020-09-01 21:41:38 +03:00
Eric Pierce fa53b934ce Add iuse_transform regression test
When a modded tool is turned on, ensure the battery remains installed,
and the tool remains modded to accept that kind of battery.

Covers issues #42764 and #42854
2020-08-22 14:32:23 -06:00
Eric Pierce c0f4f82d60 Remove stale FIXMEs, refactor battery mod test 2020-08-22 14:32:23 -06:00
Kevin Granade c5ccf0c2c7 IWYU for tests (#42806) 2020-08-09 09:46:57 +03:00
Kevin Granade 2684dcbcf1 Merge pull request #42480 from ZhilkinSerg/sa-2020-06-29
Code optimizations reported by static code analysis (2020-06-29)
2020-07-29 23:55:24 +00: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 f6b5d440c6 Removed redundant empty lines 2020-07-28 22:08:34 +03:00
John Bytheway 84c016c8d5 CI fixes 20200718 (#42262)
* Don't compare bool to int

This was giving a warning on Visual Studio.

* Make memorial test platform-independent

It failed on platforms with a different newline character.
2020-07-19 10:49:47 +03:00
Curtis Merrill 2b237d4ba8 Reimplement original behavior for default magazines for nested containers (#42225) 2020-07-18 22:05:26 +00:00
KorGgenT f7bff4f372 adjust test to pass 2020-07-07 19:50:20 -04:00
KorGgenT 939540d82e separate item mod loading from other content loading 2020-07-07 16:19:53 -04:00
Eric Pierce 142f2a2b65 Add test for batteries, tools, and battery mod
TODO: Write a real commit message
2020-07-06 17:25:54 -06:00