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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user