34 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
RenechCDDA b4c66c516e Food continues to rot at temp above 63C 2024-05-24 20:38:36 -04: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
Drew4484 68af1b9ebe Celcius to Celsius (#61137) 2022-09-20 16:04:40 +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 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
Hirmuolio 675499c368 Refactor hourly rotpoints (#50024)
* refactor rotpoints
Co-authored-by: Binrui Dong <brett.browning.dong@gmail.com>
2021-07-31 18:14:16 -07: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
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
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 7ab2e0408c Move handling of item left behind by attack out of process_internal (#41569) 2020-06-26 22:07:37 +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
John Bytheway 03b7ba94d0 Fix corner case in rot test
The test would fail if run when calendar::turn was start_of_cataclysm.
Fix that by avoiding that special case.
2020-04-12 19:56:46 -04:00
John Bytheway 32e7f59a09 Tidy up rot check assertions
We were rolling our own functionality rather than taking advantage of
Catch2 features.  Do the latter to simplify the code.
2020-04-12 19:56:46 -04:00
Kevin Granade 4d279bdc29 Merge pull request #39443 from Hirmuolio/rot-tests
Fix cold items rotting in freezer and add tests for item rot in preserving container and in freezer
2020-04-11 06:19:28 +00:00
hirmuolio 4655909052 do not freeze the item 2020-04-10 22:34:51 +03:00
Hirmuolio 17d95cb7a8 preserved and in freezer rot test 2020-04-10 17:45:24 +03:00
John Bytheway e189957ff2 Run IWYU 20200408 (#39364)
* Helper script to run IWYU

* Run IWYU

* Update deprecated headers

* Run IWYU again

* Re-suppress cxxabi.h

This pragma got accidentally removed because it was deemed to be a
comment attached to a #include.

* Remove extra SDL header includes

* Fix ime.cpp headers

Some tweaks to help IWYU not break this file by messing with
platform-specific stuff not relevant on Linux.

* Update game.h

* Move new point.h includes inside #ifdef

* Re-add platform_win.h to mapsharing.cpp

* Apply suggestions from code review

Co-authored-by: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
2020-04-10 12:16:19 +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
Hirmuolio 9e8ad15b89 Fix rotting happening at 1/6 rate (#33898)
* Add files via upload

* basic rot test

* unnecessary newlines

* change get_hourly_rotpoints_at_temp instead
2019-09-08 17:58:59 -07:00