36 Commits

Author SHA1 Message Date
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
PatrikLundell dfb22cab75 resolved merge conflicts 2024-11-26 23:30:46 +01:00
Clarence "Sparr" Risher 8b27b967ae Replace point constants with static class members 2024-11-26 10:14:26 -05:00
PatrikLundell 580e60acc3 typified item.h + cpp 2024-11-25 14:44:12 +01: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
Hirmuolio e547ae781f Make environment temperature to use units::temperature (#58852)
* update get_temperature

* update print_temperature

* tests

* get_local_windchill

* tests run

* make tests pass

* astyle

* cleanup

* weather_generator temperature

* astyle

* cleanup

* get_heat_radiation

* get_convection_temperature

* map temperature mod

* astyle

* weather.temperature

* avoid integer division

* clean get_local_windchill

* unused converts

* get_water_temperature

* unused converts

* windchill tests

* delta F corrected

* wrong unit

* astyle

* dTand wetness morale

* misc cleanup

* astyle

Co-authored-by: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
2022-08-17 12:43:54 +02:00
Hirmuolio aaacceb23c Handle item temperature as float (#58172) 2022-06-24 07:30:16 -07:00
andrei 9f83344f73 map/item: process items on loaded map (#57666) 2022-05-17 19:16:45 -04:00
John Bytheway ebd549b300 Fix StringMaker ODR violations in tests
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.
2021-07-03 07:42:06 -07:00
ZhilkinSerg 2fea3fef3f Remove excessive empty lines 2021-02-06 21:17:24 +03:00
Binrui Dong 9fdb7ef59c Run IWYU
* 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++
2021-02-06 00:18:41 -05:00
Hirmuolio 909b6646cf Tighten temperature tests (#46979) 2021-01-25 19:27:35 +03:00
John Bytheway b285a13080 Make time_point( int ) constructor explicit
Resolves a TODO on that constructor, and one more TODO elsewhere due to
the resulting refactoring.

time_point was implicitly convertible from int.  This led to unclear
code.  In particular, the item constructor took a time_point and a
quantity, and these two ints appeared adjacent with no obvious way to
see what they meant at call sites.

Make the constructor explicit, so the conversion is no longer implicit.
Update the rest of the code accordingly.

In most cases switched from 0 to calendar::turn_zero, which is
equivalent.  In a couple of places, used start_of_cataclysm instead,
when it seemed more appropriate (such as birthday of toilet water).
It's possible there are more cases which should have been something
other than turn_zero.
2020-11-10 11:21:02 -08:00
Aivean c32a629ceb replace all item flag constants with static string_ids
remove adapter has_flag (and related) methods that took string argument
change all remaining method signatures where item flags were passed as strings
2020-10-18 19:56:40 -07:00
Aivean e66387a377 refactor direct access to item::item_tags and itype::item_tags to accessor and mutator methods 2020-10-07 18:48:30 -07:00
Kevin Granade c5ccf0c2c7 IWYU for tests (#42806) 2020-08-09 09:46:57 +03:00
Kevin Granade 6d1841ac67 Precompiled Catch2 header (#42453)
* Hoist catch.hpp include to the top of files

* Precompile the catch header in tests
2020-07-29 01:28:26 +03:00
Hirmuolio 11b1759306 Combine last_rot_check into last_temp_check (#42100) 2020-07-16 06:03:12 +00:00
Kevin Granade 438774d386 Global getters (#41347)
* 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
2020-06-16 16:48:45 +03:00
ZhilkinSerg 58af346dcb Make temperature_flag a class enum 2020-05-26 19:23:46 +03:00
KorGgenT 09ee4e1b90 nested containers code 2020-05-02 16:02:49 -04:00
Hirmuolio 4ac15ac7ea Rot away items inside reality bubble (#39822) 2020-04-26 01:46:34 +00:00
klorpa 9a78ab5c7c Grammar/Spelling (#38006) 2020-02-22 11:11:23 +03:00
ZhilkinSerg e1f432d11f Code style (2020-01-13) (#37021)
* Appease clang
* Remove excessive empty lines
* Remove excessive whitespaces before semicolons
* Remove excessive empty lines (tests)
* Remove excessive whitespaces before semicolons (tests)
2020-01-14 01:31:43 +00:00
John Bytheway 095bd51974 Use C++-style includes
Convert all C library includes to their C++ equivalents (stdio.h ->
cstdio, etc.).
2019-12-24 17:04:16 -05:00
John Bytheway 7bda6884c3 Custom clang-tidy check to suggest use of named point constants (#33200)
* Initial version of UseNamedPointConstantsCheck

This is intended to convert hand-rolled point constants like
point( 0, 0 ) into point_zero.

* Apply refactoring pass

* Manual fixup of refactored code

Add various manual tweaks to the automatically refactored code where I
think it makes sense.

* Remove some unnecessary initializations
2019-08-13 23:04:51 +03:00
Mitch 72688439d2 Make canned meat recipes use the right amount of meat (#32748)
* Make canned meat recipes use the right amount of meat
The amount of meat and the volume of the container did not add up
before this change and now they do.

* Halving chunk of meat volume and updating recipes to match

* Update data/json/items/comestibles/carnivore.json

Co-Authored-By: anothersimulacrum <anothersimulacrum@gmail.com>

* Updating meat cooling unit test
2019-08-01 12:09:32 +03:00
John Bytheway 4321c025d2 IWYU 20190629 (#31990)
* Add IWYU pragma: keep

* Run IWYU and astyle

* Run IWYU a second time

* Prevent #include <cxxabi.h>

Unclear why IWYU thinks this is needed.  It isn't, and it causes
problems on Visual Studio.
2019-07-01 12:25:53 +03:00
John Bytheway f3049e5eea Fix missing declarations (#30739)
* Fix missing declarations
Mark functions with no prior declarations as static, and remove the
unused ones.
* Move debug_is_safe_string definition
Put it inside !WIN32 since it's only used there.
2019-05-22 11:00:54 -07:00
Hirmuolio d7c155fece Temperature calculation cleaning (#30385)
* Don't pass temperature around
* test temperature control location
2019-05-16 23:48:58 -07:00
Hirmuolio 11427473a6 Combined rotting and temperature (#29818) 2019-04-29 20:58:07 -07:00
John Bytheway e3e7700aef Apply IWYU changes
This is a run of IWYU followed by astyle.
2019-04-22 11:42:51 +01:00
Kevin Granade 36b21d6fea CLRF fix 2019-03-14 03:50:42 +00:00
Hirmuolio a868b99b14 Thermal energy based temperature system (#27387)
* set_temperature also sets energy, set product temp
In old system crafted items just reset the temp check without setting the actual temperature.
Not going to try to implement anything fancy for that so crafted items that are not heated up are just set to 20 C which should behave similarly to old system.
Temperature is now calculated with newton's law of cooling. No more using approximation of an approximation.
* Energy and temperature are in 0.00001 J/g and K
2019-03-13 20:32:23 -07:00