show threat rate in debug output
This commit is contained in:
@@ -867,6 +867,44 @@ std::vector<ConstructionSite> BuildingSystem::allSites() const
|
||||
m_constructionQueue.end());
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
bool isProductionBuildingType(BuildingType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case BuildingType::Miner:
|
||||
case BuildingType::Smelter:
|
||||
case BuildingType::Assembler:
|
||||
case BuildingType::ReprocessingPlant:
|
||||
case BuildingType::Shipyard:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int BuildingSystem::productionBuildingCount() const
|
||||
{
|
||||
int count = 0;
|
||||
for (const Building& b : m_buildings)
|
||||
{
|
||||
if (isProductionBuildingType(b.type)) { ++count; }
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
int BuildingSystem::activeProductionBuildingCount() const
|
||||
{
|
||||
int count = 0;
|
||||
for (const Building& b : m_buildings)
|
||||
{
|
||||
if (isProductionBuildingType(b.type) && b.production.has_value()) { ++count; }
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
std::vector<BuildingSystem::BeltTileInfo> BuildingSystem::allBeltTiles() const
|
||||
{
|
||||
std::vector<BeltTileInfo> result;
|
||||
|
||||
@@ -79,6 +79,14 @@ public:
|
||||
const ConstructionSite* findSite(BuildingId id) const;
|
||||
std::vector<Building> allBuildings() const;
|
||||
std::vector<ConstructionSite> allSites() const;
|
||||
|
||||
// REQ-UI-DEBUG-OVERLAY "Max Factory Production": count of completed
|
||||
// (operational) Miner/Smelter/Assembler/ReprocessingPlant/Shipyard buildings.
|
||||
int productionBuildingCount() const;
|
||||
|
||||
// REQ-UI-DEBUG-OVERLAY "Current Factory Production": subset of the above
|
||||
// that currently has an active production cycle.
|
||||
int activeProductionBuildingCount() const;
|
||||
std::vector<BeltTileInfo> allBeltTiles() const;
|
||||
bool isTileOccupied(QPoint tile) const;
|
||||
|
||||
|
||||
@@ -863,6 +863,21 @@ double Simulation::threatLevel() const
|
||||
return m_waveSystem->threatLevel();
|
||||
}
|
||||
|
||||
double Simulation::threatAccumulationRate() const
|
||||
{
|
||||
return m_waveSystem->threatAccumulationRate();
|
||||
}
|
||||
|
||||
double Simulation::maxFactoryProductionThreatRate() const
|
||||
{
|
||||
return static_cast<double>(m_buildingSystem->productionBuildingCount());
|
||||
}
|
||||
|
||||
double Simulation::currentFactoryProductionThreatRate() const
|
||||
{
|
||||
return static_cast<double>(m_buildingSystem->activeProductionBuildingCount());
|
||||
}
|
||||
|
||||
int Simulation::bossWaveCounter() const
|
||||
{
|
||||
return m_waveSystem->bossWaveCounter();
|
||||
|
||||
@@ -67,6 +67,9 @@ public:
|
||||
int buildingBlocksStock() const;
|
||||
bool isGameOver() const;
|
||||
double threatLevel() const;
|
||||
double threatAccumulationRate() const;
|
||||
double maxFactoryProductionThreatRate() const;
|
||||
double currentFactoryProductionThreatRate() const;
|
||||
int bossWaveCounter() const;
|
||||
Tick bossCountdownTicks() const;
|
||||
Tick normalGapRemainingTicks() const;
|
||||
|
||||
@@ -103,6 +103,16 @@ double WaveSystem::threatLevel() const
|
||||
return m_threatLevel;
|
||||
}
|
||||
|
||||
double WaveSystem::threatAccumulationRate() const
|
||||
{
|
||||
if (isInQuietWindow())
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
const double x = static_cast<double>(m_bossWaveCounter);
|
||||
return std::max(0.0, m_config.world.waves.threatRateFormula.evaluate(x));
|
||||
}
|
||||
|
||||
int WaveSystem::generation() const
|
||||
{
|
||||
return m_generation;
|
||||
|
||||
@@ -36,6 +36,11 @@ public:
|
||||
|
||||
double threatLevel() const;
|
||||
|
||||
// Current rate at which threatLevel() is increasing, in threat/second
|
||||
// (REQ-WAV-THREAT-RATE). 0 during a quiet window (REQ-WAV-QUIET) or when
|
||||
// the rate formula evaluates to a negative value.
|
||||
double threatAccumulationRate() const;
|
||||
|
||||
// Current enemy-station generation level (0 for initial set,
|
||||
// incremented by 1 after each push — REQ-PSH-STATION-STATS).
|
||||
int generation() const;
|
||||
|
||||
Reference in New Issue
Block a user