Пример #1
0
void Web::Calc(const Vector2I* exclude)
{
	static Vector2I origin = { NUM_SECTORS / 2, NUM_SECTORS / 2 };
	CArray<Vector2I, NUM_SECTORS * NUM_SECTORS> cores;
	cores.Push(origin);

	int n = 0;
	CoreScript** list = CoreScript::GetCoreList(&n);
	for (int i = 0; i < n; ++i) {
		CoreScript* cs = list[i];
		Vector2I sector = ToSector(cs->ParentChit()->Position());
		if (    (sector != origin) && cs && cs->InUse() 
			 && Team::Instance()->GetRelationship(cs->ParentChit()->Team(), TEAM_VISITOR) != ERelate::ENEMY) 
		{
			GLASSERT(cores.HasCap());
			if (!exclude || (*exclude != sector)) {
				cores.Push(sector);
			}
		}
	}
	tree.Calc(cores.Mem(), cores.Size());
}