2 Commits

View File

@@ -47,6 +47,11 @@ namespace
QString buildingTypeName(BuildingType type)
{
if (type == BuildingType::Hq)
{
return QObject::tr("Player HQ");
}
const std::string id = buildingTypeId(type);
QString result;
bool nextUpper = true;
@@ -479,13 +484,24 @@ void SelectedBuildingPanel::refreshBuffers(const Building* b)
bufText += "\n";
}
// Count output-side items: buffered plus still-emerging on the output belts.
// An emerging item still belongs to the output buffer (REQ-MAT-OUTPUT-EMERGE),
// so it must be included here or it would vanish from the panel while animating.
std::map<std::string, int> outCounts;
for (const Item& item : b->outputBuffer.items)
{
outCounts[item.type.id]++;
}
for (const std::vector<BeltItemSlot>& lane : b->emergingItems)
{
for (const BeltItemSlot& slot : lane)
{
outCounts[slot.item.type.id]++;
}
}
if (recipe && !recipe->outputs.empty())
{
std::map<std::string, int> outCounts;
for (const Item& item : b->outputBuffer.items)
{
outCounts[item.type.id]++;
}
bufText += tr("Output: ");
for (const RecipeOutput& out : recipe->outputs)
{
@@ -497,13 +513,8 @@ void SelectedBuildingPanel::refreshBuffers(const Building* b)
+ "/" + QString::number(out.amount) + " ";
}
}
else if (!b->outputBuffer.items.empty())
else if (!outCounts.empty())
{
std::map<std::string, int> outCounts;
for (const Item& item : b->outputBuffer.items)
{
outCounts[item.type.id]++;
}
bufText += tr("Output: ");
for (const std::pair<const std::string, int>& entry : outCounts)
{
@@ -965,7 +976,11 @@ void SelectedBuildingPanel::buildEntityStation(entt::entity entity)
EntityAdmin& admin = m_sim->admin();
const HealthComponent& health = admin.get<HealthComponent>(entity);
m_entityTitleLabel->setText(tr("Defence Station"));
const bool isEnemy = admin.hasAll<FactionComponent>(entity)
&& admin.get<FactionComponent>(entity).isEnemy;
m_entityTitleLabel->setText(isEnemy
? tr("Enemy Defence Station")
: tr("Player Defence Station"));
m_entityTitleLabel->show();
float totalDps = 0.0f;