const CCommandQueue* CAICallback::GetCurrentUnitCommands(int unitId) { const CCommandQueue* currentUnitCommands = NULL; const CUnit* unit = GetMyTeamUnit(unitId); if (unit) { currentUnitCommands = &unit->commandAI->commandQue; } return currentUnitCommands; }
const std::vector<CommandDescription>* CAICallback::GetUnitCommands(int unitId) { const std::vector<CommandDescription>* unitCommands = NULL; const CUnit* unit = GetMyTeamUnit(unitId); if (unit) { unitCommands = &unit->commandAI->possibleCommands; } return unitCommands; }
bool CAICallback::RemoveUnitFromGroup(int unitId) { bool removed = false; CUnit* unit = GetMyTeamUnit(unitId); if (unit) { unit->SetGroup(0); removed = true; } return removed; }
bool CAICallback::AddUnitToGroup(int unitId, int groupId) { bool added = false; CUnit* unit = GetMyTeamUnit(unitId); if (unit) { if (CHECK_GROUPID(groupId) && gh->groups[groupId]) { added = unit->SetGroup(gh->groups[groupId]); } } return added; }
int CAICallback::GetUnitGroup(int unitId) { int groupId = -1; const CUnit* unit = GetMyTeamUnit(unitId); if (unit) { const CGroup* group = unit->group; if (group) { groupId = group->id; } } return groupId; }