27 Commits

Author SHA1 Message Date
Standing-Storm 1f4e4a7e4d Cephalopod Leg Tentacles to limbs (#87018) 2026-06-05 21:17:29 +02: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
RenechCDDA e09f1e8231 Prevent characters from lowering movecost below 1 (#80327) 2025-03-27 20:39:48 +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
Brambor d99c6a8924 remove avatar_action::move overload 2024-11-27 00:41:14 +01:00
Clarence "Sparr" Risher 8b27b967ae Replace point constants with static class members 2024-11-26 10:14:26 -05:00
PatrikLundell a975e4d461 typified end of 'a' 2024-11-23 14:29:10 +01:00
PatrikLundell 456a199f5c typified a bit of map.cpp and dependents 2024-10-08 16:23:15 +02:00
Anton Simakov 6839cacc44 remove padded feet speed bonus, port SLOWS_MOVEMENT flag effect to json (#73320)
* remove padded feet speed bonus

* remove SLOWS_MOVEMENT flag
2024-04-29 22:57:20 -05:00
Procyonae e9f4fbd110 Remove extern ter ids (#72766) 2024-04-04 07:08:37 -07:00
Kevin Granade b1857d6813 Merge pull request #72258 from RenechCDDA/magic_BAD
Make creature's "moves" a protected variable
2024-03-20 09:45:18 -07:00
Anton Simakov d47777ddd6 Enchantments forever (#72328)
* remove thirst_modifier (not used anywhere)

* remove scent_modifier (not used anywhere, use SCENT_MASK ench)

* remove mending_modifier

* remove healing_multiplier

* remove healing_awake, add REGEN_HP_AWAKE as replacement

* refine noise enchantments: remove SHOUT_NOISE_BASE, replace it effect with SHOUT_NOISE

* remove skill_rust_multiplier, update SKILL_RUST_RESIST so multiply value replicates the effect of it

* add climate_control_str to port temperature_speed_modifier to math

Co-authored-by: andrei <68240139+andrei8l@users.noreply.github.com>

* jmathify temperature_speed_modifier, remove it from the code, remove infrastructure for mutation that is not used anymore

* remove test `dummy.mutation_value` that i forgot to remove with removing healing_awake

* clean up mutation.md

* few fixes of climate_control_str

* remove bodytemp_sleep, make BODYTEMP_SLEEP as replacement.
TODO: verify should i convert legacy int unit to temperature unit in json

* astyle

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

* Lint

* confirmed BODYTEMP_SLEEP need to be divided 500 to have the same value

* fix rust resist multiplier, tweak poor healer to satisfy test

* Update src/magic_enchantment.h

Co-authored-by: Curtis Merrill <curtis.r.merrill@gmail.com>

* remove power_trickle, add POWER_TRICKLE as replacement

* remove stat_bonus

* remove vitamin_absorb_mod

* refine docs

* clang tidy suggests

---------

Co-authored-by: andrei <68240139+andrei8l@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Curtis Merrill <curtis.r.merrill@gmail.com>
2024-03-17 16:06:35 -05:00
RenechCDDA c2c814edff Merge branch 'master' into magic_BAD 2024-03-10 11:08:36 -04: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
RenechCDDA b0882ee2eb Update tests for protected moves variable 2024-03-09 16:33:12 -05:00
Anton Simakov 2ae2e7af19 Apply suggestions from code review
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-02-28 17:39:05 +01:00
Anton Simakov 8c4a56d85d remove movecost_obstacle_modifier 2024-02-28 10:31:15 +01:00
Anton Simakov 6d127c8dde remove movecost_flatground_modifier 2024-02-28 10:27:39 +01:00
GuardianDll 9b039cc6e3 remove movecost_modifier 2024-02-27 23:30:40 +01:00
Kamayana 6a46c5a421 Cache results of item search functions (#67835)
* Cache results of `has_item_with_flag` and `all_items_with_flag`

Adds new functions `add_to_flagged_item_cache` and `remove_from_flagged_item_cache`, as well as new overloads in `visitable` to accomplish this

* Replace some `items_with` with `all_items_with_flag`

* Add special handling for the unique LIGHT flag

* Handle flagged item cache in `item::convert`

* Add note to flag_LIGHT that it's not a real flag

* Open the cache up to expansion beyond just `flag_id`s

* Rename "cache" to "caches"

* Add function `all_items_with` for inventory searches. Replaces `all_items_with_flag`.

There are three overloads for this function. One searches for an item flag, as `all_items_with_flag` did. One searches for all items that pass a specified boolean function. The last one does both. All three add the results to the cache.

* Fix cache handling for item contents

* Embed cache clearing into more item removal functions

Replaces `Character.worn.clear()` with `Character.clear_worn()`. `Character` is now a friend of `outfit` to accomplish this

* Use inv search cache for seeds

* Use inv search cache for cash cards

* Use inv search cache for npc food

* Update some implementations of `all_items_with`

* Use inv search cache for relic processing

* Change cache names to use the function name for simplicity

* Use `all_items_with` for relics in `recalculate_enchantment_cache`

* Include `set` in iexamine

* Use `on_item_acquire` in `convert`

* Handle `i_add` with charged items directly in the function itself

This lets us always assume that calls to the `try_add` overload with copies should, in fact, be doing so

* Adjust `try_add` copies to add all added items to the cache

It used to only add the first item. There's a CPU impact of this change when spawning huge amounts of items, but it's very slight

* Use `has_item_with_flag` instead of `all_items_with` in `link_up_actor`

* Use `all_items_with` for bionic cable functions

* Make `get_cable_vehicle` const

* Make `all_items_with` key use a const reference

* Add `clear_inv` for clearing Character's inventory and cache

* astyle invlet test

* Revert "Add `clear_inv` for clearing Character's inventory and cache"

This reverts commit 944d768dd1.

* Make cache use vectors of items instead of sets

* Deduplicate code in `all_items_with` overloads

Co-authored-by: andrei <68240139+andrei8l@users.noreply.github.com>

* Fix iteration in `remove_from_inv_search_caches`

Temporary measure while I rethink how the cache works. Co-authored-by: andrei <68240139+andrei8l@users.noreply.github.com>

* Greatly rework the item search cache and all its functions

The cache now uses safe references rather than direct item pointers. `all_items_with` replaced with `do_on_items_with`, a function that iterates through the cache, applying a given function to the items and removing invalid item pointers as it goes. There's also an overload that gives the function a boolean `abort` parameter that, if ever set to true, exits the loop immediately and returns true. Also adds `get_items_with` for creating a vector of all the cached item pointers.

* Remove `remove_from_inv_search_caches`

Also reverts changes that were made earlier to accomodate manual cache removal

* Replace `has_item_with_flag` with `has_any_item_with`

I went with a unique function name rather than overloading `read_only_visitable::has_item_with` since visitable can't use the caches, so they're worth differentiating

* Consolidate `do_to_items_with_until` and `has_any_item_with`

They basically did the same thing

* Leftover debug line

* Add `do_and_check_func` to `get_items_with`. Adds const versions

* Rename `get_items_with` to `all_items_with`

* Make `has_any_item_with` use const item references.

The const_cast added to radiocontrol is temporary

* Fix returns

* Fix radio control handling

Specifically, fixes the game letting you activate an RC with a bomb in your inventory (it doesn't activate but it also doesn't warn you). Adds a const version of the item pocket chain's `get_item_with`s to accomplish this

* Add additional overload to inv search functions that looks for an item type id

* Only cache flags of the item's type, not the item specifically.

We should only use const flags for caches, not ones that can be set/unset

* Add `can_link_up` for optimizing cable finding

* Implement inv search cache functions

* Temporary fix for item tests

I need to think about how to handle non-type flags

* Change all the item search function names to specifically mention the cache

I grew to dislike the "almost but not quite the same as visitable" names I've been using. These names are clearer

* Make separate const versions of `cache_visit_items_with`

It's better design to do this; `inv_search_caches` being mutable was causing ambiguity

* Bring back `has_item_with_flag`

Now that `cache_visit_items_with` only accepts item type flags, the original functionality to check for non-type flags like WET has been lost. This brings that back.

* Unused lambda captures

* Reference the references

---------

Co-authored-by: andrei <68240139+andrei8l@users.noreply.github.com>
2023-09-04 23:47:42 -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
John Bytheway d2a6394fbd Clear map in move cost tests
This test would fail when run in isolation, because an uncleared map
could affect move costs.  So clear it.
2022-07-01 19:04:16 -04:00
Anton Burmistrov eaa4bb81ee Updated tests 2022-06-18 11:45:09 +04:00
David Seguin 55f9cfcca9 Crawling: Unit tests 2022-01-12 12:31:44 -05:00
Eric Pierce ab015d92e5 Add move_cost tests for footwear and mutations 2022-01-06 15:11:11 -07:00