display faction in selected object name for hq and defence stations

This commit is contained in:
2026-07-14 21:00:02 +02:00
parent 2ea0cb815d
commit 23ff406101

View File

@@ -47,6 +47,11 @@ namespace
QString buildingTypeName(BuildingType type) QString buildingTypeName(BuildingType type)
{ {
if (type == BuildingType::Hq)
{
return QObject::tr("Player HQ");
}
const std::string id = buildingTypeId(type); const std::string id = buildingTypeId(type);
QString result; QString result;
bool nextUpper = true; bool nextUpper = true;
@@ -971,7 +976,11 @@ void SelectedBuildingPanel::buildEntityStation(entt::entity entity)
EntityAdmin& admin = m_sim->admin(); EntityAdmin& admin = m_sim->admin();
const HealthComponent& health = admin.get<HealthComponent>(entity); 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(); m_entityTitleLabel->show();
float totalDps = 0.0f; float totalDps = 0.0f;