From 3a14cea068d130e11b5d9dde11d4451dd7dec453 Mon Sep 17 00:00:00 2001 From: glx Date: Sat, 14 Dec 2019 17:22:38 +0100 Subject: Codechange: Replace FOR_ALL_COMPANIES with range-based for loops --- src/ai/ai_core.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/ai/ai_core.cpp') diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp index 459a3ead4..95c971af8 100644 --- a/src/ai/ai_core.cpp +++ b/src/ai/ai_core.cpp @@ -75,8 +75,7 @@ if ((AI::frame_counter & ((1 << (4 - _settings_game.difficulty.competitor_speed)) - 1)) != 0) return; Backup cur_company(_current_company, FILE_LINE); - const Company *c; - FOR_ALL_COMPANIES(c) { + for (const Company *c : Company::Iterate()) { if (c->is_ai) { PerformanceMeasurer framerate((PerformanceElement)(PFE_AI0 + c->index)); cur_company.Change(c->index); @@ -154,8 +153,7 @@ /* It might happen there are no companies .. than we have nothing to loop */ if (Company::GetPoolSize() == 0) return; - const Company *c; - FOR_ALL_COMPANIES(c) { + for (const Company *c : Company::Iterate()) { if (c->is_ai) AI::Stop(c->index); } } -- cgit v1.2.3-70-g09d2