8 for(
auto st_con : state.world.state_instance_get_state_building_construction(s)) {
9 if(!st_con.get_is_upgrade()) {
10 float admin_eff = state.world.nation_get_administrative_efficiency(st_con.get_nation());
11 float factory_mod = state.world.nation_get_modifier_values(st_con.get_nation(), sys::national_mod_offsets::factory_cost) + 1.0f;
12 float pop_factory_mod = std::max(0.1f, state.world.nation_get_modifier_values(st_con.get_nation(), sys::national_mod_offsets::factory_owner_cost));
13 float admin_cost_factor = (st_con.get_is_pop_project() ? pop_factory_mod : (2.0f - admin_eff)) * factory_mod;
16 float purchased = 0.0f;
17 auto& goods = state.world.factory_type_get_construction_costs(st_con.get_type());
20 total += goods.commodity_amounts[i] * admin_cost_factor;
21 purchased += st_con.get_purchased_goods().commodity_amounts[i];
24 func(
new_factory{total > 0.0f ? purchased / total : 0.0f, st_con.get_type().
id});
31 for(
auto st_con : state.world.state_instance_get_state_building_construction(s)) {
32 if(st_con.get_is_upgrade()) {
33 float admin_eff = state.world.nation_get_administrative_efficiency(st_con.get_nation());
34 float factory_mod = state.world.nation_get_modifier_values(st_con.get_nation(), sys::national_mod_offsets::factory_cost) + 1.0f;
35 float pop_factory_mod = std::max(0.1f, state.world.nation_get_modifier_values(st_con.get_nation(), sys::national_mod_offsets::factory_owner_cost));
36 float admin_cost_factor = (st_con.get_is_pop_project() ? pop_factory_mod : (2.0f - admin_eff)) * factory_mod;
39 float purchased = 0.0f;
40 auto& goods = state.world.factory_type_get_construction_costs(st_con.get_type());
43 total += goods.commodity_amounts[i] * admin_cost_factor;
44 purchased += st_con.get_purchased_goods().commodity_amounts[i];
47 func(
upgraded_factory{total > 0.0f ? purchased / total : 0.0f, st_con.get_type().
id});
void for_each_new_factory(sys::state &state, dcon::state_instance_id s, F &&func)
void for_each_upgraded_factory(sys::state &state, dcon::state_instance_id s, F &&func)
static constexpr uint32_t set_size