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

Function writeUnitInfo

bwapi/DocumentationGen/unittypes.cpp:4–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2
3
4void writeUnitInfo()
5{
6 std::ofstream of("unittypes.dox");
7 for (auto t : UnitTypes::allUnitTypes())
8 {
9 if (t == UnitTypes::Unknown || t == UnitTypes::None)
10 {
11 //of << docBegin(t) << docIntro(t) << docEnd();
12 continue;
13 }
14 of << docEnum(t);
15 of << docBegin(t);
16
17 //int iconId = t.getID();
18 //of << "<img src='icon" << iconId << ".png' style='float:right;'>";
19 of << icon(t) << " " << docIntro(t) << "\n";
20
21 of << "<table>";
22 //of << row("Identifier", t.getID());
23 of << row("Race", tref(t.getRace()));
24 of << row("Hit Points", t.maxHitPoints());
25 if (t.maxShields() > 0)
26 {
27 of << row("Shields", t.maxShields());
28 }
29 if (t.maxEnergy() > 0)
30 {
31 of << row("Energy", t.maxEnergy());
32 }
33 of << row("Armor", t.armor());
34 of << row("Armor Upgrade", iconref(t.armorUpgrade()));
35
36 std::string oreCost = imgOre() + std::to_string(t.mineralPrice());
37 std::string gasCost = imgGas(t.getRace()) + std::to_string(t.gasPrice());
38 std::string supplyCost = imgSupply(t.getRace()) + std::to_string(t.supplyRequired());
39 of << row("Cost", oreCost + " " + gasCost + " " + supplyCost);
40 of << row("Build Time", std::to_string(t.buildTime()) + " frames");
41
42 if (t.supplyProvided() > 0)
43 {
44 of << row("Supply Provided", t.supplyProvided());
45 }
46
47 if (t.buildScore() != 0) of << row("Build Score", t.buildScore());
48 if (t.destroyScore() != 0) of << row("Destroy Score", t.destroyScore());
49
50 if (t.topSpeed() != 0 || t.acceleration() != 0 || t.haltDistance() != 0)
51 {
52 of << row("Top Speed", t.topSpeed());
53 of << row("Acceleration", t.acceleration());
54 of << row("Halt Distance", t.haltDistance());
55 }
56 if (t.turnRadius() != 0) of << row("Turn Radius", t.turnRadius());
57
58 // Weapons
59 if (t.groundWeapon() != WeaponTypes::None)
60 {
61 if (t.maxGroundHits() == 1)

Callers 1

mainFunction · 0.85

Calls 15

docEnumFunction · 0.85
docBeginFunction · 0.85
iconFunction · 0.85
docIntroFunction · 0.85
rowFunction · 0.85
iconrefFunction · 0.85
imgOreFunction · 0.85
imgGasFunction · 0.85
imgSupplyFunction · 0.85
makeiconlistFunction · 0.85
makelistFunction · 0.85
docEndFunction · 0.85

Tested by

no test coverage detected