17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 10:59:20 +02:00

refactor(sonar): use std::ranges algorithms and std::erase(_if) (cpp:S6197)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 16:24:06 +02:00
parent 22c7c33a63
commit 51337cb1b7
9 changed files with 25 additions and 38 deletions

View File

@@ -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