135 Commits

Author SHA1 Message Date
Kromgart 09a75ac67d Fix item duplication from spilling (#88854)
* Fix item duplication from spilling

* IWYU again

* Appease clang-tidy, who doesn't agree with IWYU
2026-10-05 15:38:14 +02:00
Standing-Storm f56a711ab0 [Xedra Evolved] Add Dreamworker workshops to XE portal labs (#88590) 2026-09-14 10:04:42 -05:00
Matthew Richmond 16814679e2 Remove debug message capture from monster navigation test 2026-09-11 23:38:57 -04:00
Matthew Richmond 9020833ece Stabilize test state resets and highway debug logging (#88577)
* Stabilize test state resets and highway debug logging

* tests: widen melee damage tolerance

* ci: retry overmap coverage

* ci: retry shader compile
2026-09-08 15:08:34 +02:00
RenechCDDA da2aaffffd Add quick setup option to clear map 2026-06-22 15:07:51 -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
dumb-kevin 34490eb6df Fix flaky dormant monster materialization test
place_critter_around(radius=1) can offset the monster by a tile when
terrain is impassable, consuming the overmap entity. The post-walk
retry then has nothing to re-spawn. Search by type, verify proximity.
2026-03-05 05:03:20 +04:00
dumb-kevin 86edf0331c Preserve horde entities on failed placement, fix flaky monster test (#85602)
spawn_monster(tripoint_abs_sm) silently lost horde entities when
place_critter_around failed - clear_chunk wiped all data regardless
of placement success. Extract nodes before placement and re-insert
failures via horde_map::insert for retry on next load. Stable-sort
by position for deterministic order across compilers.

Refactor monsters_appear_on_map_as_expected: reduce from 16 to 8
walk variations, add clear_creatures between iterations to prevent
state coupling, add materialization retry after terrain wipe, remove
unused monster_location captures, split dormant sub-test into its
own TEST_CASE.

Add failed_horde_placement_preserves_entity regression test covering
both lightweight (impassable terrain) and heavyweight (occupied tile)
failure modes.

Co-authored-by: dumb-kevin <dumb-kevin@users.noreply.github.com>
2026-03-03 20:17:48 -08:00
Alex Mooney 0e6874aa32 Place player so limit_mod_size_bonus can pass 2026-02-18 20:59:25 -08: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
Kevin Granade a0a6c84a20 Fix random failure in dormant horde test 2025-10-08 16:44:47 -07:00
Kevin Granade a7e6445b00 Rerange some hordes tests to avoid expensive overmap wipes 2025-09-27 15:30:06 -07:00
Kevin Granade cfdff845e7 Overhaul sound delivery to hordes to allow filtering out distant hordes cheaply. 2025-09-27 15:30:06 -07:00
Kevin Granade e6e1988213 Bulk fixup for IWYU 2025-09-27 15:30:06 -07:00
Kevin Granade 8084cd6a2e Add test for dormant zombie interaction with hordes 2025-09-27 15:30:06 -07:00
Kevin Granade 08282bf997 Extract horde data structures to a dedicated class that partitions monsters by behavior.
i.e. active monsters go to a seperate container that is the only thing referenced by move_hordes()
2025-09-27 15:30:06 -07:00
Kevin Granade 2da6b6461e Add test for persisting player-made changes to map in overmap data
Also fix an index scaling bug that was breaking it
2025-09-27 15:30:06 -07:00
Kevin Granade 7518e8e335 Add horde_entity wrapper that allows never-spawned monsters to have tiny entries instead of an entire monster object. 2025-09-27 15:30:06 -07:00
Kevin Granade 04a835f3e3 Add test for triggering horde spawning with player movement 2025-09-27 15:30:06 -07:00
Kevin Granade 4a329faa7a Move omt map sumary to own file, add placeholder store 2025-09-27 15:30:05 -07:00
Kevin Granade bc3b47079a Add tests for monsters ability to navigate across the reality bubble and passing from the overmap to the reality bubble. 2025-09-27 15:30:05 -07:00
marilynias 11c27266d9 Allow monsters to have different climb/swim/dig speeds (#80849)
* mon moveskill

* fix json inheritance,
calc_climb_cost use mod

* fully implement calc::movecost
define max_obstacle_penalty

* diggable adjustment, add fieldcost to some skipping things

* iwyu, better lambda

* fix unessecary if

* docstring

* aquatic monsters cant swim throuh vehicles
IWYU

* Aquatic monsters swim unter boats

* no longer need climb checks
Add forced movement to calc
non climbers cannot climb ladders (TFLAG_DIFFICULT_Z)

* revert debug val

* tests (not working)

* fences are terrain
other tests

* doc

* obsolete ignore_furn

* missed one

* nicer md

* IWYU

* add missing NOBREATH test, clang+IWUY

* more clang

* some small formatting/comment changes

* clang
2025-05-13 23:42:43 -05:00
PatrikLundell 0448b8953f Mapified pos_bub, posx, and posy in the talker class hierarchy (#79753)
* parking

* mapified pos_bub, posx, and posy in the talker hierarchy

* demanded changes

* demanded changes

* demanded changes

* fixed bugs

* implement virtual operation, make pos_x, pos_y absolute

* implement virtual operation, make pos_x, pos_y absolute
2025-02-24 07:54:55 +01: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 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
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
PatrikLundell f14346c5db Rename map:: get_global->get_abs, bub_from_abs->get_bub, omt_from_abs->get_omt (#79167)
* Renamed map:: getglobal->get_abs, bub_from_abs->get_bub, omt_from_abs->get_omt

* astyle
2025-01-16 09:15:04 +01:00
moxian 077af7f886 Remove ghc/filesystem polyfill now that we are on C++17 (#79092)
* Remove ghc/filesystem shim now that we are on C++17

* fixies

* astyle

* teach clang-tidy about <filesystem>
2025-01-13 09:17:22 +01:00
PatrikLundell befd4486d1 sundry typification (#78985)
* sundry typification

* demanded work around
2025-01-06 22:26:26 -06:00
PatrikLundell c380147ab2 typified creature.h and monster.h (#78565)
* typified creature.h and monster.h

* Update src/monmove.cpp

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

* Update src/monster.h

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-12-16 22:16:00 -06:00
Andrew Krieger 67c1ad039a Categorically fix type issues with restore_on_out_of_scope 2024-12-09 21:51:35 -08:00
Clarence "Sparr" Risher 8b27b967ae Replace point constants with static class members 2024-11-26 10:14:26 -05:00
Anton Simakov 2e77ec17ce Make reproduction CI test (#76294)
Co-authored-by: Anton Burmistrov <Night_Pryanik@mail.ru>
2024-11-15 13:45:09 +03:00
PatrikLundell 5648f805dc typified a bit of map.cpp + dependents 2024-10-12 13:12:23 +02: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
Fris0uman 5fa102a572 Enforce mon_ prefix for monster id (#72734)
* Test for mon_ prefix

* Replace LIXA_ with mon_

* deal with pseudo monsters

* Check for prefix in vanilla monster during data load

* better cpp

* fix hardcoded ids

---------

Co-authored-by: Fris0uman <fris0uman@users.noreply.github.com>
2024-04-09 18:33:44 -04:00
RenechCDDA b0882ee2eb Update tests for protected moves variable 2024-03-09 16:33:12 -05:00
prharvey a3f5d31341 Replace all global mon_flag_str_id with mon_flag_id located in mtype.h. Initialize them on game load. 2024-01-01 11:31:20 -07:00
David Seguin 12e198612d Jsonify monster flags (#66722)
* jsonify monster flags: code and flag conversion

* jsonify monster flags: docs and lang parser

* jsonify monster flags: optimizations

* jsonify monster flags: remove expensive debug stats tracker for mflags
2023-07-10 13:54:00 -03:00
Jianxiang Wang (王健翔) 719e63678e Add clang-tidy check to enforce use of fs::u8path and fix path encoding error (#65223)
* Add clang-tidy check to ensure fs::u8path is used to construct path from utf-8 string

* Fix fs::u8path and nullptr warnings

* Print error instead of showing a popup in test mode in write_to_file

* Remove cata::fstream wrappers
2023-05-17 08:52:46 -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
akrieger 3b22d13aa9 Move scope helpers to cata_scope_helpers.h 2022-09-15 22:04:51 -07:00
John Bytheway 53a6cd9050 Apply auto transformations
Use the new clang-tidy check to replace all the auto variable types with
explicit types (where it makes sense to do so).
2022-07-01 07:11:27 -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
Binrui Dong 16504d5bcb Fix compile error on LLVM/Clang 13 2021-10-21 17:22:05 +08:00
eltank e396c41283 Migrate more monster fields to absolute coords
Change to tripoint_abs_ms:
- goal [was map-relative]
- wander_pos [was map-relative]
- patrol_route [was absolute but not typed]
Remove serialization for path.
Invalidate path on map shift.
Made goal optional, unset when reached.
Rename goal-related functions for consistency/readability.
2021-09-06 00:00:41 -07:00
Zhilkin Serg adb641d204 Merge pull request #51263 from Qrox/encoding
Fix Windows path encoding
2021-09-03 08:35:52 +03:00
actual-nh 9e8f22dafd Limit zombie_fuse, other size change to within tiny-huge (#51295)
* Help limit zombie_fuse size change

This prevents increases in the level of the grown_of_fuse effect if
the monster is already at huge. Some further work is needed, namely to
ensure get_size never returns anything outside of the tiny-huge range;
this could happen if the engulfed monster was so big as to pop by 2
size categories. Alternatives include limiting mod_size_bonus or,
for this particular case, an alternate grown_of_fuse effect with
either less size increase or lower maximum intensity, such that -
with a given type base size - it won't put it over huge.

* Attempting to use volume to help limit zombie_fuse

@Venera3 requested going off of volume for (most of?) zombie_fuse. This
should limit to the minimum of by max_hp and by volume * (80 / 62500 ml),
which work out to the same value for a standard zombie.

* Get units to work right for volume limit

Rearrange to mathematically equivalent formula to get units system to
work right.

* Adjust grown_of_fuse for max +2 size

The effect grown_of_fuse now increases size by a maximum of 2. In order
to minimize uncertainty about effects due to roundoff, all effects are
now proportional to changes of 50, not 48.

* Clamp mod_size_bonus to within enum limits

This should prevent any input to mod_size_bonus from causing it to
go outside of the enum limits. I wound up doing this in a slightly odd
fashion, since Creature::get_size() is virtual only (the Creature
structure does not itself include a size, AFAICT); instead of getting
a base size and preventing size_bonus from pushing it beyond tiny/huge,
I limited the adjustment to size_bonus so that it wouldn't push the
current result of get_size() beyond the limits.

* Hopefully satisfy JSON formatter test

* Fix accidental min/max reversal

* Try adding a test of mod_size_bonus

Adding a test to make sure mod_size_bonus will set the size correctly.
May be extended with a few more monsters of various sizes if desired.

Co-authored-by: actual-nh <actual-nh@users.noreply.github.com>
2021-09-02 12:41:57 -07:00
Qrox fcf75c69be Handle path encoding correctly on Windows 2021-09-02 23:22:34 +08:00