MCPcopy Create free account
hub / github.com/bwapi/bwapi / writeUpgradeInfo

Function writeUpgradeInfo

bwapi/DocumentationGen/upgradetypes.cpp:3–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "helpers.h"
2
3void writeUpgradeInfo()
4{
5 std::ofstream of("upgradetypes.dox");
6 for (auto t : UpgradeTypes::allUpgradeTypes())
7 {
8 if (t == UpgradeTypes::Unknown || t == UpgradeTypes::None) continue;
9 of << docEnum(t);
10 of << docBegin(t);
11
12 of << icon(t) << " " << docIntro(t) << "\n";
13
14 of << "<table>";
15 of << row("Race", tref(t.getRace()));
16
17 std::string oreCost = imgOre() + std::to_string(t.mineralPrice());
18 if (t.maxRepeats() > 1) oreCost += " + lvl*" + std::to_string(t.mineralPriceFactor());
19 std::string gasCost = imgGas(t.getRace()) + std::to_string(t.gasPrice());
20 if (t.maxRepeats() > 1) gasCost += " + lvl*" + std::to_string(t.gasPriceFactor());
21 of << row("Cost", oreCost + " " + gasCost);
22
23 std::string timeCost = std::to_string(t.upgradeTime());
24 if (t.maxRepeats() > 1) timeCost += " + lvl*" + std::to_string(t.upgradeTimeFactor());
25 timeCost += " frames";
26 of << row("Upgrade Time", timeCost);
27
28 if (t.maxRepeats() != 1) of << row("Maximum Level", t.maxRepeats());
29 if (t.whatUpgrades() != UnitTypes::None) of << row("Upgraded at", iconref(t.whatUpgrades()));
30 if (!t.whatUses().empty()) of << row("Used by", makeiconlist(t.whatUses()));
31 if (t.whatsRequired(1) != UnitTypes::None) of << row("Level 1 Requires", iconref(t.whatsRequired(1)));
32 if (t.whatsRequired(2) != UnitTypes::None) of << row("Level 2 Requires", iconref(t.whatsRequired(2)));
33 if (t.whatsRequired(3) != UnitTypes::None) of << row("Level 3 Requires", iconref(t.whatsRequired(3)));
34
35 of << "</table>\n";
36
37 of << docEnd();
38 }
39}

Callers 1

mainFunction · 0.85

Calls 15

docEnumFunction · 0.85
docBeginFunction · 0.85
iconFunction · 0.85
docIntroFunction · 0.85
rowFunction · 0.85
imgOreFunction · 0.85
imgGasFunction · 0.85
iconrefFunction · 0.85
makeiconlistFunction · 0.85
docEndFunction · 0.85
maxRepeatsMethod · 0.80
mineralPriceFactorMethod · 0.80

Tested by

no test coverage detected