I misunderstood the weather test and though it was a random calendar
related failure caused by it picking the wrong summer/winter points.
Reading the code further, this was wrong, and changing
time_past_new_year to include time in winter broke the weather code.
It is still picking the wrong summer/winter points, it seems (change it
to midsummer and midwinter, instead of the start of spring and end of
spring).
The weather code assumed time_past_new_year gave time since spring, so
it needed to be correctly offset to know when midwinter was.
Split the 364 day year up into months as so:
The seasons are
Dec, Jan, Feb, Mar -> Winter
Mar, Apr, May, Jun -> Spring
Jun, Jul, Aug, Sep -> Summer
Sep, Oct, Nov, Dec -> Autumn
The first month of each season has 31 days, and the first day of each
season is on the 20th of the first month (the last day on the 19th of
the last month).
For season settings other than 364 days, season display is broken and I
need to consider how to implement this correctly.
Some additional logic was needed for the year transition correctly on
Dec 31 -> Jan 1, because turn_zero is the first day of Spring.
The calendar code isn't too gross, but is still gross.
* 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)
Fixes#26756.
Use the same trick as I previously used for the sunlight angle in
eternal season mode where it just repeats the same weather from the
first game day. A twist here is that we still use the true timestamp
for the simplex noise parameter, because otherwise the weather would be
exactly the same from day to day.
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.
It is possible for an earlier test to set weather_override, which could
interfere with weather_test.cpp's weather generation test. This patch
prevents this. (It was previously part of #48245.)
* 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++
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.
* 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
* Use better variable names
* Document windchill declaration; floor return value
* Use std::ceil instead of std::floor
Based on the results of 33 test assertions, the implicit return cast to
int here is using `std::ceil` rather than `std::floor`.
* Reduce NorAm/UK windchill cutoff from 4F to 3F
According to Wikipedia, 3.0 is the cutoff for this model.
* Add windchill test for North America/UK model
* Flesh out Australian apparent temperature test
* 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>