47 Commits

Author SHA1 Message Date
Curtis Merrill 63be141baf remove inventory class and reimplement invlets under avatar
stash starting inv that doesn't fit

fix save load order

initialize string hint in android build to none

reuse free assigned invlet and move it

Update npc.cpp

Update character_inventory.cpp

Update src/avatar.cpp

Update src/npc.cpp

Update src/avatar.cpp

Co-Authored-By: dobbry-vechur <dumbkevin@proton.me>
2026-09-21 16:15:22 -04: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
RenechCDDA bbf3cb6df5 Allow fields to track their sources (i.e. who started a fire) (#84246) 2025-12-22 17:26:16 +01:00
Blueflowers 5eaa701829 Allow dimensions to have their own defined region settings (#83138)
* dimension swap eoc qol

* allow different regions per dimension

* update doc

* update version number on submap test
2025-10-02 20:36:09 +02:00
ShnitzelX2 82a6f17f4d indirectly changed clang appeasement
Update submap_load_test.cpp
2025-10-01 00:07:05 -04:00
Blueflowers 32d877fda3 typing 'default' into the world_test EOC returns you to main world
update EOC to mention the 'default' option

changed 'map_prefix' to 'world_prefix' where appropriate. Began some work on making monsters work while swapping

moved 'world_prefix' to 'map.h'

made overmap save it's data to /worlds subdirectory if world_prefix is set

monsters are now preserved between worlds

added map memory to things that are saved

add a check to stop teleports in other worlds from causing a world swap

add mention of the EOC change in EFFECT_ON_CONDITION.md

hacky way of preventing toilet related mapgen

add a seperate bool variable from 'new_game', 'swapping_worlds'. Also added a check to prevent revification when swapping worlds, as that might cause crashes.

savefile now stores the world_prefix the player was on

moved world swap functions over to new 'multiworld.h/cpp' files and fixed issues with the maps not being properly saved when swapping

don't teleport player to saved in world before the game has even loaded

add 'u_in_world' and add an example usage to 'EOC_world_swap'

made u_teleport display a succesful message if either the teleport or the world swap succeded

Delete sta1xwkz

Apply suggestions from code review

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

bump savegame version number on test

apply clang tidy suggestions

applied more clang-tidy suggestions

Apply suggestions from code review

Co-authored-by: Brambor <tondadrd@seznam.cz>

remove pointless comment

Update multiworld.cpp

Apply suggestions from code review

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

add code optimization

remove redundant declarations

Update multiworld.h
2025-09-14 01:11:29 +02: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
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
Clarence "Sparr" Risher 8b27b967ae Replace point constants with static class members 2024-11-26 10:14:26 -05:00
Anton Simakov c4a030cef6 fix incorrect variable migration (#77992)
* fix incorrect variable migration

* bump version again
2024-11-19 15:19:00 +03:00
Anton Simakov cf579ac306 get rid of npctalk_var_ prefix for eoc variables (#77515)
* get rid of npctalk_var_ prefix for eoc variables

* cleanup after #77055

* deprecate more of type and context

* migrate item vars, make migration happen only once

* doc updates

* migrate u/npc/monster variables

* fix context var migration

* remove `substr( 12 )` in math parser

* move migration to a single function where possible

* no auto

* please clang

* Please clang more

* fix submap load test

* clean up after #77656

* cleanups after #77520
2024-11-16 22:58:03 -06:00
ehughsbaird e6e59e2896 Add additional granularity to overmap vision
On the overmap, there is either no information about a tile, or full
information. This is limited, and makes scouting a fairly boring affair
of going to high places with binoculars for full map information, and it
gives a lot of meta information.

Replace that with five levels of vision:
unseen, vague, outlines, details, full.

This just does the grunt work of adding the levels, and working them
through all the various places they're needed.
2024-07-27 13:25:31 +00:00
PatrikLundell 1e228cae8b typified submap.h/cpp (#74911) 2024-07-08 11:08:39 -07:00
Procyonae e36ac14ae9 Add field type migration test 2024-06-12 21:11:09 +01:00
Procyonae 39458a1ccb Appease our clang overlords 2024-04-13 17:21:58 +01:00
Procyonae 9141c101e2 Update submap_load_test.cpp 2024-04-13 11:58:52 +01:00
Procyonae 8163e8f43a How out of it were I when I wrote this? >-< 2024-04-10 21:52:52 +01:00
Procyonae b6751bd543 Merge branch 'master' into TerFurnMigration 2024-04-10 20:55:22 +01:00
Procyonae a6b492dd93 Update submap_load_test.cpp 2024-04-10 20:44:53 +01:00
Procyonae ceddf4107e Update submap_load_test.cpp 2024-04-10 16:38:03 +01:00
Procyonae a4e3e472f4 Forgot to remove a second unused comparison save 2024-04-10 16:38:03 +01:00
Procyonae fba61a01b8 Test case 2024-04-10 16:38:03 +01:00
Procyonae cc6ca5ddfc Remove extern furn ids (#72834)
* Part 1

* Part 2

* Part 3

* Part 4

* Part 5

* /tests

* Begone naughty lists

* Remove extern

* Appease our clang overlords

* I'm sorry clang daddy
2024-04-09 18:19:59 -04:00
Procyonae e9f4fbd110 Remove extern ter ids (#72766) 2024-04-04 07:08:37 -07:00
wormingdead 63fdf334dc Split vehicle part wheel_caster into small and large variants (#72089)
* Copy wheel_caster item, vehicle part, and recipe

* Change desc & values for item, recipe, and vehicle part

* Change a few vehicles to use large casters

Update a test to match

* Autoformatting

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-03-03 00:41:33 -06:00
Binrui Dong 787759eb87 Fix erroneous mapgen monster names in non-English games (#71846) 2024-02-19 17:07:22 +03:00
Anton Simakov 03540c515d Remove cockatrice (#69208)
* Remove cockatrice

* Update data/json/monsters/bird.json

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>
2023-11-10 18:13:39 -06:00
Alexey e9b8371fd5 Make cruise control on the default and only behavior 2023-04-24 22:23:01 +03:00
Alexey 9c6bd5c072 Obsolete non-modular rigs (#65112)
* Adjust vehicle_part_migration to allow adding tools

* Make vehicle prototypes able to spawn tools

* Delete pre-0.G vehicle_part deserialization migrations

* Obsolete afs_metal_rig and related parts

* Obsolete afs_kitchen_rig

* Obsolete afs_cooking_rig

* Obsolete weldkit

* Obsolete welding_rig / weldrig

* Obsolete chemlab / ap_chemlab

* Obsolete foodco / craft_rig

* Obsolete kitchen_unit

* Tidy up and sort out veh_kiln / veh_forge
2023-04-16 13:35:23 -03:00
anothersimulacrum 21e59e7ab0 Enable JSON unvisited members check (#64922)
* Gambeson fixes

Warmth can't be defined per portion.

* Fix EOC iuse actor fields

EOCs can't take/don't have these fields.

* Fix palette comments

* Remove ups_charges from monster guns

Now energy drain.

A

* common is an NPC class attribute

Not an NPC attribute

* Typo fix

* use_lose_var does not have a value

* Restore unvisited member checking
2023-04-09 02:45:20 -04:00
Alexey Kim 989b9ed018 Add test for invalid ter_ids loading as t_dirt 2023-03-24 17:04:10 +03:00
akrieger e97415e789 Convert everything to json_loader from JsonValue::from_* 2022-09-15 22:04:55 -07:00
akrieger cb636bfee1 Fix test runtime failures. 2022-09-15 22:04:55 -07:00
akrieger 898708829f Fix test compilation 2022-09-15 22:04:54 -07:00
akrieger e25f63289d Delete vestigial JsonIn-using functions 2022-09-15 22:04:53 -07:00
John Bytheway 66746d1e9c Enable clang-tidy check modernize-avoid-c-arrays (#60191)
* Enable clang-tidy check modernize-avoid-c-arrays

Convert various arrays to std::array

* Fix more array warnings

These issues were found in CI due to it compiling with different
features than me.

* Don't us sizeof( std::array )

It's clearer to use .size().
2022-09-02 21:15:39 -03: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
Kevin Granade 7153384225 Prune some unecessary game.h inclusions 2021-08-27 09:24:15 -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
John Bytheway 929aadc021 New clang-tidy check for static int_ids (#48688)
* Initial check for static int_ids

int_ids with static storage duration are dangerous because they can
start to refer to the wrong thing when game data reloads.  This has
caused problems in the past.

Add a check for such variables, and some tests.

* Remove some static int_ids

Fix issues detected by new check by replacing some static int_ids with
their respective string_ids.

Some were just unused, so got deleted instead.

Some cases suppressed, including the furniture and terrain ids, since
they were the most numerous and widely used, so that seemed the riskiest
change.
2021-07-03 07:42:06 -07:00
Curtis Merrill 063b61b5df only do item charge migration once (#47613)
* only do item charge migration once
* change submap test loading version
2021-02-21 23:22:56 -08: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
anothersimulacrum 5a522981a6 Use calories instead of kcal in nutrients
calorie precision is only used internally, all external methods should
be dealing with kcal.

Having calorie precision just enables removing rng-based rounding from
metabolism functions, without losing detail.

There was a very minor change in the Calories of some crafted items, as
is caught in the tests.
2021-01-22 11:21:53 -08:00
anothersimulacrum b0bffd504c Change assert to require
We don't need to crash here, we can just abort the test with REQUIRE
2021-01-22 07:38:54 -08:00
Kevin Granade d64669bf29 Silence an advisory warning. 2020-11-27 07:59:27 -08:00
anothersimulacrum 0b82821eb8 Add submap loading tests
Add tests for each part of submap loading (except for camps, which
appear to be obsolete).

Each test tests a single separate area to prevent cross-contamination,
and as such each has a separate JSON definition.

For tests using the four corners and the point (4,7), this is to ensure
no rotation or anything occurs, and the extra point is to make sure
testing just the corners doesn't bite us somewhere.

All JSON is either taken from or inspired by real JSON produced by our
submap deserializer.
2020-11-26 10:53:42 -08:00