* Remove STATIC macro a-f
Fixes a typo in character_armor where a damage type was somehow being implicitly cast to a bool?
* Remove STATIC macro g-i
Trusts a post 0.H todo comment to do with cables, the PR was huge so I'm just hoping this got migrated properly
* Remove STATIC macro j-z
* Remove make_static.h includes
* Cleanup
* Remove STATIC macro /tests
* Remove comments yesterday me left for today me
* Update clang for STATIC macro removal
* Cleanup round 2
* Cleanup round 2
The A-Z before a-z thing gets me every time >-<
* Add tests to ensure calorie density <= 9kcal/g
* IWYU
* Update known_bad_calorie_density.json
* add missing mod items to known_bad_calorie
* fix calories of blood_tainted in magiclysm
* Add comestible subtype to blood_tainted
---------
Co-authored-by: Anton Simakov <67688115+GuardianDll@users.noreply.github.com>
* Privatize nutrients::vitamins
In preparation for changing how vitamins are represented/stored under
the hood, privatize the structure storing vitamins and update the code
to interface with it correctly.
The new members added to the struct are the functions
set_vitamin(), add_vitamin(), remove_vitamin() and vitamins()
The other change is to move the vitamins variable to a private variable
vitamins_
Astyle reformatted the struct with the addition of the visibility
* Allow specifying vitamins in items by weight/mass
Often, nutrition info will list vitamins by weight. Additionally, RDA,
being defined by humans, is subject to change. For these reasons, it
should be possible to specify vitamins by weight in item definitions.
To do this, vitamins need to know how weight corresponds to units, and
items need to load in weight as well as units, and convert to units as
necessary. Unfortunately, as items may be loaded before vitamins, both
the loaded weight values and units values must be stored until all data
is loaded and they can be converted to units. To facilitate this, turn
the vitamins data stored in nutrients into a map from vitamin id to a
union of int and units::mass. This can then be finalized after loading
to convert all units::mass values to units.
Some nutrients functions modified to safely handle the union type.
LIMITATIONS:
There's a lot of rounding that the whole vitamins system is subject to.
This adds some more rounding: Any fractional vitamins due to weight are
discarded. However, this is the same as the previous approach, but
happens at load time instead of when the content is being added.
Additionally, vitamins (like iron) that have an RDA of less than 1mg
cannot really benefit from this system.
Demonstrate this by adding appropriate weights to nutrition vitamins
(barring iron) and modifying some items to specify their vitamins by
weight (both normally and through relative).
* 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)
* Mutation system refinements, take two: squashed edition
created with copious amounts of agony and ice cream
* proofreading, resolve test failure
* I realy should try magiclysm one of these days
* on second thought, no popups for now
* the github test run took TWO HOURS. AAAAH
* [wailing]
About 900 comestibles have, for whatever reason, all the mutagen
vitamins defined in their default nutrition, just with an amount of 0.
Because the test only checks if they have a mutagen vitamin defined,
instead of have any amount of it, it incorrectly flags these as mutagens
and doesn't check them.
Fix the check, and fix the item that was now causing it to fail.
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.
Using 2 sparrow eggs, while it increased the recipe average, still
did not get it within 2 standard deviations of the item's calories,
probably because the standard deviation is only 96 - probably brought
down by multiple identical-calorie other eggs in other permutations.
Adjusting the "backup" for the standard deviation-based check to
use 0.75-1.25 still catches 54 being too low, but allows it with
using 2 sparrow's eggs. (I have some suspicion the original calories
are from a commercial item, which when not deliberately otherwise
tend to be rather caloric to increase customer liking (sugar and fat).
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.
* Change _ctype.h and __locale to cctype and clocale
* Change _wctype.h to cwctype in game.cpp
* Change __functional_base to functional
* Remove libcxx internal headers
* Remove UNIX system headers
* Fix clang-tidy error with -nostdinc++
calorie precision is only used internally, all external methods should
be dealing with kcal.
Having calorie precision just enables removing rng-based rounding from
metabolism functions, without losing detail.
There was a very minor change in the Calories of some crafted items, as
is caught in the tests.
* Make Character::stat into a standalone enum class
Enables forward declaration
* Remove player centric overload and unecessary include
* Remove player.h dependency from trap.cpp
* Add singleton-like accessors for avatar, map, weather and event_bus
* use accessors to remove includes of game.h
itype_id is (presumably) one of the oldest type ids in the game. In
particular, it predates string_id, and was simply a typedef of
std::string.
This is bad for type safety.
Make it be a string_id specialization instead, and update the rest of
the code accordingly.