* 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>
* 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>
* 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>
* 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)