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

Method issueCommand

bwapi/BWAPI/Source/BWAPI/UnitImpl.cpp:88–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86 return BroodwarImpl.commandOptimizer.add(command);
87 }
88 bool UnitImpl::issueCommand(UnitCommand command)
89 {
90 if ( !canIssueCommand(command) )
91 return false;
92
93 // If the command optimizer has decided to take over
94 if ( this->prepareIssueCommand(command) )
95 return true;
96
97 // Select High templar for morphing
98 if (command.type == UnitCommandTypes::Use_Tech_Unit && command.target &&
99 (command.extra == TechTypes::Archon_Warp || command.extra == TechTypes::Dark_Archon_Meld))
100 {
101 //select both units for archon warp or dark archon meld
102 Unit sel2[2] = { command.unit, command.target };
103 BW::Orders::Select sel(2, sel2);
104 QueueGameCommand(&sel, sel.size());
105 BroodwarImpl.apmCounter.addSelect();
106 }
107 else if (command.type != UnitCommandTypes::Unload || BroodwarImpl.commandOptimizer.level < 2)
108 {
109 // TODO this piece should be extracted to the CommandOptimizer
110 static_cast<UnitImpl*>(command.unit)->orderSelect(); // Unload optimization (no select)
111 }
112
113 // Immediately execute the command
114 BroodwarImpl.executeCommand( command );
115 return true;
116 }
117 //--------------------------------------------- SET SELECTED -----------------------------------------------
118 void UnitImpl::setSelected(bool selectedState)
119 {

Callers 1

processCommandsMethod · 0.45

Calls 7

prepareIssueCommandMethod · 0.95
canIssueCommandFunction · 0.85
QueueGameCommandFunction · 0.85
addSelectMethod · 0.80
orderSelectMethod · 0.80
executeCommandMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected