keep an auto-recipe building's summary between its cycles

This commit is contained in:
2026-08-09 20:41:48 +02:00
parent ca49b9dbec
commit 09858f4b62
4 changed files with 27 additions and 8 deletions

View File

@@ -41,13 +41,22 @@ BufferedBuildingContent::CycleInfo AutoProductionContent::getCycleInfo(
}
}
if (!target.building || !target.building->production.has_value())
// Which recipe describes the cycle: the one running, or -- between cycles -- the one
// that ran last. Dropping it while idle would take the summary row and the chips'
// per-cycle amounts away and bring them back with every cycle, resizing the card in
// step with the building's status (REQ-UI-RECIPE-SUMMARY). Only a building that has
// never run has nothing to describe.
if (target.building && target.building->production.has_value())
{
m_lastRecipeId = target.building->production->recipeId;
}
if (!target.building || m_lastRecipeId.empty())
{
return info;
}
const RecipeDef* recipe = getContext().config->recipes.findRecipeDef(
target.building->production->recipeId, target.type);
const RecipeDef* recipe =
getContext().config->recipes.findRecipeDef(m_lastRecipeId, target.type);
if (!recipe)
{
return info;