78 Commits

Author SHA1 Message Date
Curtis Merrill d64b8f9ffb remove 0.F savegame_json compatibility
Update stats_tracker_test.cpp

Update stats_tracker_test.cpp

Update savegame_json.cpp
2026-10-01 16:20:26 -04:00
Antti Riikonen adbc2d35d2 Run tests in CI for multiple sets of mods (#83242)
* Tests are run once for each mod set

* Remove the --mods from build matrix param and add it to test invocation

* Update .github/workflows/matrix.yml

* Update .github/workflows/matrix.yml

* Update .github/workflows/matrix.yml

* Update .github/workflows/matrix.yml

* In tests, eoc_selector cancels or selects 1st item

* Return a simpler lambda early instead if we're in test mode

* Update .github/workflows/matrix.yml

* Update .github/workflows/matrix.yml

* Update .github/workflows/matrix.yml

* Update .github/workflows/matrix.yml

* Add custom event send function support to check_memorial

* Fix npc_talk_test sender

* Fix stats_tracker_test sender

* astyle

* May it please the IWYU

* stats_tracker_count_events test: clean up any existing mobs before test

* stats_tracker_count_events test: well why don't we clean the whole map instead

* stats_tracker_count_events test: just nuke the world

* Apply suggestion from @Maleclypse

* Apply suggestion from @Maleclypse

* I guess spawn_test_monster lives in map_helpers_tests.h now

* Wy u iwyu

* Update matrix.yml

* Update matrix.yml

* More XE test fixes: golem weight, remove plantkin_parchment from known bad uncrafts

* Nutrition info and repair info tests use their own test items

* Appease clang-tidy

* Replace nether cult cabin headless corpse with headful due to mystery test failures

* Strix talons don't need NAILS as prerequisite

* Add Xedra field office to terrain coverage test whitelist

---------

Co-authored-by: Maleclypse <54345792+Maleclypse@users.noreply.github.com>
2026-08-26 19:54:43 -05: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
thaelina 1cc10ca876 Update tests for upcoming old lab removals (#85246) 2026-02-11 16:48:39 +01:00
ehughsbaird cedd8af571 Display time with months instead of seasons
Split the 364 day year up into months as so:
The seasons are
Dec, Jan, Feb, Mar -> Winter
Mar, Apr, May, Jun -> Spring
Jun, Jul, Aug, Sep -> Summer
Sep, Oct, Nov, Dec -> Autumn

The first month of each season has 31 days, and the first day of each
season is on the 20th of the first month (the last day on the 19th of
the last month).

For season settings other than 364 days, season display is broken and I
need to consider how to implement this correctly.

Some additional logic was needed for the year transition correctly on
Dec 31 -> Jan 1, because turn_zero is the first day of Spring.

The calendar code isn't too gross, but is still gross.
2025-08-05 14:25:08 +00:00
Procyonae aa0d09aec1 Change u_profession condition (#81680)
* Change u_profession to f_has_profession, update EOCs, remove redundant context val

Remove a couple of other unused redundant context variables while I'm here

* Update /tests events
2025-07-14 14:48:06 +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
Procyonae 4fd38ca71c Deal with /tests fallout 2025-01-16 16:03:19 +00:00
b3brodie c63d4ff4f1 Merge branch 'CleverRaven:master' into xedra_time 2024-11-29 01:48:04 -08:00
Clarence "Sparr" Risher 8b27b967ae Replace point constants with static class members 2024-11-26 10:14:26 -05:00
b3brodie effcb9da05 Make reverse damage revert pain and add pain to character takes damage event 2024-11-25 18:03:30 -08:00
b3brodie 02533b23e1 Add bodypart field to character_takes_damage and use to make damage reversal eoc bodypart specific 2024-11-25 17:08:48 -08:00
Procyonae e9f4fbd110 Remove extern ter ids (#72766) 2024-04-04 07:08:37 -07:00
andrei 01c1988e8b tests/events: minimal test for runtime-defined events 2024-01-18 21:04:45 +02:00
LISPCoC 725161a038 [EoC] Some monster and map related update (#69405)
* monster eoc

* update

* test

* passable_only
2023-11-16 22:36:01 -06:00
LISPCoC 3c606a08c9 Fix GCC9 warnings "overloaded-virtual" (#68460)
* Fix GCC9 warnings "overloaded-virtual"

* kill tracker

* tests
2023-10-02 23:19:58 -05:00
Zhilkin Serg 7f91d0c939 Allow free selection of cataclysm and game start dates in new character menu (#67772)
* Added UI element to select and return time point

+ utilized it in debug menu

* Reworked scenario calendar

- removed `random` calendar entries from scenarion definitions
- allowed free selection of cataclysm and game start dates in new character menu
- updated UI in new character menu
- fixed start date related tests
- updated docs
2023-08-19 23:13:36 -07:00
cakepie 82b6ecba65 Update events to account for ability to swap avatars (debug or upon death) (#63488) 2023-03-21 18:57:09 -07:00
Binrui Dong 32774b37da Migrate from cata::optional<T> to std::optional<T> (#64333)
Co-authored-by: Kevin Granade <kevin.granade@gmail.com>
2023-03-20 20:11:23 -07:00
akrieger e97415e789 Convert everything to json_loader from JsonValue::from_* 2022-09-15 22:04:55 -07:00
akrieger 898708829f Fix test compilation 2022-09-15 22:04:54 -07:00
John Bytheway 9d4b36d4b3 Support value_constraint equals_any (#59356)
It is useful for event_transformations to be able to check for a value
which is in a given set.  Previously it could only check for one
specific value.

Allow this via a new constraint type "equals_any".

Use this to expand the "What are they hiding?" achievement to also count
the central lab finale (previously it only counted the hardcoded lab
finale).
2022-07-18 14:16: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 5ff129c26b Sort and collect string_id declarations
The static string_id collections at the start of each cpp file should
have a consistent ordering.  This is in particular to permit new ones to
be added automatically by clang-tidy checks.

We've added a check to automatically sort them all.  Apply it across the
codebase.
2021-11-11 16:02:14 -05:00
akrieger 006c10b379 Convert a bunch of trivial deserialize functions off JsonIn
Most instances of deserialize instantly convert from JsonIn to the
object oriented interface, usually JsonObject. Using the improved
interface on JsonIn we can change the signatures on these to more
accurately reflect what they're doing. Also help get rid of JsonIn
which is not supported in the binary json refactor this unblocks.
2021-09-07 18:08:48 -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 9e9d726e3f Fix struct name collision 2021-01-28 23:04:35 -05:00
haveric c380afc798 Fix spelling issues (#45878)
* JSON description spelling fixes
* Markdown + txt spelling fixes
* Fix FLAMMABLE_ASH flag for butchering rack
* Fix result spelling of southwest
* Fix cephalopod achievement id spelling
* unsually is probably unusually
* Fix spelling in dynamic line
* Simple comment/text spelling fixes
* Fix variable/enum spellings
* Fix function spelling issues
2020-12-08 16:46:14 -08:00
John Bytheway b0ce494cdc Filter out non-empty invalid field values
event_field_transformation functions shouldn't need to be written
defensively against invalid inputs.  So, pre-check the arguments and
don't call the function if an argument is invalid and non-empty.

We're already relying on them supporting empty arguments, so we can't
filter those out.  Maybe in the future those empty arguments should be
replaced by null instead.
2020-10-12 08:20:34 -04:00
John Bytheway ace80ed46e Deactivate achievements_tracker for past games
When building achievements_trackers for past_games_info, these
achievements_trackers were setting up their full-featured infrastructure
of watchers.  This serves no purpose, because no new events will occur
for these past games, and we only really want these
achievements_trackers for their info about already-completed
achievements.

Add a new options to achievements_tracker to disable these watchers and
use it in this case.
2020-10-12 07:35:06 -04:00
ZhilkinSerg c8ac2d2ef0 Removed non-utilized variables 2020-08-23 02:56:39 +03:00
Kevin Granade 3888b13fac Clear global stats tracker in tests (#43042)
* Clear global stats tracker in tests

* Clear stats tracker in memorial test too
2020-08-20 10:22:48 +03: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
Kevin Granade 346d4c19fa Make several more members private in game (#42255)
* Make scent_map private in game

* Make timed events private in game.

* Make achievements tracker private in game

* Make memoial tracker private in game

* Make scenario variable private in game
2020-07-20 10:20:58 +03:00
nexusmrsep 6e29528124 Re-colorize achievements UI (#42228) 2020-07-19 11:22:52 +03:00
Kevin Granade 2ef8971308 Make game::stats() private 2020-07-18 04:39:19 +00:00
Kevin Granade 1ea5556a41 Global reference migration part 32 (#42215) 2020-07-17 12:59:41 +03:00
Kevin Granade f95326e8ad Global reference migration part 30 (#42208) 2020-07-17 12:58:14 +03:00
John Bytheway c92d8ae73e Allow event_statistics to extract first & last
Similar to unique_value, add first_value and last_value.

Add some stats & achievements using them.

Add some unit tests.
2020-06-04 22:11:04 -04:00
John Bytheway 1bfb4a5ef6 Factor out some common test code 2020-06-04 21:51:59 -04:00
John Bytheway 7603fd1b54 Expand event counts to summaries
Previously we kept only counts of events (partitioned by field values).
Convert that int to a new class event_summary, which also contains
time_points for the oldest and newest events in each partition.
2020-06-04 21:51:59 -04:00
John Bytheway c58ba3eedd Allow overriding achievement descriptions 2020-06-03 21:27:27 -04:00
John Bytheway b4c4df56a6 Add more to game_start event
We want the game_start event to record everything relevant about the
starting character (the sorts of things people expect to see in a
memorial log).

This adds some of those things:
* Name
* Grammatical gender
* Profession
* Game version
2020-06-01 09:38:30 -04:00
anothersimulacrum 0aa6ad1090 Use move mode data, not mode checks, delete enum
Centralizing this data in move modes makes maintenance and changes
easier.

Also, it cleans up the code (see avatar::set_movement_mode).

Move mode switching restrictions could use some more nuance, instead of
just being restricted to running.

The `movement_mode_is` function may seem redundant with the `is_x`
functions, but it returns true only if the move mode is the exact
provided move mode, where the `is_running` function returns true based
on type - this means a theoretical new sprinting mode satisfies
is_running, but fails `movement_mode_is( move_mode_running )`.

The move_mode_color function in panels was odd - it returned light_gray
if the mode was walking, but in the only place it was used, it wasn't
called if the move mode was walking, and white was used instead.

The vehicle follow distance was previously just 400 times the move speed
multiplier of the move mode. Let's future proof it and make it like
that, so that we don't get caught by it in the future adding a new move
mode.
2020-05-30 15:08:31 -07:00
ZhilkinSerg d254033062 Merge pull request #40940 from jbytheway/achievement_events
Send events for achievements and conducts
2020-05-30 11:26:51 +03:00
John Bytheway cf04c0b3e9 Tests for new achievement events 2020-05-28 22:19:09 -04:00
John Bytheway 3efd7ed228 Create achievement_id alias
This has spread far enough to warrant a type alias now.
2020-05-28 21:51:19 -04:00
John Bytheway 5a1e1fd8d1 Allow requirements to be hidden
Sometimes requirements are redundant or spoilers.  Allow them to be
hidden in such cases.
2020-05-28 06:42:40 -04:00