show tooltip for artifacts in the header bar
This commit is contained in:
@@ -279,6 +279,12 @@ WorldConfig ConfigLoader::loadWorld(const std::string& path)
|
||||
cfg.buildingBlocksTooltip = *tip;
|
||||
}
|
||||
|
||||
if (const std::optional<std::string> tip =
|
||||
tbl["world"]["artifact_tooltip"].value<std::string>())
|
||||
{
|
||||
cfg.artifactTooltip = *tip;
|
||||
}
|
||||
|
||||
cfg.regions.asteroidWidth_tiles = static_cast<int>(requireInt(tbl["regions"]["asteroid_width_tiles"], file, "regions.asteroid_width_tiles"));
|
||||
cfg.regions.playerBufferWidth_tiles = static_cast<int>(requireInt(tbl["regions"]["player_buffer_width_tiles"], file, "regions.player_buffer_width_tiles"));
|
||||
cfg.regions.contestZoneWidth_tiles = static_cast<int>(requireInt(tbl["regions"]["contest_zone_width_tiles"], file, "regions.contest_zone_width_tiles"));
|
||||
|
||||
@@ -82,6 +82,10 @@ struct WorldConfig
|
||||
// (REQ-UI-BLOCKS-TOOLTIP). Presentation-only; the simulation ignores it.
|
||||
std::optional<std::string> buildingBlocksTooltip;
|
||||
|
||||
// Optional hover-tooltip for the header artifact count display
|
||||
// (REQ-UI-ARTIFACTS-TOOLTIP). Presentation-only; the simulation ignores it.
|
||||
std::optional<std::string> artifactTooltip;
|
||||
|
||||
WorldRegions regions;
|
||||
WorldExpansion expansion;
|
||||
WorldPush push;
|
||||
|
||||
@@ -88,6 +88,11 @@ TEST_CASE("ConfigLoader loads the committed bin/config/ configs end-to-end", "[c
|
||||
REQUIRE(*cfg.world.buildingBlocksTooltip ==
|
||||
"Spend building blocks to build; deliver them to the HQ to gain more.");
|
||||
|
||||
// Optional header artifact tooltip (REQ-UI-ARTIFACTS-TOOLTIP).
|
||||
REQUIRE(cfg.world.artifactTooltip.has_value());
|
||||
REQUIRE(*cfg.world.artifactTooltip ==
|
||||
"Choose the artifact reward when destroying enemy stations; collect enough to win.");
|
||||
|
||||
// Spot-check that a config-derived formula computes as expected.
|
||||
// threat_rate_formula = "x": evaluates to the input value.
|
||||
REQUIRE(cfg.world.waves.threatRateFormula.evaluate(1.0) == Approx(1.0));
|
||||
|
||||
@@ -32,6 +32,11 @@ HeaderBar::HeaderBar(const GameConfig* config, QWidget* parent)
|
||||
QString::fromStdString(*config->world.buildingBlocksTooltip));
|
||||
}
|
||||
m_artifactsLabel = new QLabel(tr("Artifacts: 0/?"), this);
|
||||
if (config->world.artifactTooltip)
|
||||
{
|
||||
m_artifactsLabel->setToolTip(
|
||||
QString::fromStdString(*config->world.artifactTooltip));
|
||||
}
|
||||
m_bossLabel = new QLabel(tr("Boss Wave #1 Next boss: 5:00"), this);
|
||||
layout->addWidget(m_timeLabel);
|
||||
layout->addWidget(m_blocksLabel);
|
||||
|
||||
Reference in New Issue
Block a user