Skip to content

Commit

Permalink
Simplify the code and use ModeQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
Monsterovich committed Dec 14, 2024
1 parent c2e40cd commit ecec61f
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6234,19 +6234,12 @@ void doNextProduction(STRUCTURE *psStructure, DROID_TEMPLATE *current, QUEUE_MOD
{
DROID_TEMPLATE *psNextTemplate = factoryProdUpdate(psStructure, current);

if (current)
if (current && current->next)
{
auto it = std::find_if(apsTemplateList.begin(), apsTemplateList.end(), [current](const auto &templ) {
return *templ == *current;
});

if (it == apsTemplateList.end() && current->next)
{
structSetManufacture(psStructure, current->next, ModeImmediate);
// Increase the production counter, because we produced the old template
factoryProdAdjust(psStructure, current->next, true);
return;
}
structSetManufacture(psStructure, current->next, ModeQueue);
// Increase the production counter, because we produced the old template
factoryProdAdjust(psStructure, current->next, true);
return;
}

if (psNextTemplate != nullptr)
Expand Down

0 comments on commit ecec61f

Please sign in to comment.