Exemple #1
0
int Map::CreateBuilding(int x, int y, BUILDINGTYPE type, OWNER owner)
{
	Building *bd = GetBuilding(x, y);
	if (bd->GetType() == NONE)
	{
		bd->Create(type, owner);
		std::cout << "Building created.\n";
		return 1;
	}
	else
	{
		/*std::cout << "Cannot build.\n";*/
		return 0;
	}
}
Exemple #2
0
void Map::Init(libconfig::Config *conf)
{
	// Clear map
	for (int x = 0; x < TILES_X; x++)
	{
		for (int y = 0; y < TILES_Y; y++)
		{
			m_buildings[x][y] = new Building();
		}
	}

	// Create core
	Building *bd = GetBuilding(1, 1);
	bd->Create(CORE, PLR1);
	
	m_conf = conf;

	std::cout << "Map Init done.\n";
}