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:
@@ -211,7 +211,6 @@ struct INDYChunkHandler : ChunkHandler {
|
||||
|
||||
SlIndustryAccepted::ResetOldStructure();
|
||||
SlIndustryProduced::ResetOldStructure();
|
||||
Industry::ResetIndustryCounts();
|
||||
|
||||
while ((index = SlIterateArray()) != -1) {
|
||||
Industry *i = new (index) Industry();
|
||||
@@ -229,7 +228,7 @@ struct INDYChunkHandler : ChunkHandler {
|
||||
} else if (IsSavegameVersionBefore(SLV_INDUSTRY_CARGO_REORGANISE)) {
|
||||
LoadMoveAcceptsProduced(i, INDUSTRY_NUM_INPUTS, INDUSTRY_NUM_OUTPUTS);
|
||||
}
|
||||
Industry::IncIndustryTypeCount(i->type);
|
||||
Industry::industries[i->type].push_back(i->index); // Assume savegame indices are sorted.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user