Skip to content
Snippets Groups Projects
Commit e154da63 authored by David Bergström's avatar David Bergström
Browse files

Make it possible to compile on Linux

parent eb52cfbb
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,15 @@ if (MSVC)
set_target_properties(sc2renderer PROPERTIES COMPILE_FLAGS "/W4")
set_target_properties(sc2utils PROPERTIES COMPILE_FLAGS "/W3")
set_target_properties(sc2protocol PROPERTIES COMPILE_FLAGS "/W0")
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT CommandCenter)
endif (MSVC)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT CommandCenter)
if(UNIX AND NOT APPLE)
set_target_properties(libprotobuf PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(sc2api PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(sc2lib PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(sc2renderer PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(sc2utils PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(sc2protocol PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(civetweb-c-library PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
......@@ -60,9 +60,9 @@ PYBIND11_MODULE(library, m)
.def("get_my_units", &IDABot::GetMyUnits)
.def("get_player_race", &IDABot::GetPlayerRace)
.def_property_readonly("base_location_manager", &IDABot::Bases)
.def_property_readonly("tech_tree", &IDABot::TechTree)
.def_property_readonly("tech_tree", &IDABot::GetTechTree)
.def_property_readonly("map_tools", &IDABot::Map)
.def_property_readonly("building_placer", &IDABot::BuildingPlacer)
.def_property_readonly("building_placer", &IDABot::GetBuildingPlacer)
.def_property_readonly("start_location", &IDABot::GetStartLocation)
.def_property_readonly("minerals", &IDABot::GetMinerals)
.def_property_readonly("current_supply", &IDABot::GetCurrentSupply)
......
......@@ -57,4 +57,4 @@ void define_point(pybind11::module &m);
void define_base_location(pybind11::module & m);
void define_tech_tree(pybind11::module & m);
void define_map_tools(pybind11::module & m);
void define_building_placer(pybind11::module & m);
\ No newline at end of file
void define_building_placer(pybind11::module & m);
......@@ -124,7 +124,7 @@ int IDABot::GetCurrentFrame() const
return (int)Observation()->GetGameLoop();
}
const TechTree & IDABot::TechTree() const
const TechTree & IDABot::GetTechTree() const
{
return m_techTree;
}
......@@ -194,7 +194,7 @@ void IDABot::OnError(const std::vector<sc2::ClientError> & client_errors, const
// This is called when the sc2api (Google's API) has an error.
}
BuildingPlacer & IDABot::BuildingPlacer()
BuildingPlacer & IDABot::GetBuildingPlacer()
{
return m_buildingPlacer;
}
......
......@@ -38,13 +38,13 @@ public:
/*
API for students
*/
const TechTree & TechTree() const;
const TechTree & GetTechTree() const;
const BaseLocationManager & Bases() const;
const MapTools & Map() const;
const UnitInfoManager & UnitInfo() const;
CCRace GetPlayerRace(int player) const;
CCPosition GetStartLocation() const;
BuildingPlacer & BuildingPlacer();
BuildingPlacer & GetBuildingPlacer();
int GetCurrentFrame() const;
int GetMinerals() const;
......@@ -62,4 +62,4 @@ public:
const TypeData & Data(const CCUpgrade & type) const;
const TypeData & Data(const MetaType & type) const;
const TypeData & Data(const Unit & unit) const;
};
\ No newline at end of file
};
......@@ -85,7 +85,7 @@ void MyAgent::manageBuilding(std::vector<UnitType> & build_plan)
BuildStatus status{ type, position };
currently_building[worker] = status;
// Reserve the location
BuildingPlacer().reserveTiles(position.x, position.y, type.tileWidth(), type.tileHeight());
GetBuildingPlacer().reserveTiles(position.x, position.y, type.tileWidth(), type.tileHeight());
// Update economy book-keeping
if (type.isRefinery() || type.isResourceDepot())
......@@ -303,7 +303,7 @@ void MyAgent::manageWorkers(std::vector<UnitType> & build_plan)
if (worker.isIdle())
{
BuildStatus status = currently_building[worker];
BuildingPlacer().freeTiles(status.position.x, status.position.y, status.type.tileWidth(), status.type.tileHeight());
GetBuildingPlacer().freeTiles(status.position.x, status.position.y, status.type.tileWidth(), status.type.tileHeight());
currently_building.erase(worker);
assignWork(worker, Assignment::Mineral);
}
......@@ -415,7 +415,7 @@ CCTilePosition MyAgent::getBuildPosition(UnitType & building)
else
{
CCPosition position = Bases().getPlayerStartingBaseLocation(Players::Self)->getPosition();
tile_position = BuildingPlacer().getBuildLocationNear(Util::GetTilePosition(position), building, 1);
tile_position = GetBuildingPlacer().getBuildLocationNear(Util::GetTilePosition(position), building, 1);
}
return tile_position;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment