Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catchup to CleverRaven #10

Merged
merged 112 commits into from
Jan 6, 2020
Merged
Changes from 8 commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
46c9ac1
Leech-pod-monster family
John-Candlebury Dec 7, 2019
5fd024a
Fix typo
John-Candlebury Dec 18, 2019
86b3fa6
Apply suggestions from code review
John-Candlebury Dec 18, 2019
ffb5507
Follow through suggestions
John-Candlebury Dec 19, 2019
3fcc65b
Reword alien frond description
John-Candlebury Dec 19, 2019
adb9e66
Correct monattack logic
John-Candlebury Dec 20, 2019
df0f9ba
Finalize leech pod monster family
John-Candlebury Dec 20, 2019
86a0823
Allow folding turret mount
Dec 31, 2019
514fedc
Use a slightly more accurate lunar month
jbytheway Dec 30, 2019
2569a21
Factor out the real and default season lengths
jbytheway Dec 30, 2019
4075247
Simplify some arithmetic.
jbytheway Dec 30, 2019
fd88a62
Add a test for the lunar cycle code.
jbytheway Dec 30, 2019
346a794
Be more permissive in season length assertion
jbytheway Dec 31, 2019
31bae0e
Ensure moon phase doesn't change at night
jbytheway Dec 31, 2019
9080d34
Suppress clang-tidy warning
jbytheway Dec 31, 2019
66130a0
Update tools.json
RarkGrames Jan 1, 2020
142fdfe
Detect and warn about crafting with rotten food
jbytheway Jan 1, 2020
a77b8b8
Merge pull request #36622 from RarkGrames/Tools_general-item-group-tweak
Rivet-the-Zombie Jan 2, 2020
1b3b2db
Leech pod monster family (#35921)
kevingranade Jan 2, 2020
a85a02a
Jsonize autodoc couch (#36200)
Fris0uman Jan 2, 2020
efa31be
Aftershock errors to be fixed (#36425)
Maleclypse Jan 2, 2020
d2e8c25
Fix extended pickup window (#36593)
8street Jan 2, 2020
0918b4e
Merge pull request #36549 from jbytheway/non_synchronous_moon_phases
kevingranade Jan 2, 2020
3399e37
Add items, update military pilot drops (#36558)
Jan 2, 2020
89a7b1c
Store crafting related item data in a separate object inside a value_ptr
BevapDin Dec 31, 2019
304a9e8
Fix description
Ramza13 Dec 31, 2019
9b46640
Colored title of the info window (#36612)
8street Jan 2, 2020
eab27aa
Unconditionally use material thickness for armor
Jan 1, 2020
9b40e2e
move and rename sus bedroom item_groups (#36614)
curstwist Jan 2, 2020
5bdcd06
Remove pit digging construction from CRIT
TheShadowFerret Jan 1, 2020
f6eb74d
Alcohol Revamp
LilShiningMan Jan 1, 2020
93c4c76
Update arms.json
RarkGrames Jan 1, 2020
b2c6779
Fix crash in item comparison when using filter
jbytheway Jan 1, 2020
dd658ae
Merge pull request #36602 from ymber/fold_turret
ZhilkinSerg Jan 2, 2020
d1d6270
Merge pull request #36610 from jbytheway/warn_rotten_components
ZhilkinSerg Jan 2, 2020
fe0e3de
Remove duplicate stealing code (#36596)
8street Jan 2, 2020
19a91c1
add roof to city block, vehicles
curstwist Jan 2, 2020
202f0b8
Book editing (#36631)
k4gi Jan 2, 2020
fe72505
Disable erroneous old-style-cast warning
kevingranade Jan 2, 2020
07dc4f5
Remove obsolete rock override (#36649)
kevingranade Jan 3, 2020
7aad3ab
don't rebuild the item drop list (#36647)
KorGgenT Jan 3, 2020
c3a2c46
unify savegame version and bump to 27 (#36654)
KorGgenT Jan 3, 2020
828501c
Fixed gunsafe's logic. (#36651)
Kelenius Jan 3, 2020
a39fc83
Merge pull request #36646 from curstwist/add-city-block-roof
Rivet-the-Zombie Jan 3, 2020
68babf9
Revert "don't rebuild the item drop list (#36647)"
BevapDin Jan 3, 2020
4a734f0
Add new mapgen location - private resort. (#35997)
CountAlex Jan 3, 2020
2f4d528
Fix dropping only two or so items when selecting to drop all of a stack.
BevapDin Jan 3, 2020
6df71be
Aftershock: Add titanium items, spawning and recipes (#36581)
Soup-de-Loop Jan 4, 2020
a758fa6
Dynamically scale overmap legend width (#36662)
Night-Pryanik Jan 4, 2020
059a00b
fix crash when switching modes with reach weapon in aiming window
Jan 3, 2020
5a05025
Fix mapgen code accessing the main game map.
BevapDin Jan 3, 2020
5575599
jsonize swim speed modifier as per walk cost mutation modifier
Jan 3, 2020
f7e3493
NPC's cant read while blind
Ramza13 Jan 3, 2020
ed9e547
set pathfinding avoid_traps to true by default
Dec 18, 2019
a5fb48e
Routine i18n updates on 4 Jan 2019
BrettDong Jan 4, 2020
5e67b46
renovate house 04 (#36640)
curstwist Jan 4, 2020
175ddf5
Merge pull request #36683 from BrettDong/i18n
Rivet-the-Zombie Jan 4, 2020
c30844c
Prevent undefined behaviour modifying bionic power
anothersimulacrum Jan 4, 2020
5c02744
Prevent high eye encumbrance from blinding players
anothersimulacrum Jan 4, 2020
58ef4cd
Add an option to start the game window maximized
Qrox Jan 4, 2020
c4f6a89
Graphical Overmap update (#35792)
Larwck Jan 4, 2020
eb750c3
Fix Wgt/Vol position in pickup window (#36643)
8street Jan 4, 2020
235601a
Mi-go furnitures contain a fetid goop that can mask your scent (#36160)
Fris0uman Jan 4, 2020
c47e299
Speedup move test (#36664)
kevingranade Jan 4, 2020
7c22756
Aftershock: PrepNet mycus war (#36661)
Maleclypse Jan 4, 2020
9326ba6
Add title to info window in shift-v menu (#36648)
8street Jan 4, 2020
d0a3632
Merge pull request #36686 from anothersimulacrum/ub
ZhilkinSerg Jan 4, 2020
537fd02
Merge pull request #36687 from anothersimulacrum/vis
ZhilkinSerg Jan 4, 2020
9e6c9bf
Merge pull request #36688 from Qrox/maximize
ZhilkinSerg Jan 4, 2020
7399eec
Restore crafting results being put on the workbench.
BevapDin Jan 4, 2020
5f339eb
Fix accessing invalid item locations:
BevapDin Jan 4, 2020
1e7f02e
Fix monsters not being spawned on the map (#36691)
ZhilkinSerg Jan 4, 2020
0e04348
Add construction recipe to turn shallow water to dirt. (#36493)
Jan 4, 2020
2c5394f
Prune secret recipes from character creation display
kevingranade Jan 4, 2020
6b4ae2c
renovate houses 06-10 (#36693)
curstwist Jan 4, 2020
5c8e01c
Magiclysm: Cooking with Poison (#36627)
Maleclypse Jan 4, 2020
f32f08b
Fix linting (#36701)
anothersimulacrum Jan 4, 2020
cf92e9c
Merge pull request #36694 from BevapDin/ouj
ZhilkinSerg Jan 4, 2020
525090e
Merge pull request #36673 from BevapDin/biy
ZhilkinSerg Jan 4, 2020
443da66
Fix garage door knockback crash (#36671)
Jan 4, 2020
c61070d
Lab snippet lore update (#36497)
I-am-Erk Jan 4, 2020
264b304
update houses 11-15 (#36698)
curstwist Jan 4, 2020
ca62787
Add reload wielded keybinding (#36658)
Ramza13 Jan 5, 2020
922b9a6
Cap fire age to prevent android overflow (#36676)
Jan 5, 2020
91d7b51
Monster reorganize add fungus json (#36684)
Maleclypse Jan 5, 2020
fdcae19
Add "repairs_like" for items without a recipe (#36700)
anothersimulacrum Jan 5, 2020
ada2433
Stop ant tunnels stomping over other map terrain underground and remo…
Jan 5, 2020
552ecbb
Prevent counterattacking with large/fragile items (#36704)
anothersimulacrum Jan 5, 2020
921a9f4
check emptiness (#36705)
Jan 5, 2020
6d96601
Move bronze to materials.json
anothersimulacrum Jan 5, 2020
cac8083
Merge pull request #36699 from CleverRaven/kevingranade-fix-learned-r…
Rivet-the-Zombie Jan 5, 2020
745411a
update houses 16-19 (#36709)
curstwist Jan 5, 2020
9fe2e72
Merge pull request #36713 from anothersimulacrum/mv-bronze
ZhilkinSerg Jan 5, 2020
1e08b4d
Remove unused declarators
ZhilkinSerg Jan 5, 2020
8925fea
Remove excessive incements
ZhilkinSerg Jan 5, 2020
f1490fc
Remove excessive empty lines
ZhilkinSerg Jan 5, 2020
1cabb58
Normalized TODO/HACK/FIXME comments
ZhilkinSerg Jan 5, 2020
7c7fc4d
Removed redundant empty statement
ZhilkinSerg Jan 5, 2020
d941b4f
Put comments to separate lines
ZhilkinSerg Jan 5, 2020
7a023e4
Spell-casting NPCs (#35597)
araneyl Jan 5, 2020
af810ad
update 5 more houses (#36727)
curstwist Jan 5, 2020
74eed30
Create canned.json (#36718)
Maleclypse Jan 5, 2020
a511881
make fibrous stalk burnable (#36717)
8ctopus Jan 5, 2020
bce06b8
Added 2 new NPCs. (#35238)
LovamKicsiGazsii Jan 5, 2020
4c4fa00
Mark royal jelly recipe secret.
kevingranade Jan 5, 2020
7810b06
Minor fixes to godco content.
kevingranade Jan 5, 2020
3829c9f
Freeze burn does not cause insta-rot (#36644)
Jan 5, 2020
9cc8e32
Move armor functions to Character (#36711)
anothersimulacrum Jan 5, 2020
d34a729
Fix undefined charges-max handling (#36723)
Jan 5, 2020
2b20b94
retrodays+ updates (#36735)
Jan 5, 2020
f069282
Mr Lapin NPC Warrener (#36287)
Maleclypse Jan 5, 2020
605409a
Merge pull request #36724 from ZhilkinSerg/sa-2020-01-05
kevingranade Jan 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/calendar.cpp
Original file line number Diff line number Diff line change
@@ -59,11 +59,13 @@ double default_daylight_level()

moon_phase get_moon_phase( const time_point &p )
{
//One full phase every 1 rl months = 1/3 season length
const time_duration moon_phase_duration = calendar::season_length() / 3.0;
//Switch moon phase at noon so it stays the same all night
const time_duration current_day = ( p - calendar::turn_zero ) + 1_days / 2;
const double phase_change = current_day / moon_phase_duration;
static constexpr time_duration synodic_month = 29.530588853 * 1_days;
const time_duration moon_phase_duration =
calendar::season_from_default_ratio() * synodic_month;
// Switch moon phase at noon so it stays the same all night
const int num_middays = to_days<int>( p - calendar::turn_zero + 1_days / 2 );
const time_duration nearest_midnight = num_middays * 1_days;
const double phase_change = nearest_midnight / moon_phase_duration;
const int current_phase = static_cast<int>( round( phase_change * MOON_PHASE_MAX ) ) %
static_cast<int>( MOON_PHASE_MAX );
return static_cast<moon_phase>( current_phase );
@@ -448,15 +450,16 @@ void calendar::set_season_length( const int dur )
cur_season_length = dur;
}

static constexpr int real_world_season_length = 91;
static constexpr int default_season_length = real_world_season_length;

float calendar::season_ratio()
{
static const int real_world_season_length = 91;
return to_days<float>( season_length() ) / real_world_season_length;
}

float calendar::season_from_default_ratio()
{
static const int default_season_length = 91;
return to_days<float>( season_length() ) / default_season_length;
}

38 changes: 38 additions & 0 deletions tests/calendar_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "catch/catch.hpp"

#include "calendar.h"
#include "rng.h"
#include "stringmaker.h"

TEST_CASE( "moon_phases_take_28_days", "[calendar]" )
{
CAPTURE( calendar::season_length() );
// This test only makes sense if the seasons are set to the default length
REQUIRE( calendar::season_from_default_ratio() == Approx( 1.0f ) );

const int num_days = GENERATE( take( 100, random( 0, 1000 ) ) );
const time_point first_time = calendar::turn_zero + time_duration::from_days( num_days );
const time_point later_14_days = first_time + 14_days;
const time_point later_29_days = first_time + 29_days;
const time_point later_30_days = first_time + 30_days;

CAPTURE( num_days );
CHECK( get_moon_phase( first_time ) != get_moon_phase( later_14_days ) );
// Phase should match either 29 or 30 days later
CHECK( ( get_moon_phase( first_time ) == get_moon_phase( later_29_days ) ||
get_moon_phase( first_time ) == get_moon_phase( later_30_days ) ) );
}

TEST_CASE( "moon_phase_changes_at_noon", "[calendar]" )
{
// This test only makes sense if the seasons are set to the default length
REQUIRE( calendar::season_from_default_ratio() == Approx( 1.0f ) );

const int num_days = GENERATE( take( 100, random( 0, 1000 ) ) );
const time_point midnight = calendar::turn_zero + time_duration::from_days( num_days );
const time_point earlier_11_hours = midnight - 11_hours;
const time_point later_11_hours = midnight + 11_hours;

CAPTURE( num_days );
CHECK( get_moon_phase( earlier_11_hours ) == get_moon_phase( later_11_hours ) );
}
1 change: 1 addition & 0 deletions tests/catch/catch.hpp
Original file line number Diff line number Diff line change
@@ -4238,6 +4238,7 @@ namespace Catch {
{
if( !IMutableContext::currentContext )
IMutableContext::createContext();
// NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn)
return *IMutableContext::currentContext;
}

7 changes: 7 additions & 0 deletions tests/stringmaker.h
Original file line number Diff line number Diff line change
@@ -40,6 +40,13 @@ struct StringMaker<cata_variant> {
}
};

template<>
struct StringMaker<time_duration> {
static std::string convert( const time_duration &d ) {
return string_format( "time_duration( %d ) [%s]", to_turns<int>( d ), to_string( d ) );
}
};

} // namespace Catch

#endif // CATA_TESTS_STRINGMAKER_H
2 changes: 1 addition & 1 deletion tests/vision_test.cpp
Original file line number Diff line number Diff line change
@@ -460,7 +460,7 @@ TEST_CASE( "vision_wall_can_be_lit_by_player", "[shadowcasting][vision]" )

TEST_CASE( "vision_see_wall_in_moonlight", "[shadowcasting][vision]" )
{
const time_point full_moon = calendar::turn_zero + calendar::season_length() / 3 / 2;
const time_point full_moon = calendar::turn_zero + calendar::season_length() / 6;
// Verify that I've picked the full_moon time correctly.
CHECK( get_moon_phase( full_moon ) == MOON_FULL );