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

Method onFrame

bwapi/TestAIModule/Source/DefaultTestModule.cpp:15–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13 Broodwar->sendText("operation cwal");
14}
15void DefaultTestModule::onFrame()
16{
17 if (Broodwar->getFrameCount()==0) return;
18 Broodwar->drawTextScreen(0,0,"FPS: %d",Broodwar->getFPS());
19 for (Unit u : Broodwar->getAllUnits())
20 {
21 Broodwar->drawTextMap(u->getPosition().x,u->getPosition().y-16,"%s",u->getOrder().c_str());
22 Broodwar->drawTextMap(u->getPosition().x,u->getPosition().y,"%s",u->getType().c_str());
23 }
24 for (Unit u : Broodwar->getAllUnits())
25 {
26 if (lastOrder.find(u)==lastOrder.end())
27 {
28 lastOrder[u]=Orders::None;
29 }
30 }
31 for (Unit u : Broodwar->getAllUnits())
32 {
33 if (lastOrder[u]!=u->getOrder())
34 {
35 lastDistinctOrders[u].push_front(lastOrder[u]);
36 if (lastDistinctOrders[u].size()>5)
37 lastDistinctOrders[u].pop_back();
38 lastOrder[u]=u->getOrder();
39 }
40 }
41 for (Unit u : Broodwar->getAllUnits())
42 {
43 int y=-32;
44 for (Order o : lastDistinctOrders[u])
45 {
46 Broodwar->drawTextMap(u->getPosition().x,u->getPosition().y+y,"%s",o.c_str());
47 y-=16;
48 }
49 }
50}

Callers

nothing calls this directly

Calls 10

drawTextScreenMethod · 0.80
drawTextMapMethod · 0.80
c_strMethod · 0.80
endMethod · 0.80
getFrameCountMethod · 0.45
getFPSMethod · 0.45
getPositionMethod · 0.45
getOrderMethod · 0.45
getTypeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected