110 Commits

Author SHA1 Message Date
Tektolnes 3015a27a34 Partial dodge and limb shielding/deflection (#89470)
Co-authored-by: Maya Granade <kevin.granade@gmail.com>
Co-authored-by: Thelis Stambolliu <110344314+FarFarLakeSea@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-17 21:10:30 +01:00
RenechCDDA da2aaffffd Add quick setup option to clear map 2026-06-22 15:07:51 -04:00
dumb-kevin 9172f5f49d Fix snow depth: uniform accumulation, z-normalization, debug overlay
- Update all tracked OMTs per tick, not just the player's
- Seed new OMTs from nearest neighbor instead of starting at 0
- Normalize z to 0 everywhere (lookup, storage, save/load)
- Handle old saves with "z" field gracefully
- Add snow_depth_desc widget to default sidebar layout
- Add debug overlay for snow depth (Info -> key 'W')
- Add tests for multi-OMT accumulation, seeding, z-normalization
2026-03-13 23:43:38 +04:00
dumb-kevin cf923a1e65 Walk upward through z-levels in is_roofed, fix underground assumption
is_roofed checks all z-levels above instead of just z+1. Removes the
z < 0 always-roofed shortcut. NO_FLOOR_WATER blocks precipitation.
Weather wetting drops is_creature_outside (walls don't block rain).
2026-03-09 23:42:18 +04:00
thaelina ecb7ed024c Tests
Removed x_max x_cur x_bonus accesses outside of setters and getters in the character namespace
2026-03-02 03:17:11 -06:00
Alex Mooney 5901cbdba6 Merge pull request #85195 from AlexMooney/better_sundial
Improve the sundial to show illumination, weather, and moon phase
2026-02-12 11:19:56 -06:00
thaelina 1cc10ca876 Update tests for upcoming old lab removals (#85246) 2026-02-11 16:48:39 +01:00
Andrew Krieger 0215b26cce Rewrite all tests to clear map without touching character map memory, for performance. 2026-02-08 23:05:55 -08: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
moxian 8b6cbac614 Stop including catch.hpp directly
.. as suggested by the comment in cata_catch.h:

// To avoid ODR violations, it's important that whenever a file includes
// catch.hpp it also includes stringmaker.h, so that all specializations of
// StringMaker match.  Therefore, all test code should include catch.hpp via
// this file.

Honestly, i'm not exactly sure how valuable this is, given that we've
been running with the current odr-violating(?) setup for a while nand
not had many issues, but sure, why not.
2025-02-16 19:45:21 -08:00
moxian c44d65a8ae Run IWYU again to pick up the changes 2025-02-11 13:02:19 -08:00
moxian 2965c089f4 fix build (lots of changes, but not too bad)
.. and ensure iwyu is still happy with this
(i.e. it's not suggesting i change anything else)

Code size:
includes:
$ cat obj/tiles/*.inc | wc
 278246  556492 17375633
$ cat tests/obj/tiles/*.inc | wc
 163748  327496 10306945

post-processed source (clang -E):
./make_preproc.sh src/
65903052 170378728 2049783276
./make_preproc.sh tests/
38434368 100326839 1215848465
2025-02-10 01:10:38 -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
PatrikLundell 537d9d12a1 Standardized get/set pos operations for talker/creature class hierarchy (#79206)
* Standardized get/set pos operations for talker/creature class hierarchy

* sort out merge failure
2025-01-20 08:20:58 +01: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
phi2dao 4c760fcaf8 Add widget_custom_var tests 2024-11-20 15:54:48 -05:00
PatrikLundell ef6b53acfb typified a little bit of map.h + dependents (#76340)
* typified a little bit of map.h + dependents
2024-09-27 15:10:36 -07: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
alef 9127804da1 WIN32 does not implies TILES anymore 2024-06-19 23:09:29 +02:00
Procyonae 47eb971c97 Forgot /tests 2024-05-31 21:48:49 +01: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
Anton Simakov 71ed5cde9c Port some mutation/cbm specific fields to enchantments, part 3 (#72173)
* remove weakness_to_water, add WEAKNESS_TO_WATER as replacement, fix it not working with negative values

* remove fat_to_max_hp, make FAT_TO_MAX_HP as replacement

* remove healthy_rate, create HEALTHY_RATE as a replacement

* remove scent_mask, adds SCENT_MASK to replace it

* remove consume_time_modifier, make CONSUME_TIME_MOD as replacement

* remove reading_speed_multiplier

* remove overmap_sight and overmap_multiplier

* remove sweat_multiplier, add SWEAT_MULTIPLIER as replacement

* remove vomit_multiplier

* remove stamina_regen_modifier, make STAMINA_REGEN_MOD as replacement

* remove fatigue_regen_modifier, make FATIGUE_REGEN as replacement

* remove fatigue_modifier

* remove noise_modifier

* remove crafting_speed_multiplier

* remove casting_time_multiplier

* remove bionic_mana_penalty

* remove mana_regen_multiplier

* remove mana_multiplier

* remove mana_modifier

* refine water damage to allow float values, make it tick once per second instead of once per minute

* lintin and fixin

* Astyle

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

* clang tidy

* Astyle

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

* more

* more

* data types are hard

* ill squash it in the future, believe me

* Astyle

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

* refine crafting speed calculations

* update tests

* Update tests/mutation_test.cpp

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

* add identifier to enchantment

* int to double?

* refine mutation OM vision test to check actual OM vision

* Update src/character.cpp

Co-authored-by: mqrause <38702195+mqrause@users.noreply.github.com>

* the last bist of sight test

* final test tweaks

* fix widget test mismatch

* add escape character to fix test

* fix two nocturnal trait

* fix multiple errors

* make new overmap sight test use test mutations, that work all the time (eagleeyed doesn't work at night)

* fix field duplication

* more fixes after merge

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: mqrause <38702195+mqrause@users.noreply.github.com>
2024-03-09 17:39:06 -06:00
Binrui Dong f917d9553d Corrected argument order in widget::text() call 2023-11-10 19:12:28 +08:00
Paul Harvey 31013881af Body heat temperature refactor to standard units. (#68796)
* Replace the arbitrary body tempurature ints with units::temperature. This does not affect save files or JSON in order to be forwards/backwards compatible, and non-debug displays also use the old format.

* Fix the BMI heat bonus.

* Fix one constant, and remove some uses of auto/default constructor that I missed.

* Replace a C-style cast with a static_cast.

* Refactor the convergence code to be easier to understand, and remove another use of auto I had missed.

* Remove yet more uses of auto. Maybe I have a problem.

* Change ambient temperature calculation be to be closer to the original. Only do the bugged scaling on the delta, not the original ambient temperature.
2023-10-25 21:16:11 -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
andrei 37ed546f5e tests: fix locale-dependent tests (#66065) 2023-06-13 12:28:16 -07:00
John Bytheway 961a10146e Enable clang-tidy check modernize-use-emplace (#65844)
We had this enabled before but it's expanded in the update to LLVM 16,
so this is a bunch more changes.

Mostly these are removing unnecessary temporary objects created for
emplace calls.
2023-05-26 22:48:04 -04:00
John Bytheway ba794fe260 Enable clang-tidy check cert-err33-c
This check looks for unused return values on a variety of C library
functions.

I resolved most of the warnings by printing out some kind of error
message in the event that the function failed.

Many of them are low-level things whose failure indicates some sort of
serious problem, so the errors are simply printed to stderr, because our
usual error reporting infrastructure might not be available.
2023-05-24 07:13:18 -04:00
John Bytheway 89171fb202 Convert lots more things to string_view
These are mostly automated changes.  My automation tries to be
conservative, but I did have to do manual fixup of a few things.

I plan to PR the clang-tidy check that automates these changes later,
but I think more changes may be needed before that.

Some of the manual changes:
- Added svto<T> where T is an integer type, which parses integers in
  string_views.  This is our first use of the low-level C++17 int
  conversion functions.
- Added a shortcut to lcmatch for empty queries, to allow for
  refactoring overmapbuffer searches.
- Fixed an apparent bug in overmapbuffer::get_notes and get_extras,
  where it was inverting the match result.  As far as I can tell, these
  functions aren't actually used anywhere, so I guess this bug wasn't
  breaking anything.
- Allow use of string_view in JSON serialization.  Previously these were
  misidentified as sequences and appeared as a list of integers rather
  than a string.
2023-04-20 19:57:23 -04:00
Kevin Granade daef9ea4e9 Merge pull request #64622 from irwiss/remove-reinforcement
Remove reinforcement / accurizing, clean up item damage
2023-04-05 18:52:10 -07:00
Clarence "Sparr" Risher f93cbc35a6 Refactor city.cpp/.h out of overmap.cpp/.h 2023-03-31 18:47:42 -04:00
Alexey Kim ae1c1e6296 Damage symbols/colors/levels/etc now have 5 stages 2023-03-28 05:18:29 +03: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
Eric d245bb6427 Remove acid rain (#64310) 2023-03-16 19:11:09 -07:00
anoobindisguise 1866f166ba Fix BMI system and add penalties for obesity (#60597)
Co-authored-by: anothersimulacrum <anothersimulacrum@gmail.com>
2023-03-11 19:18:44 -08:00
Alexey Kim eac7715753 Rename and template join -> string_join 2023-03-08 01:37:30 +02:00
David Seguin 365ee3e6f6 tests: update radiation widget test 2023-02-03 02:43:41 -05:00
Zhilkin Serg e44f38af40 Remove excessive empty lines 2022-12-06 10:42:15 +03:00
David Seguin 9864fd50ba Don't run screen scraping tests on curses builds 2022-08-06 14:16:45 -04:00
mlange-42 283632c835 fix/adapt remaining left-align tests, as space is filled now also for multiline widgets 2022-07-29 22:52:48 +02:00
mlange-42 fbfc9f07f3 fix tests for right-aligned by converting back to old expected string 2022-07-29 15:16:50 +02:00
mlange-42 d2e3a56660 fix tests for now padded/filled multiline widgets and label padding 2022-07-29 11:38:03 +02:00
mlange-42 092884db96 force recursion in tests, remove unnecessary condition 2022-07-29 10:39:55 +02:00
mlange-42 4e14fdcbdf fix tests to respect removed additional newline at end of multiline widgets 2022-07-25 11:59:33 +02:00
John Bytheway 875cadf142 Enable performance-unnecessary-value-param (#59533)
This clang-tidy check looks for potentially-expensive-to-copy value
parameters which are only used as const values.

If they are only used once, in an assignment or initialization, then
their use will be converted to std::move.  This can save a copy in some
cases.

Otherwise, the parameter will be converted to a const reference, which
can also save a copy in some cases.
2022-07-23 19:29:45 -04:00
David Seguin 05260b6d63 Widgets: sundial unit tests 2022-07-05 20:39:40 -04:00
Inglonias 8ffa56bb0c Fix the compact sidebar regressions and document the string field for widgets (#58714)
* I MISSED THE COMPACT SIDEBAR AAAAA

* More work. Added a spacer that crashes the game. Investigating the crash.

* Fixed the crashes with an undocumented flag

* I _said_ JSON tested and linted!

* Text widget string field documented and fixed

* Fixed the compile issue. Remove affected arguments

* Fixed last-resort condition and sidebar issue.

* Astyled widget.cpp

* Clarified docs

* more clarity
2022-06-28 09:35:52 +03:00