29 #include <unordered_set>
33 #include <glm/vec3.hpp>
34 #include <glm/vec2.hpp>
35 #include "eng3d/rectangle.hpp"
53 for(
const auto& pop :
pops)
60 for(
const auto& pop :
pops)
61 total += pop.militancy;
62 return total /
pops.size();
85 for(
const auto& pop :
pops)
132 template<
bool is_const>
134 template<
bool is_serialize>
136 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.attacker_casualties);
137 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.defender_casualties);
138 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.unit_ids);
139 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.attacker_nations_ids);
140 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.defender_nations_ids);
141 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.active);
146 template<
bool is_const>
148 template<
bool is_serialize>
150 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.cached_id);
151 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.name);
152 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.ref_name);
153 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.color);
154 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.box_area);
155 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.owner_id);
156 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.nuclei);
157 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.rgo_size);
158 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.neighbour_ids);
159 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.products);
160 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.pops);
161 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.buildings);
162 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.controller_id);
163 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.base_attractive);
164 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.languages);
165 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.religions);
166 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.terrain_type_id);
167 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.battle);
173 std::vector<ProvinceId> recently_changed_owner;
174 std::vector<ProvinceId> recently_changed_control;
180 recently_changed_owner.push_back(province_id);
184 recently_changed_control.push_back(province_id);
188 recently_changed_owner.clear();
189 recently_changed_control.clear();
193 return recently_changed_owner;
197 return recently_changed_control;
201 return !recently_changed_owner.empty() || !recently_changed_control.empty();
A single province, which is used to simulate economy in a "bulk-tiles" way instead of doing economica...
std::vector< float > religions
Percentage of each religion prescence on the pops, from 0 to 1.
glm::vec2 get_pos() const
std::vector< Building > & get_buildings()
float get_attractiveness(const Pop &pop) const
float average_militancy() const
std::array< Pop, 7 > pops
void cancel_construction_project()
std::vector< Product > products
std::vector< ProvinceId > neighbour_ids
bool is_neighbour(const Province &province) const
void add_building(const BuildingType &building_type)
const std::vector< Building > & get_buildings() const
struct Province::Battle battle
std::vector< uint32_t > rgo_size
std::vector< NationId > nuclei
std::vector< float > languages
Percentage of each languages from 0 to 1.
bool is_populated() const
TerrainTypeId terrain_type_id
float euclidean_distance(const Province &other_province, glm::vec2 world_size, float radius) const
std::vector< Building > buildings
const std::vector< ProvinceId > & get_changed_control_provinces() const
ProvinceManager()=default
const std::vector< ProvinceId > & get_changed_owner_provinces() const
bool is_provinces_changed() const
void mark_province_control_changed(ProvinceId province_id)
void mark_province_owner_changed(ProvinceId province_id)
Type for military outposts.
Base class that serves as archiver, stores (in memory) the data required for serialization/deserializ...
static void deser_dynamic(Eng3D::Deser::Archive &ar, type< is_serialize > &obj)
typename Eng3D::Deser::CondConstType< is_const, Province >::type type
typename Eng3D::Deser::CondConstType< is_const, Province::Battle >::type type
static void deser_dynamic(Eng3D::Deser::Archive &ar, type< is_serialize > &obj)
A serializer (base class) which can be used to serialize objects and create per-object optimized clas...
A reference to a string on the global string pool.
std::vector< UnitId > get_attacker_unit_ids() const
float defender_casualties
float attacker_casualties
std::vector< NationId > defender_nations_ids
std::vector< UnitId > unit_ids
std::vector< UnitId > get_defender_unit_ids() const
std::vector< NationId > attacker_nations_ids
An entity which can be referenced via a ref_name and also via id.