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