1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-24 20:54:08 +01:00

Fix 9cdf740097: Don't make copy of format providers when making a screenshot. (#14681)

While here, use projection instead of lambda to select provider.
This commit is contained in:
Peter Nelson
2025-09-29 21:02:08 +01:00
committed by GitHub
parent f8aa2e64e4
commit dcc3a67752

View File

@@ -48,10 +48,10 @@ uint _heightmap_highest_peak; ///< When saving a heightmap, this contain
*/
static ScreenshotProvider *GetScreenshotProvider()
{
auto providers = ProviderManager<ScreenshotProvider>::GetProviders();
const auto &providers = ProviderManager<ScreenshotProvider>::GetProviders();
if (providers.empty()) return nullptr;
auto it = std::ranges::find_if(providers, [](const auto &p) { return p->GetName() == _screenshot_format_name; });
auto it = std::ranges::find(providers, _screenshot_format_name, &ScreenshotProvider::GetName);
if (it != std::end(providers)) return *it;
return providers.front();