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