Exemple #1
0
// used to deposit heat on the heat-map as a unit moves along its path
void CPathManager::UpdatePath(const CSolidObject* owner, unsigned int pathId)
{
	if (!pathId) {
		return;
	}

#ifndef USE_GML
	static std::vector<int2> points;
#else
	std::vector<int2> points;
#endif

	GetDetailedPathSquares(pathId, points);

	float scale = 1.0f / points.size();
	unsigned int i = points.size();

	for (std::vector<int2>::const_iterator it = points.begin(); it != points.end(); ++it) {
		SetHeatOnSquare(it->x, it->y, i * scale * owner->mobility->heatProduced, owner->id); i--;
	}
}
void CPathManager::SetHeatOnPos(float3 pos, int value, int ownerId)
{
	int x = (int)pos.x/SQUARE_SIZE;
	int y = (int)pos.z/SQUARE_SIZE;
	SetHeatOnSquare(x, y, value, ownerId);
}