Project Alice
Loading...
Searching...
No Matches
economy.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "container_types.hpp"
4#include "dcon_generated.hpp"
5#include "commands.hpp"
6
7namespace economy {
8
12 both
13};
14
17 int32_t naval_capacity = 1;
18 int32_t colonial_points[8] = { 30, 50, 70, 90, 110, 130, 150, 170 };
19 int32_t colonial_range = 50;
20 int32_t max_level = 6;
21 int32_t time = 1080;
22 float infrastructure = 0.16f;
23 dcon::text_key name;
24 dcon::modifier_id province_modifier;
25 uint16_t padding2 = 0;
26 bool defined = false;
27 uint8_t padding[3] = { 0 };
28};
29
30static_assert(sizeof(building_information) == 104);
31static_assert(sizeof(building_information::cost) == 40);
32static_assert(sizeof(building_information::colonial_points) == 32);
33static_assert(sizeof(building_information::province_modifier) == 2);
34static_assert(sizeof(building_information::name) == 4);
35static_assert(sizeof(building_information::cost)
42 == 92);
43static_assert(sizeof(building_information) ==
56
58 switch(v) {
60 return "railroad";
62 return "fort";
64 return "naval_base";
66 return "bank";
68 return "university";
69 default:
70 return "???";
71 }
72}
74 switch(v) {
76 return "railroad_level";
78 return "fort_level";
80 return "naval_base_level";
82 return "bank_level";
84 return "university_level";
85 default:
86 return "???";
87 }
88}
89
90// base subsistence
91inline constexpr float subsistence_factor = 15.0f;
92inline constexpr float subsistence_score_life = 30.0f;
93inline constexpr float subsistence_score_everyday = 30.0f;
95
98 float craftsmen_fraction = 0.8f;
99 dcon::modifier_id selector_modifier{};
100 dcon::modifier_id immigrator_modifier{};
101};
102static_assert(sizeof(global_economy_state) ==
107
109
110template<typename T>
111auto desired_needs_spending(sys::state const& state, T pop_indices) {
112 // TODO: gather pop types, extract cached needs sum, etc etc
113 return 0.0f;
114}
115
116constexpr inline dcon::commodity_id money(0);
117
118// move to defines later
119inline constexpr float payouts_spending_multiplier = 10.f;
120
121// factories:
122inline constexpr float secondary_employment_output_bonus = 3.f;
123
124inline constexpr float production_scale_delta = 0.1f;
125inline constexpr float factory_closed_threshold = 0.0001f;
126inline constexpr uint32_t price_history_length = 256;
127inline constexpr uint32_t gdp_history_length = 128;
128inline constexpr float price_speed_mod = 0.001f;
129inline constexpr float price_rigging = 0.015f;
130inline constexpr float production_throughput_multiplier = 2.f;
131
132// stockpile related things:
133inline constexpr float stockpile_to_supply = 0.1f;
134inline constexpr float stockpile_spoilage = 0.15f;
135inline constexpr float stockpile_expected_spending_per_commodity = 1000.f;
136
137// trade related
138inline constexpr float merchant_cut_foreign = 0.05f;
139inline constexpr float merchant_cut_domestic = 0.001f;
140
141// greed drives incomes of corresponding pops up
142// while making life worse on average
143// profit cuts change distribution of incomes
144inline constexpr float rgo_owners_cut = 0.2f;
145inline constexpr float factory_owners_cut = 0.5f;
146inline constexpr float factory_sworkers_cut = 0.4f;
147inline constexpr float factory_pworkers_cut = 0.1f;
149inline constexpr float aristocrats_greed = 0.5f;
150inline constexpr float artisans_greed = 0.001f;
151inline constexpr float primary_greed = 2.f;
152inline constexpr float secondary_greed = 20.f;
153// inline constexpr float capitalists_greed = 1.f; // for future use
154
155void presimulate(sys::state& state);
156void sanity_check(sys::state& state);
157
158float price(
159 sys::state const& state,
160 dcon::state_instance_id s,
161 dcon::commodity_id c
162);
163float price(
164 sys::state const& state,
165 dcon::nation_id s,
166 dcon::commodity_id c
167);
168float price(
169 sys::state& state,
170 dcon::commodity_id c
171);
172ve::fp_vector price(
173 sys::state const& state,
174 ve::tagged_vector<dcon::market_id> s,
175 dcon::commodity_id c
176);
177float price(
178 sys::state const& state,
179 dcon::market_id s,
180 dcon::commodity_id c
181);
182
183float supply(
184 sys::state& state,
185 dcon::market_id s,
186 dcon::commodity_id c
187);
188float supply(
189 sys::state& state,
190 dcon::nation_id s,
191 dcon::commodity_id c
192);
193float supply(
194 sys::state& state,
195 dcon::commodity_id c
196);
197
198float demand(
199 sys::state& state,
200 dcon::market_id s,
201 dcon::commodity_id c
202);
203float demand(
204 sys::state& state,
205 dcon::nation_id s,
206 dcon::commodity_id c
207);
208float demand(
209 sys::state& state,
210 dcon::commodity_id c
211);
212
213float consumption(
214 sys::state& state,
215 dcon::market_id s,
216 dcon::commodity_id c
217);
218float consumption(
219 sys::state& state,
220 dcon::nation_id s,
221 dcon::commodity_id c
222);
223float consumption(
224 sys::state& state,
225 dcon::commodity_id c
226);
227
229 sys::state& state,
230 dcon::market_id s,
231 dcon::commodity_id c
232);
234 sys::state& state,
235 dcon::nation_id s,
236 dcon::commodity_id c
237);
239 sys::state& state,
240 dcon::commodity_id c
241);
242
243float market_pool (
244 sys::state& state,
245 dcon::market_id s,
246 dcon::commodity_id c
247);
248float market_pool(
249 sys::state& state,
250 dcon::nation_id s,
251 dcon::commodity_id c
252);
253float market_pool(
254 sys::state& state,
255 dcon::commodity_id c
256);
257
258float export_volume(
259 sys::state& state,
260 dcon::market_id s,
261 dcon::commodity_id c
262);
263float export_volume(
264 sys::state& state,
265 dcon::nation_id s,
266 dcon::commodity_id c
267);
268
270 sys::state& state,
271 dcon::nation_id s,
272 dcon::commodity_id c
273);
274
276 float value;
277 dcon::nation_id nation;
278};
279
281 float volume;
282 dcon::commodity_id commodity;
284};
285
287 sys::state& state,
288 dcon::nation_id s,
289 dcon::commodity_id c
290);
291
292float import_volume(
293 sys::state& state,
294 dcon::market_id s,
295 dcon::commodity_id c
296);
297float import_volume(
298 sys::state& state,
299 dcon::nation_id s,
300 dcon::commodity_id c
301);
303 sys::state& state,
304 dcon::nation_id s,
305 dcon::commodity_id c
306);
307
309 sys::state& state,
310 dcon::nation_id s
311);
312
313float commodity_daily_production_amount(sys::state& state, dcon::commodity_id c);
314
315float effective_tariff_import_rate(sys::state& state, dcon::nation_id n);
316float effective_tariff_export_rate(sys::state& state, dcon::nation_id n);
317
318float rgo_effective_size(sys::state const& state, dcon::nation_id n, dcon::province_id p, dcon::commodity_id c);
319float rgo_total_effective_size(sys::state& state, dcon::nation_id n, dcon::province_id p);
320float rgo_total_employment(sys::state& state, dcon::nation_id n, dcon::province_id p);
321float rgo_full_production_quantity(sys::state const& state, dcon::nation_id n, dcon::province_id p, dcon::commodity_id c);
322float rgo_max_employment(sys::state & state, dcon::nation_id n, dcon::province_id p, dcon::commodity_id c);
323float rgo_total_max_employment(sys::state& state, dcon::nation_id n, dcon::province_id p);
324
325float subsistence_max_pseudoemployment(sys::state& state, dcon::nation_id n, dcon::province_id p);
326
327float factory_max_employment(sys::state const& state, dcon::factory_id f);
328
329bool has_factory(sys::state const& state, dcon::state_instance_id si);
330bool has_building(sys::state const& state, dcon::state_instance_id si, dcon::factory_type_id fac);
331bool is_bankrupt_debtor_to(sys::state& state, dcon::nation_id debt_holder, dcon::nation_id debtor);
332
333//factories
334
335// monetary values
336
337float factory_min_input_available(sys::state const& state, dcon::market_id m, dcon::factory_type_id fac_type);
338float factory_input_total_cost(sys::state const& state, dcon::market_id m, dcon::factory_type_id fac_type);
339float factory_min_e_input_available(sys::state const& state, dcon::market_id m, dcon::factory_type_id fac_type);
340float factory_e_input_total_cost(sys::state const& state, dcon::market_id m, dcon::factory_type_id fac_type);
341
342// abstract modifiers
343
344float factory_input_multiplier(sys::state const& state, dcon::factory_id fac, dcon::nation_id n, dcon::province_id p, dcon::state_instance_id s);
345float factory_throughput_multiplier(sys::state const& state, dcon::factory_type_id fac_type, dcon::nation_id n, dcon::province_id p, dcon::state_instance_id s);
346float factory_output_multiplier(sys::state const& state, dcon::factory_id fac, dcon::nation_id n, dcon::market_id m, dcon::province_id p);
347
348float factory_desired_raw_profit(dcon::factory_id fac, float spendings);
349
350float factory_max_production_scale(sys::state const& state, dcon::factory_id fac, float mobilization_impact, bool occupied);
351float factory_total_employment(sys::state const& state, dcon::factory_id f);
352float factory_primary_employment(sys::state const& state, dcon::factory_id f);
353float factory_secondary_employment(sys::state const& state, dcon::factory_id f);
354
355// misc
356
357int32_t factory_priority(sys::state const& state, dcon::factory_id f);
358void set_factory_priority(sys::state& state, dcon::factory_id f, int32_t priority);
359bool factory_is_profitable(sys::state const& state, dcon::factory_id f);
360
361bool nation_is_constructing_factories(sys::state& state, dcon::nation_id n);
362bool nation_has_closed_factories(sys::state& state, dcon::nation_id n);
363
364void initialize(sys::state& state);
366
367float pop_min_wage_factor(sys::state& state, dcon::nation_id n);
368float farmer_min_wage(sys::state& state, dcon::market_id m, float min_wage_factor);
369float laborer_min_wage(sys::state& state, dcon::market_id m, float min_wage_factor);
370
373 float slaves;
374 float total;
375};
376
377rgo_workers_breakdown rgo_relevant_population(sys::state& state, dcon::province_id p, dcon::nation_id n);
378
380 sys::state& state,
381 dcon::province_id p,
382 dcon::market_id m,
383 dcon::nation_id n,
384 float min_wage,
385 float total_relevant_population
386);
388 sys::state& state,
389 dcon::province_id p,
390 dcon::market_id m,
391 dcon::nation_id n,
392 dcon::commodity_id c
393);
394
395float priority_multiplier(sys::state const& state, dcon::factory_type_id fac_type, dcon::nation_id n);
396float nation_factory_input_multiplier(sys::state const& state, dcon::factory_type_id fac_type, dcon::nation_id n);
397float nation_factory_output_multiplier(sys::state const& state, dcon::factory_type_id fac_type, dcon::nation_id n);
398
400 sys::state& state,
401 dcon::nation_id n,
402 dcon::market_id m,
403 dcon::factory_type_id factory_type
404);
406 sys::state& state,
407 dcon::nation_id n,
408 dcon::market_id m,
409 dcon::factory_type_id factory_type
410);
411
412float factory_type_build_cost(sys::state& state, dcon::nation_id n, dcon::market_id m, dcon::factory_type_id factory_type);
413
416void daily_update(sys::state& state, bool presimulation, float presimulation_stage);
418
420 sys::state& state,
421 ve::tagged_vector<dcon::market_id> markets,
422 ve::tagged_vector<dcon::nation_id> nations,
423 dcon::commodity_id c
424);
426 sys::state& state,
427 dcon::market_id market,
428 dcon::commodity_id c
429);
430
431std::vector<dcon::factory_type_id> commodity_get_factory_types_as_output(sys::state const& state, dcon::commodity_id output_good);
432
433float stockpile_commodity_daily_increase(sys::state& state, dcon::commodity_id c, dcon::nation_id n);
434float global_market_commodity_daily_increase(sys::state& state, dcon::commodity_id c);
435float government_consumption(sys::state& state, dcon::nation_id n, dcon::commodity_id c);
436float nation_factory_consumption(sys::state& state, dcon::nation_id n, dcon::commodity_id c);
437float nation_pop_consumption(sys::state& state, dcon::nation_id n, dcon::commodity_id c);
438float nation_total_imports(sys::state& state, dcon::nation_id n);
439float pop_income(sys::state& state, dcon::pop_id p);
440
441
443 dcon::market_id origin;
444 dcon::market_id target;
445
446 dcon::nation_id origin_nation;
447 dcon::nation_id target_nation;
448
451
454
457
460
463 float distance;
464
467};
468
469trade_and_tariff explain_trade_route_commodity(sys::state& state, dcon::trade_route_id trade_route, dcon::commodity_id cid);
471 dcon::nation_id trade_partner;
472 dcon::commodity_id commodity;
474 float tariff;
475};
476std::vector<trade_breakdown_item> explain_national_tariff(sys::state& state, dcon::nation_id n, bool import_flag, bool export_flag);
477
478float estimate_gold_income(sys::state& state, dcon::nation_id n);
479float estimate_tariff_import_income(sys::state& state, dcon::nation_id n);
480float estimate_tariff_export_income(sys::state& state, dcon::nation_id n);
481float estimate_social_spending(sys::state& state, dcon::nation_id n);
482float estimate_pop_payouts_by_income_type(sys::state& state, dcon::nation_id n, culture::income_type in);
483float estimate_tax_income_by_strata(sys::state& state, dcon::nation_id n, culture::pop_strata ps);
484float estimate_subsidy_spending(sys::state& state, dcon::nation_id n);
485float estimate_diplomatic_balance(sys::state& state, dcon::nation_id n);
486float estimate_diplomatic_income(sys::state& state, dcon::nation_id n);
487float estimate_diplomatic_expenses(sys::state& state, dcon::nation_id n);
488float estimate_domestic_investment(sys::state& state, dcon::nation_id n);
489
490float estimate_land_spending(sys::state& state, dcon::nation_id n);
491float estimate_naval_spending(sys::state& state, dcon::nation_id n);
492float estimate_construction_spending_from_budget(sys::state& state, dcon::nation_id n, float current_budget);
493float estimate_construction_spending(sys::state& state, dcon::nation_id n);
494float estimate_private_construction_spendings(sys::state& state, dcon::nation_id nid);
495float estimate_war_subsidies_spending(sys::state& state, dcon::nation_id n);
496float estimate_reparations_spending(sys::state& state, dcon::nation_id n);
497float estimate_war_subsidies_income(sys::state& state, dcon::nation_id n);
498float estimate_reparations_income(sys::state& state, dcon::nation_id n);
499float estimate_overseas_penalty_spending(sys::state& state, dcon::nation_id n);
500float estimate_stockpile_filling_spending(sys::state& state, dcon::nation_id n);
501
503 dcon::nation_id nation;
504 dcon::state_instance_id state;
507 dcon::factory_type_id type;
508};
509
511 dcon::nation_id nation;
512 dcon::province_id province;
515};
516
517std::vector<full_construction_state> estimate_private_investment_upgrade(sys::state& state, dcon::nation_id nid);
518std::vector<full_construction_state> estimate_private_investment_construct(sys::state& state, dcon::nation_id nid, bool craved);
519std::vector<full_construction_province> estimate_private_investment_province(sys::state& state, dcon::nation_id nid);
520
521// NOTE: used to estimate how much you will pay if you were to subsidize a particular nation,
522// *not* how much you are paying at the moment
523float estimate_war_subsidies(sys::state& state, dcon::nation_fat_id target, dcon::nation_fat_id source);
524
525float estimate_subject_payments_paid(sys::state& state, dcon::nation_id n);
526float estimate_subject_payments_received(sys::state& state, dcon::nation_id o);
527
528float estimate_daily_income(sys::state& state, dcon::nation_id n);
529
531 float progress = 0.0f; // in range [0,1)
533};
534
536construction_status factory_upgrade(sys::state& state, dcon::factory_id f);
537
539 float progress = 0.0f;
540 dcon::factory_type_id type;
541};
542
544 float progress = 0.0f;
545 dcon::factory_type_id type;
546};
547
548bool state_contains_constructed_factory(sys::state& state, dcon::state_instance_id si, dcon::factory_type_id ft);
549bool state_contains_factory(sys::state& state, dcon::state_instance_id s, dcon::factory_type_id ft);
550int32_t state_factory_count(sys::state& state, dcon::state_instance_id sid, dcon::nation_id n);
551float unit_construction_progress(sys::state& state, dcon::province_land_construction_id c);
552float unit_construction_progress(sys::state& state, dcon::province_naval_construction_id c);
553void try_add_factory_to_state(sys::state& state, dcon::state_instance_id s, dcon::factory_type_id t);
554void bound_budget_settings(sys::state& state, dcon::nation_id n);
555
560
561float gdp_adjusted(sys::state& state, dcon::nation_id n);
562float gdp_adjusted(sys::state& state, dcon::market_id n);
563
564void prune_factories(sys::state& state); // get rid of closed factories in full states
565void go_bankrupt(sys::state& state, dcon::nation_id n);
566dcon::modifier_id get_province_selector_modifier(sys::state& state);
567dcon::modifier_id get_province_immigrator_modifier(sys::state& state);
568
569bool can_take_loans(sys::state& state, dcon::nation_id n);
570float interest_payment(sys::state& state, dcon::nation_id n);
571float max_loan(sys::state& state, dcon::nation_id n);
572
573float estimate_investment_pool_daily_loss(sys::state& state, dcon::nation_id n);
574
577} // namespace economy
float estimate_reparations_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8081
bool state_contains_factory(sys::state &state, dcon::state_instance_id s, dcon::factory_type_id ft)
Definition: economy.cpp:8328
void initialize(sys::state &state)
Definition: economy.cpp:1483
float global_market_commodity_daily_increase(sys::state &state, dcon::commodity_id c)
Definition: economy.cpp:877
constexpr float factory_pworkers_cut
Definition: economy.hpp:147
float factory_input_total_cost(sys::state const &state, dcon::market_id m, dcon::factory_type_id fac_type)
Definition: economy.cpp:2263
float factory_throughput_multiplier(sys::state const &state, dcon::factory_type_id fac_type, dcon::nation_id n, dcon::province_id p, dcon::state_instance_id s)
Definition: economy.cpp:2362
float estimate_war_subsidies(sys::state &state, dcon::nation_fat_id target, dcon::nation_fat_id source)
Definition: economy.cpp:8210
float factory_max_production_scale(sys::state const &state, dcon::factory_id fac, float mobilization_impact, bool occupied)
Definition: economy.cpp:2400
dcon::modifier_id get_province_immigrator_modifier(sys::state &state)
Definition: economy.cpp:8919
constexpr float subsistence_score_life
Definition: economy.hpp:92
constexpr float factory_owners_cut
Definition: economy.hpp:145
float factory_min_e_input_available(sys::state const &state, dcon::market_id m, dcon::factory_type_id fac_type)
Definition: economy.cpp:2276
float estimate_subsidy_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8067
float factory_type_output_cost(sys::state &state, dcon::nation_id n, dcon::market_id m, dcon::factory_type_id factory_type)
Definition: economy.cpp:7578
trade_and_tariff explain_trade_route_commodity(sys::state &state, dcon::trade_route_id trade_route, dcon::commodity_id cid)
Definition: economy.cpp:7765
float government_consumption(sys::state &state, dcon::nation_id n, dcon::commodity_id c)
Definition: economy.cpp:7524
float estimate_social_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:7990
float estimate_subject_payments_paid(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8218
std::vector< full_construction_state > estimate_private_investment_upgrade(sys::state &state, dcon::nation_id nid)
Definition: economy.cpp:4943
construction_status province_building_construction(sys::state &state, dcon::province_id p, province_building_type t)
Definition: economy.cpp:8268
float rgo_total_effective_size(sys::state &state, dcon::nation_id n, dcon::province_id p)
Definition: economy.cpp:1802
float nation_total_imports(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:7712
float factory_e_input_total_cost(sys::state const &state, dcon::market_id m, dcon::factory_type_id fac_type)
Definition: economy.cpp:2294
float consumption(sys::state &state, dcon::market_id s, dcon::commodity_id c)
Definition: economy.cpp:325
float factory_desired_raw_profit(dcon::factory_id fac, float spendings)
Definition: economy.cpp:2408
bool state_contains_constructed_factory(sys::state &state, dcon::state_instance_id s, dcon::factory_type_id ft)
Definition: economy.cpp:8315
float estimate_construction_spending_from_budget(sys::state &state, dcon::nation_id n, float current_budget)
Definition: economy.cpp:3433
bool has_building(sys::state const &state, dcon::state_instance_id si, dcon::factory_type_id fac)
Definition: economy.cpp:1166
float factory_max_employment(sys::state const &state, dcon::factory_id f)
Definition: economy.cpp:2007
void update_factory_employment(sys::state &state)
Definition: economy.cpp:2044
constexpr float merchant_cut_foreign
Definition: economy.hpp:138
bool is_bankrupt_debtor_to(sys::state &state, dcon::nation_id debt_holder, dcon::nation_id debtor)
Definition: economy.cpp:1180
int32_t state_factory_count(sys::state &state, dcon::state_instance_id sid, dcon::nation_id n)
Definition: economy.cpp:8347
float estimate_diplomatic_expenses(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8138
std::string_view province_building_type_get_name(economy::province_building_type v)
Definition: economy.hpp:57
float estimate_diplomatic_balance(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8126
void prune_factories(sys::state &state)
Definition: economy.cpp:8876
float supply(sys::state &state, dcon::market_id s, dcon::commodity_id c)
Definition: economy.cpp:206
constexpr uint32_t gdp_history_length
Definition: economy.hpp:127
float estimate_pop_payouts_by_income_type(sys::state &state, dcon::nation_id n, culture::income_type in)
Definition: economy.cpp:8023
float estimate_domestic_investment(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8147
constexpr float subsistence_score_total
Definition: economy.hpp:94
int32_t previous_price_record_index(sys::state &state)
Definition: economy.cpp:828
rgo_workers_breakdown rgo_relevant_population(sys::state &state, dcon::province_id p, dcon::nation_id n)
Definition: economy.cpp:2682
constexpr float artisans_greed
Definition: economy.hpp:150
float factory_min_input_available(sys::state const &state, dcon::market_id m, dcon::factory_type_id fac_type)
Definition: economy.cpp:2242
float farmer_min_wage(sys::state &state, dcon::market_id m, float min_wage_factor)
Definition: economy.cpp:65
float factory_input_multiplier(sys::state const &state, dcon::factory_id fac, dcon::nation_id n, dcon::province_id p, dcon::state_instance_id s)
Definition: economy.cpp:2329
float estimate_overseas_penalty_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:4041
float nation_factory_consumption(sys::state &state, dcon::nation_id n, dcon::commodity_id c)
Definition: economy.cpp:7608
trade_volume_data_detailed import_volume_detailed(sys::state &state, dcon::nation_id s, dcon::commodity_id c)
Definition: economy.cpp:599
constexpr float stockpile_to_supply
Definition: economy.hpp:133
constexpr float factory_workers_cut
Definition: economy.hpp:148
bool has_factory(sys::state const &state, dcon::state_instance_id si)
Definition: economy.cpp:895
float max_loan(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:816
trade_volume_data_detailed export_volume_detailed(sys::state &state, dcon::nation_id s, dcon::commodity_id c)
Definition: economy.cpp:492
float estimate_construction_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:3692
float estimate_private_construction_spendings(sys::state &state, dcon::nation_id nid)
Definition: economy.cpp:3701
float estimate_war_subsidies_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8071
construction_status factory_upgrade(sys::state &state, dcon::factory_id f)
Definition: economy.cpp:8286
void presimulate(sys::state &state)
Definition: economy.cpp:1151
constexpr float price_rigging
Definition: economy.hpp:129
void update_rgo_employment(sys::state &state)
Definition: economy.cpp:1901
void daily_update(sys::state &state, bool presimulation, float presimulation_stage)
Definition: economy.cpp:5363
float estimate_land_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8177
float rgo_total_employment(sys::state &state, dcon::nation_id n, dcon::province_id p)
Definition: economy.cpp:1814
constexpr float merchant_cut_domestic
Definition: economy.hpp:139
command::budget_settings_data budget_minimums(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8703
commodity_production_type
Definition: economy.hpp:9
@ both
Definition: economy.hpp:12
@ derivative
Definition: economy.hpp:11
@ primary
Definition: economy.hpp:10
float estimate_daily_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8660
float price(sys::state const &state, dcon::state_instance_id s, dcon::commodity_id c)
Definition: economy.cpp:150
float estimate_tariff_import_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:7958
constexpr uint32_t price_history_length
Definition: economy.hpp:126
float rgo_total_max_employment(sys::state &state, dcon::nation_id n, dcon::province_id p)
Definition: economy.cpp:1826
void regenerate_unsaved_values(sys::state &state)
Definition: economy.cpp:7485
constexpr dcon::commodity_id money(0)
float domestic_trade_volume(sys::state &state, dcon::nation_id s, dcon::commodity_id c)
Definition: economy.cpp:230
float laborer_min_wage(sys::state &state, dcon::market_id m, float min_wage_factor)
Definition: economy.cpp:70
bool can_take_loans(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:794
int32_t factory_priority(sys::state const &state, dcon::factory_id f)
Definition: economy.cpp:1885
dcon::modifier_id get_province_selector_modifier(sys::state &state)
Definition: economy.cpp:8915
float unit_construction_progress(sys::state &state, dcon::province_land_construction_id c)
Definition: economy.cpp:8362
constexpr float stockpile_expected_spending_per_commodity
Definition: economy.hpp:135
constexpr float factory_closed_threshold
Definition: economy.hpp:125
float estimate_investment_pool_daily_loss(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8970
int32_t most_recent_price_record_index(sys::state &state)
Definition: economy.cpp:825
float factory_type_build_cost(sys::state &state, dcon::nation_id n, dcon::market_id m, dcon::factory_type_id factory_type)
Definition: economy.cpp:7559
std::vector< trade_breakdown_item > explain_national_tariff(sys::state &state, dcon::nation_id n, bool import_flag, bool export_flag)
Definition: economy.cpp:7883
float rgo_expected_worker_norm_profit(sys::state &state, dcon::province_id p, dcon::market_id m, dcon::nation_id n, dcon::commodity_id c)
Definition: economy.cpp:2764
float import_volume(sys::state &state, dcon::market_id s, dcon::commodity_id c)
Definition: economy.cpp:578
constexpr float factory_sworkers_cut
Definition: economy.hpp:146
void try_add_factory_to_state(sys::state &state, dcon::state_instance_id s, dcon::factory_type_id t)
Definition: economy.cpp:8669
bool nation_is_constructing_factories(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:1186
float pop_income(sys::state &state, dcon::pop_id p)
Definition: economy.cpp:7746
void sanity_check(sys::state &state)
Definition: economy.cpp:136
float rgo_effective_size(sys::state const &state, dcon::nation_id n, dcon::province_id p, dcon::commodity_id c)
Definition: economy.cpp:1780
float estimate_diplomatic_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8132
constexpr float payouts_spending_multiplier
Definition: economy.hpp:119
float estimate_subject_payments_received(sys::state &state, dcon::nation_id o)
Definition: economy.cpp:8242
float nation_factory_output_multiplier(sys::state const &state, dcon::factory_type_id fac_type, dcon::nation_id n)
Definition: economy.cpp:2322
constexpr float primary_greed
Definition: economy.hpp:151
float effective_tariff_import_rate(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:1737
float estimate_war_subsidies_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8097
float demand_satisfaction(sys::state &state, dcon::market_id s, dcon::commodity_id c)
Definition: economy.cpp:395
float commodity_daily_production_amount(sys::state &state, dcon::commodity_id c)
Definition: economy.cpp:867
std::string_view province_building_type_get_level_text(economy::province_building_type v)
Definition: economy.hpp:73
float rgo_desired_worker_norm_profit(sys::state &state, dcon::province_id p, dcon::market_id m, dcon::nation_id n, float min_wage, float total_relevant_population)
Definition: economy.cpp:2698
constexpr int32_t max_building_types
Definition: constants.hpp:579
constexpr float subsistence_factor
Definition: economy.hpp:91
constexpr float production_scale_delta
Definition: economy.hpp:124
bool factory_is_profitable(sys::state const &state, dcon::factory_id f)
Definition: economy.cpp:1892
auto desired_needs_spending(sys::state const &state, T pop_indices)
Definition: economy.hpp:111
std::vector< full_construction_state > estimate_private_investment_construct(sys::state &state, dcon::nation_id nid, bool craved)
Definition: economy.cpp:5051
float estimate_reparations_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8109
float nation_factory_input_multiplier(sys::state const &state, dcon::factory_type_id fac_type, dcon::nation_id n)
Definition: economy.cpp:2313
int32_t most_recent_gdp_record_index(sys::state &state)
Definition: economy.cpp:832
float estimate_naval_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8194
float subsistence_max_pseudoemployment(sys::state &state, dcon::nation_id n, dcon::province_id p)
Definition: economy.cpp:1810
void go_bankrupt(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8923
void bound_budget_settings(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8812
float average_capitalists_luxury_cost(sys::state &state, dcon::nation_id s)
Definition: economy.cpp:432
float factory_secondary_employment(sys::state const &state, dcon::factory_id f)
Definition: economy.cpp:2020
constexpr float production_throughput_multiplier
Definition: economy.hpp:130
constexpr float stockpile_spoilage
Definition: economy.hpp:134
float market_pool(sys::state &state, dcon::market_id s, dcon::commodity_id c)
Definition: economy.cpp:360
float rgo_max_employment(sys::state &state, dcon::nation_id n, dcon::province_id p, dcon::commodity_id c)
Definition: economy.cpp:1822
float pop_min_wage_factor(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:16
void resolve_constructions(sys::state &state)
Definition: economy.cpp:8426
float priority_multiplier(sys::state const &state, dcon::factory_type_id fac_type, dcon::nation_id n)
Definition: economy.cpp:2308
float estimate_tax_income_by_strata(sys::state &state, dcon::nation_id n, culture::pop_strata ps)
Definition: economy.cpp:8054
float factory_total_employment(sys::state const &state, dcon::factory_id f)
Definition: economy.cpp:2029
float export_volume(sys::state &state, dcon::market_id s, dcon::commodity_id c)
Definition: economy.cpp:470
float estimate_stockpile_filling_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:4016
constexpr float rgo_owners_cut
Definition: economy.hpp:144
float stockpile_commodity_daily_increase(sys::state &state, dcon::commodity_id c, dcon::nation_id n)
Definition: economy.cpp:872
float estimate_tariff_export_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:7974
constexpr float secondary_greed
Definition: economy.hpp:152
constexpr float secondary_employment_output_bonus
Definition: economy.hpp:122
constexpr float price_speed_mod
Definition: economy.hpp:128
float rgo_full_production_quantity(sys::state &state, dcon::nation_id n, dcon::province_id p, dcon::commodity_id c)
Definition: economy.cpp:2228
float demand(sys::state &state, dcon::market_id s, dcon::commodity_id c)
Definition: economy.cpp:283
province_building_type
Definition: constants.hpp:578
float interest_payment(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:808
std::vector< dcon::factory_type_id > commodity_get_factory_types_as_output(sys::state const &state, dcon::commodity_id output_good)
Definition: economy.cpp:883
void set_factory_priority(sys::state &state, dcon::factory_id f, int32_t priority)
Definition: economy.cpp:1888
float factory_primary_employment(sys::state const &state, dcon::factory_id f)
Definition: economy.cpp:2011
worker_effect
Definition: economy.hpp:108
bool nation_has_closed_factories(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:1190
float gdp_adjusted(sys::state &state, dcon::market_id n)
Definition: economy.cpp:846
float nation_pop_consumption(sys::state &state, dcon::nation_id n, dcon::commodity_id c)
Definition: economy.cpp:7688
float effective_tariff_export_rate(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:1742
std::vector< full_construction_province > estimate_private_investment_province(sys::state &state, dcon::nation_id nid)
Definition: economy.cpp:5205
int32_t previous_gdp_record_index(sys::state &state)
Definition: economy.cpp:836
constexpr float subsistence_score_everyday
Definition: economy.hpp:93
ve::fp_vector base_artisan_profit(sys::state &state, T markets, S nations, dcon::commodity_id c)
Definition: economy.cpp:1249
float estimate_gold_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:7942
float factory_type_input_cost(sys::state &state, dcon::nation_id n, dcon::market_id m, dcon::factory_type_id factory_type)
Definition: economy.cpp:7591
command::budget_settings_data budget_maximums(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8745
float factory_output_multiplier(sys::state const &state, dcon::factory_id fac, dcon::nation_id n, dcon::market_id m, dcon::province_id p)
Definition: economy.cpp:2386
constexpr float aristocrats_greed
Definition: economy.hpp:149
uint uint32_t
uchar uint8_t
dcon::modifier_id province_modifier
Definition: economy.hpp:24
economy::commodity_set cost
Definition: economy.hpp:16
province_building_type type
Definition: economy.hpp:514
dcon::factory_type_id type
Definition: economy.hpp:507
dcon::state_instance_id state
Definition: economy.hpp:504
dcon::modifier_id selector_modifier
Definition: economy.hpp:99
building_information building_definitions[max_building_types]
Definition: economy.hpp:97
dcon::modifier_id immigrator_modifier
Definition: economy.hpp:100
dcon::factory_type_id type
Definition: economy.hpp:540
dcon::nation_id target_nation
Definition: economy.hpp:447
dcon::market_id target
Definition: economy.hpp:444
dcon::market_id origin
Definition: economy.hpp:443
dcon::nation_id origin_nation
Definition: economy.hpp:446
dcon::commodity_id commodity
Definition: economy.hpp:472
dcon::nation_id trade_partner
Definition: economy.hpp:471
nation_enriched_float targets[5]
Definition: economy.hpp:283
dcon::factory_type_id type
Definition: economy.hpp:545
Holds important data about the game world, state, and other data regarding windowing,...