29 #include <unordered_set>
65 std::vector<std::pair<CommodityId, float>>
req_goods;
70 template<
bool is_const>
73 template<
bool is_serialize>
75 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.cached_id);
76 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.ref_name);
77 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.name);
78 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.flags);
79 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.input_ids);
80 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.output_id);
81 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.req_goods);
82 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.req_technologies);
83 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.num_req_workers);
96 return this->
level > 0.f;
100 constexpr
auto base_cost = 1000.f;
101 return this->
level * base_cost;
109 const auto total_revenue = this->
revenue.get_total();
110 if(total_revenue == 0.f)
return 0.f;
111 const auto total_expenses = this->
expenses.get_total();
112 if(total_expenses == 0.f)
return 0.f;
113 return total_revenue / total_expenses;
143 return total_investments /
total;
147 assert(ownership >= 0.f && ownership <= 1.f);
148 return profit * ownership;
162 sum += foreign.total;
181 float get_total()
const {
193 float get_dividends()
const {
197 float get_total()
const {
204 template<
bool is_const>
207 template<
bool is_serialize>
209 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.total);
215 template<
bool is_const>
218 template<
bool is_serialize>
220 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.estate_private);
221 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.estate_state);
222 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.estate_collective);
223 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.estate_individual);
224 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.estate_foreign);
225 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.budget);
226 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.level);
227 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.production_scale);
228 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.workers);
229 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.req_goods);
230 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.req_goods_for_unit);
231 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj._is_wrking_on_unit);
232 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.revenue.outputs);
233 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.expenses.wages);
234 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.expenses.inputs_cost);
235 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.expenses.state_taxes);
236 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.expenses.state_dividends);
237 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.expenses.pop_dividends);
238 Eng3D::Deser::deser_dynamic<is_serialize>(ar, obj.expenses.private_dividends);
A single province, which is used to simulate economy in a "bulk-tiles" way instead of doing economica...
Roughly a batallion, consisting of approximately 500 soldiers each.
void invest(float amount)
float get_ownership(float total_investments) const
float get_dividends(float profit, float ownership) const
A military outpost, on land serves as a "spawn" place for units When adjacent to a water tile this se...
bool is_working_on_unit() const
std::vector< Investment > estate_foreign
struct Building::@1 expenses
static constexpr auto industry_production_rate
float get_operating_ratio() const
Investment estate_private
float get_upgrade_cost() const
float get_output_amount() const
bool can_build_unit() const
std::vector< std::pair< CommodityId, float > > req_goods_for_unit
Investment estate_individual
struct Building::@0 revenue
float get_max_output_amount(float max_workers) const
std::vector< std::pair< CommodityId, float > > req_goods
void stop_working_on_unit()
UnitTypeId working_unit_type_id
Investment estate_collective
void work_on_unit(const UnitType &unit_type)
bool can_do_output(const Province &province, const std::vector< CommodityId > &inputs) const
Checks if the building can produce output (if it has enough input)
float get_total_investment() const
Type for military outposts.
void can_plot_on_land(bool b)
std::vector< std::pair< CommodityId, float > > req_goods
bool can_build_naval_units() const
void can_plot_on_sea(bool b)
void can_build_air_units(bool b)
bool can_build_land_units() const
bool can_build_military() const
Can this building type build a military unit.
std::vector< CommodityId > input_ids
bool can_plot_on_land() const
void can_build_land_units(bool b)
std::vector< TechnologyId > req_technologies
bool can_build_air_units() const
bool can_plot_on_sea() const
void can_build_naval_units(bool b)
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, Building >::type type
static void deser_dynamic(Eng3D::Deser::Archive &ar, type< is_serialize > &obj)
typename Eng3D::Deser::CondConstType< is_const, Building::Investment >::type type
static void deser_dynamic(Eng3D::Deser::Archive &ar, type< is_serialize > &obj)
typename Eng3D::Deser::CondConstType< is_const, BuildingType >::type type
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.
An entity which can only be referenced by an (presumably) unique Id this is the base class for the ot...
An entity which can be referenced via a ref_name and also via id.
Defines a type of unit, it can be a tank, garrison, infantry, etc this is moddable via a lua script a...