Example #1
0
const CCommandQueue* CAICallback::GetCurrentUnitCommands(int unitId)
{
	const CCommandQueue* currentUnitCommands = NULL;

	const CUnit* unit = GetMyTeamUnit(unitId);
	if (unit) {
		currentUnitCommands = &unit->commandAI->commandQue;
	}

	return currentUnitCommands;
}
Example #2
0
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;
}
Example #3
0
bool CAICallback::RemoveUnitFromGroup(int unitId)
{
	bool removed = false;

	CUnit* unit = GetMyTeamUnit(unitId);
	if (unit) {
		unit->SetGroup(0);
		removed = true;
	}

	return removed;
}
Example #4
0
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;
}
Example #5
0
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;
}