#pragma once

#include <BWAPI.h>
#include "CBase.h"
#include "CUnit.h"
#include "Macro.h"
#include "CMap.h"

using namespace BWAPI;

class CBase;
class CUnit;

class Util
{
public:	
	static int buildWorkerIndex();
	static bool completedBuilding(BWAPI::UnitType unitType);
	static int countUnits(int playerID, BWAPI::UnitType unitType);
	static void displayQueue();
	static int eggCount(BWAPI::UnitType unitType);
	static int findUpgradeBuilding(BWAPI::UpgradeType upgradeType);
	static int getBaseIndex(Unit unit);
	static int getClosestOwnedBase(Unit unit);
	static double getDistance(TilePosition tp1, TilePosition tp2);
	static int getLocation(TilePosition tp);
	static std::pair<const BWEM::Area*, bool> getNeighborArea(const BWEM::Area* a1, const BWEM::Area* a2);
	static CBase getNextExpand(int playerID);
	static int getQueueIndex(UnitType ut);
	static int getStaticDCount(int playerID, std::string type);
	static std::pair<const BWEM::Area*, bool> getTargetArea(const BWEM::Area* startingArea, bool startLocation);
	static int getUnitIndex(Unit unit);
	static double getWalkDistance(TilePosition tp1, TilePosition tp2);
	static bool isAttackingUnit(CUnit u);
	static bool isBase(Unit unit);
	static bool isBasePosition(TilePosition tp);
	static bool isSameArea(const BWEM::Area* area1, const BWEM::Area* area2);
	static bool isSameTilePosition(TilePosition tp1, TilePosition tp2);
	static int ownedBy(TilePosition tp);
	static bool unitCounted(Unit unit);
	static int workerBuildingTargetCount(UnitType unit);
};