mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 07:29:20 +02:00
refactor(sonar): use std::ranges algorithms and std::erase(_if) (cpp:S6197)
This commit is contained in:
@@ -46,11 +46,10 @@ world_environment::compute_season( int const Yearday ) {
|
||||
{ 341, "autumn:" },
|
||||
{ 366, "winter:" } };
|
||||
auto const lookup =
|
||||
std::lower_bound(
|
||||
std::begin( seasonsequence ), std::end( seasonsequence ),
|
||||
std::ranges::lower_bound(
|
||||
seasonsequence,
|
||||
std::clamp( Yearday, 1, seasonsequence.back().first ),
|
||||
[]( dayseasonpair const &Left, const int Right ) {
|
||||
return Left.first < Right; } );
|
||||
{}, &dayseasonpair::first );
|
||||
|
||||
Global.Season = lookup->second;
|
||||
// season can affect the weather so if it changes, re-calculate weather as well
|
||||
|
||||
Reference in New Issue
Block a user