24 Commits

Author SHA1 Message Date
kuutekitty cfe6af8c73 remove and migrate obsolete ammo (#88400)
* migrate reloadd, matchead, and bp ammo to the base bullet

* rename

* fix typos

* remove mentiosn of 223, 338

* do 303, 300, 10mm, and others

* 32, 357

* 38, 380

* everything else

* fix tests

* fix nr 2

* start fixing tests and item demographics

* remove all mentions, hopefully

* fix gg_ammo_migration ?
2026-08-28 17:57:09 -05:00
carambola 30843378c0 Add ammo-related unit tests for ammo_type and common_ammo_default (#84397)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-31 22:13:43 +01: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 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 dfb22cab75 resolved merge conflicts 2024-11-26 23:30:46 +01:00
Clarence "Sparr" Risher 8b27b967ae Replace point constants with static class members 2024-11-26 10:14:26 -05:00
PatrikLundell 580e60acc3 typified item.h + cpp 2024-11-25 14:44:12 +01:00
Kevin Granade f61d1cdb6a Use item::energy to stash sub-kJ power quantities for more precise power usage (#75912)
* Use item::energy to stash sub-kJ power quantities for more precise power usage

* address clang warnings
2024-10-02 23:51:33 -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
Holli 336d74d483 Obsolete guns that didn't exist enough or made sense enough (#72429)
* Main removals

* Further mention removal + additional gun removal

Cleans up mentions in NPC shopkeeps, also removes handmade lever shotgun. Was gonna replace it with a winchester 1901 but they do not seem to exist within large enough quantities

* Remove extra comma

Messed up and left a comma

* Lint Generic Gun migration

* Remove LeMat from ammo_test

* Missed lemat_revolver_shotgun in generic guns

---------

Co-authored-by: Kevin Granade <kevin.granade@gmail.com>
2024-03-22 18:40:44 -07:00
DoctorBoomstick 388ffbd175 AK-74m gets knighted with the obsoletion stick (#71575)
* fixes merge errors.

* Bonks the AK-74M on the nose.

* Update data/json/items/gun/545x39.json

Co-authored-by: TheShadowFerret <99621099+TheShadowFerret@users.noreply.github.com>

* axes refferences to particuler brands.

* bug fixes.

* Update data/json/items/magazine/545x39.json

Co-authored-by: Tonkatsu <7764202+tenmillimaster@users.noreply.github.com>

* Update data/json/items/magazine/545x39.json

Co-authored-by: Tonkatsu <7764202+tenmillimaster@users.noreply.github.com>

* Update data/json/items/magazine/545x39.json

Co-authored-by: Tonkatsu <7764202+tenmillimaster@users.noreply.github.com>

* Update data/json/items/gun/545x39.json

Co-authored-by: Tonkatsu <7764202+tenmillimaster@users.noreply.github.com>

* takes an axe to the descriptions

* removes unused files.

* fixes error in tests.

---------

Co-authored-by: TheShadowFerret <99621099+TheShadowFerret@users.noreply.github.com>
Co-authored-by: Tonkatsu <7764202+tenmillimaster@users.noreply.github.com>
2024-02-19 22:31:29 -06:00
mqrause bd211963e6 move item_pocket::pocket_type to it's own header 2023-11-27 13:22:35 +01: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
Hirmuolio 4609c7a9cd Fix infinite recursion when trying to drain battery (#65488)
* check for available

* better fix

* comment
2023-05-05 22:17:19 -04:00
Dillon Matchett 99ad23585c Bullet damage by barrel length (#64961)
* inheritance still WIP, some UI missing, mods needed

* Update src/damage.h

Co-authored-by: anothersimulacrum <anothersimulacrum@gmail.com>

* Update src/damage.cpp

Co-authored-by: anothersimulacrum <anothersimulacrum@gmail.com>

* tests, rest of the code

* linting

* Update src/item.cpp

* Apply suggestions from code review

* Update tests/ammo_test.cpp

* Update ammo_test.cpp

---------

Co-authored-by: anothersimulacrum <anothersimulacrum@gmail.com>
2023-04-11 10:21:55 -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
Kevin Granade 51bcf73317 Reverse some assertions about gun internal state 2020-12-07 14:38:56 -08: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
Eric Pierce e22f0bdeee Add ammo test for ammo_types and ammo_default 2020-07-06 17:25:54 -06:00