31 #include <glm/vec3.hpp>
32 #include <glm/gtc/constants.hpp>
33 #include <glm/trigonometric.hpp>
34 #include <glm/geometric.hpp>
36 #include "eng3d/utils.hpp"
50 this->
buildings[building_type].level += 1.f;
56 building.stop_working_on_unit();
62 const auto cos_angle = glm::dot(sphere_coord1, sphere_coord2) / (radius * radius);
63 const auto angle = glm::acos(glm::clamp(cos_angle, -1.f, 1.f));
64 const auto distance = angle * radius;
74 std::vector<UnitId> v;
76 for(
const auto unit_id : this->
unit_ids)
77 if(units[unit_id].
owner_id == nation_id)
79 std::sort(v.begin(), v.end());
80 v.erase(std::unique(v.begin(), v.end()), v.end());
86 std::vector<UnitId> v;
87 for(
const auto nation_id : this->defender_nations_ids)
88 for(
const auto unit_id : this->unit_ids)
89 if(units[unit_id].
owner_id == nation_id)
91 std::sort(v.begin(), v.end());
92 v.erase(std::unique(v.begin(), v.end()), v.end());
A single province, which is used to simulate economy in a "bulk-tiles" way instead of doing economica...
glm::vec2 get_pos() const
float get_attractiveness(const Pop &pop) const
void cancel_construction_project()
std::vector< ProvinceId > neighbour_ids
bool is_neighbour(const Province &province) const
void add_building(const BuildingType &building_type)
float euclidean_distance(const Province &other_province, glm::vec2 world_size, float radius) const
std::vector< Building > buildings
Eng3D::Freelist< Unit > units
glm::vec3 get_sphere_coord(glm::vec2 size, glm::vec2 pos, float radius)
Type for military outposts.
std::vector< std::pair< CommodityId, float > > req_goods
std::vector< UnitId > get_attacker_unit_ids() const
std::vector< UnitId > unit_ids
std::vector< UnitId > get_defender_unit_ids() const
std::vector< NationId > attacker_nations_ids