Codechange: Speed up industry generation using industry-type checks. (#13094)

Store a list of industries per industry type. This allows industry generation checks which only consider a specific industry type to check a reduced set of industries, leading to a potential performance increase.

This also removes the need to track industry type counts as well.
This commit is contained in:
Peter Nelson
2024-11-22 23:17:24 +00:00
committed by GitHub
parent a951896364
commit 16038879e4
5 changed files with 39 additions and 77 deletions
+1 -1
View File
@@ -874,7 +874,7 @@ static bool LoadOldIndustry(LoadgameState *ls, int num)
i->random_colour = RemapTTOColour(i->random_colour);
}
Industry::IncIndustryTypeCount(i->type);
Industry::industries[i->type].push_back(i->index); // Assume savegame indices are sorted.
} else {
delete i;
}