19 dcon::state_instance_id
data{};
27 auto content = retrieve<dcon::factory_id>(
state,
parent);
28 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
29 auto mid =
state.world.state_instance_get_market_from_local_market(sid);
31 state.world.factory_get_primary_employment(content)
33 *
state.world.market_get_labor_unskilled_demand_satisfaction(mid)
42 auto fid = retrieve<dcon::factory_id>(
state,
parent);
43 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
44 auto mid =
state.world.state_instance_get_market_from_local_market(sid);
53 state.world.pop_type_get_name(
state.culture_definitions.primary_factory_worker)
57 state.world.factory_get_primary_employment(fid)
59 *
state.economy_definitions.craftsmen_fraction
60 *
state.world.market_get_labor_unskilled_demand_satisfaction(mid))
71 state.world.factory_get_secondary_employment(fid)
73 * (1.0f -
state.economy_definitions.craftsmen_fraction)
74 *
state.world.market_get_labor_skilled_demand_satisfaction(mid))
86 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
87 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
89 auto rules =
state.world.nation_get_combined_issue_rules(n);
94 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
119 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
120 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
121 if(n !=
state.local_player_nation)
154 auto fid = retrieve<dcon::factory_id>(
state,
parent);
156 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
159 fat.get_building_type().id,
true);
168 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
169 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
170 for(
auto p :
state.world.state_definition_get_abstract_state_membership_as_state(
state.world.state_instance_get_definition(sid))) {
171 for(
auto fac : p.get_province().get_factory_location()) {
173 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true)) {
175 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true);
182 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
183 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
184 for(
auto p :
state.world.state_definition_get_abstract_state_membership_as_state(
state.world.state_instance_get_definition(sid))) {
185 for(
auto fac : p.get_province().get_factory_location()) {
186 if(fac.get_factory().get_primary_employment() >= 0.95f && fac.get_factory().get_production_scale() > 0.8f) {
188 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true)) {
190 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true);
198 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
199 for(
auto p :
state.world.nation_get_province_ownership(n)) {
200 for(
auto fac : p.get_province().get_factory_location()) {
202 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true)) {
204 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true);
211 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
212 for(
auto p :
state.world.nation_get_province_ownership(n)) {
213 for(
auto fac : p.get_province().get_factory_location()) {
214 if(fac.get_factory().get_primary_employment() >= 0.95f && fac.get_factory().get_production_scale() > 0.8f) {
216 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true)) {
218 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true);
226 auto fid = retrieve<dcon::factory_id>(
state,
parent);
227 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
228 for(
auto p :
state.world.nation_get_province_ownership(n)) {
229 for(
auto fac : p.get_province().get_factory_location()) {
230 if(fac.get_factory().get_building_type() ==
state.world.factory_get_building_type(fid)
232 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true)) {
234 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true);
241 auto fid = retrieve<dcon::factory_id>(
state,
parent);
242 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
243 for(
auto p :
state.world.nation_get_province_ownership(n)) {
244 for(
auto fac : p.get_province().get_factory_location()) {
245 if(fac.get_factory().get_building_type() ==
state.world.factory_get_building_type(fid)
246 && fac.get_factory().get_primary_employment() >= 0.95f && fac.get_factory().get_production_scale() > 0.8f) {
248 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true)) {
250 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true);
258 auto fid = retrieve<dcon::factory_id>(
state,
parent);
260 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
265 auto fid = retrieve<dcon::factory_id>(
state,
parent);
266 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
267 auto type =
state.world.factory_get_building_type(fid);
271 bool is_not_upgrading =
true;
272 for(
auto p :
state.world.state_instance_get_state_building_construction(sid)) {
273 if(p.get_type() ==
type)
274 is_not_upgrading =
false;
276 if(is_not_upgrading) {
286 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
288 const dcon::state_instance_id sid = retrieve<dcon::state_instance_id>(
state,
parent);
289 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
291 auto type =
state.world.factory_get_building_type(fid);
294 bool is_not_upgrading =
true;
295 for(
auto p :
state.world.state_instance_get_state_building_construction(sid)) {
296 if(p.get_type() ==
type)
297 is_not_upgrading =
false;
299 if(!is_not_upgrading) {
307 bool is_civ =
state.world.nation_get_is_civilized(
state.local_player_nation);
310 bool state_is_not_colonial = !
state.world.province_get_is_colonial(
state.world.state_instance_get_capital(sid));
313 bool is_activated =
state.world.nation_get_active_building(n,
type) ==
true ||
state.world.factory_type_get_is_available_from_start(
type);
315 if(n !=
state.local_player_nation) {
316 bool gp_condition = (
state.world.nation_get_is_great_power(
state.local_player_nation) ==
true &&
317 state.world.nation_get_is_great_power(n) ==
false);
322 auto rules =
state.world.nation_get_combined_issue_rules(n);
329 auto rules =
state.world.nation_get_combined_issue_rules(
state.local_player_nation);
343 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
348 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
361 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
362 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
363 if(n ==
state.local_player_nation) {
376 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
377 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
378 auto rules =
state.world.nation_get_combined_issue_rules(n);
380 frame =
state.world.factory_get_subsidized(fid) ? 1 : 0;
384 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
385 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
387 if(fat.get_subsidized()) {
404 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
405 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
406 if(n ==
state.local_player_nation) {
426 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
427 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
432 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
433 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
442 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
443 if(n ==
state.local_player_nation) {
458 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
459 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
466 auto prov = retrieve<dcon::province_id>(
state,
parent);
472 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
473 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
487 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
488 if(n ==
state.local_player_nation) {
500 std::variant<std::monostate, economy::upgraded_factory, economy::new_factory>
activity;
517 auto nf = retrieve< economy::new_factory>(
state,
parent);
518 auto si = retrieve<dcon::state_instance_id>(
state,
parent);
521 for(
auto p :
state.world.state_instance_get_state_building_construction(si)) {
522 if(p.get_type() == nf.type) {
523 float admin_eff =
state.world.nation_get_administrative_efficiency(p.get_nation());
524 float factory_mod =
state.world.nation_get_modifier_values(p.get_nation(), sys::national_mod_offsets::factory_cost) + 1.0f;
525 float pop_factory_mod = std::max(0.1f,
state.world.nation_get_modifier_values(p.get_nation(), sys::national_mod_offsets::factory_owner_cost));
526 float admin_cost_factor = (p.get_is_pop_project() ? pop_factory_mod : (2.0f - admin_eff)) * factory_mod;
528 auto&
goods =
state.world.factory_type_get_construction_costs(nf.type);
529 auto& cgoods = p.get_purchased_goods();
532 if(
goods.commodity_type[i]) {
534 auto cid =
goods.commodity_type[i];
535 std::string padding = cid.index() < 10 ?
"0" :
"";
536 std::string description =
"@$" + padding + std::to_string(cid.index());
562 auto nf = retrieve<economy::upgraded_factory>(
state,
parent);
563 auto si = retrieve<dcon::state_instance_id>(
state,
parent);
566 for(
auto p :
state.world.state_instance_get_state_building_construction(si)) {
567 if(p.get_type() == nf.type) {
568 float admin_eff =
state.world.nation_get_administrative_efficiency(p.get_nation());
569 float factory_mod =
state.world.nation_get_modifier_values(p.get_nation(), sys::national_mod_offsets::factory_cost) + 1.0f;
570 float pop_factory_mod = std::max(0.1f,
state.world.nation_get_modifier_values(p.get_nation(), sys::national_mod_offsets::factory_owner_cost));
571 float admin_cost_factor = (p.get_is_pop_project() ? pop_factory_mod : (2.0f - admin_eff)) * factory_mod;
573 auto&
goods =
state.world.factory_type_get_construction_costs(nf.type);
574 auto& cgoods = p.get_purchased_goods();
577 if(
goods.commodity_type[i]) {
579 auto cid =
goods.commodity_type[i];
580 std::string padding = cid.index() < 10 ?
"0" :
"";
581 std::string description =
"@$" + padding + std::to_string(cid.index());
603 auto fid = retrieve<dcon::factory_id>(
state,
parent);
606 dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
607 auto p =
state.world.factory_get_province_from_factory_location(retrieve<dcon::factory_id>(
state,
parent));
608 auto p_fat = fatten(
state.world, p);
609 auto sdef =
state.world.abstract_state_membership_get_state(
state.world.province_get_abstract_state_membership(p));
610 dcon::state_instance_id s{};
611 state.world.for_each_state_instance([&](dcon::state_instance_id
id) {
612 if(
state.world.state_instance_get_definition(
id) == sdef)
615 auto market =
state.world.state_instance_get_market_from_local_market(s);
620 auto cap_prov =
state.world.nation_get_capital(n);
621 auto cap_continent =
state.world.province_get_continent(cap_prov);
622 auto cap_region =
state.world.province_get_connected_region_id(cap_prov);
625 auto fac = fatten(
state.world, fid);
626 auto type =
state.world.factory_get_building_type(fid);
628 auto& inputs =
type.get_inputs();
629 auto& einputs =
type.get_efficiency_inputs();
641 float e_input_multiplier =
state.world.nation_get_modifier_values(n, sys::national_mod_offsets::factory_maintenance) + 1.0f;
645 float bonus_profit_thanks_to_max_e_input = fac.get_building_type().get_output_amount()
647 * throughput_multiplier
649 * min_input_available
653 if(bonus_profit_thanks_to_max_e_input < e_input_total * e_input_multiplier * input_multiplier)
654 min_e_input_available = 0.f;
660 p_fat.get_nation_from_province_control() != n
663 float effective_production_scale = std::min(fac.get_production_scale() * fac.get_level(), max_production_scale);
665 auto amount = (0.75f + 0.25f * min_e_input_available) * min_input_available *
state.world.factory_get_production_scale(fid);
687 float total_expenses = 0.f;
689 int position_demand_sat = 100;
690 int position_amount = 180;
691 int position_cost = 250;
693 auto input_cost_line = [&] (
694 dcon::commodity_id cid,
703 demand_satisfaction.x_position += position_demand_sat;
709 std::string padding = cid.index() < 10 ?
"0" :
"";
710 std::string description =
"@$" + padding + std::to_string(cid.index());
715 auto sat =
state.world.market_get_demand_satisfaction(market, cid);
725 * throughput_multiplier
726 * min_input_available
727 * effective_production_scale;
733 total_expenses += cost;
742 auto e_input_cost_line = [&](
743 dcon::commodity_id cid,
752 demand_satisfaction.x_position += position_demand_sat;
757 std::string padding = cid.index() < 10 ?
"0" :
"";
758 std::string description =
"@$" + padding + std::to_string(cid.index());
762 auto sat =
state.world.market_get_demand_satisfaction(market, cid);
771 * input_multiplier * e_input_multiplier
772 * min_e_input_available
773 * min_input_available
774 * effective_production_scale;
780 total_expenses += cost;
789 auto named_money_line = [&](
790 std::string_view loc,
797 cost.x_position += position_cost;
807 auto output_cost_line = [&](
808 dcon::commodity_id cid,
816 amount.x_position += position_amount;
817 cost.x_position += position_cost;
821 std::string padding = cid.index() < 10 ?
"0" :
"";
822 std::string description =
"@$" + padding + std::to_string(cid.index());
828 * (0.75f + 0.25f * min_e_input_available)
829 * throughput_multiplier
831 * min_input_available
832 * effective_production_scale;
846 if(inputs.commodity_type[i]) {
847 input_cost_line(inputs.commodity_type[i], inputs.commodity_amounts[i]);
858 if(einputs.commodity_type[i]) {
859 e_input_cost_line(einputs.commodity_type[i], einputs.commodity_amounts[i]);
869 auto wage_unskilled =
state.world.market_get_labor_unskilled_price(market);
870 auto wage_skilled =
state.world.market_get_labor_skilled_price(market);
872 float wage_estimation = 0.f;
876 *
state.defines.alice_factory_per_level_employment
877 * float(
state.world.factory_get_level(fid))
878 *
state.world.factory_get_primary_employment(fid)
879 *
state.world.market_get_labor_unskilled_demand_satisfaction(market)
880 * (
state.economy_definitions.craftsmen_fraction);
884 *
state.defines.alice_factory_per_level_employment
885 * float(
state.world.factory_get_level(fid))
886 *
state.world.factory_get_secondary_employment(fid)
887 *
state.world.market_get_labor_skilled_demand_satisfaction(market)
888 * (1.f -
state.economy_definitions.craftsmen_fraction);
890 total_expenses += wage_estimation;
892 named_money_line(
"factory_stats_wage",
898 named_money_line(
"factory_stats_expenses",
902 output_cost_line(
type.get_output(),
type.get_output_amount());
906 named_money_line(
"factory_stats_desired_income",
922 auto p =
state.world.factory_get_province_from_factory_location(retrieve<dcon::factory_id>(
state,
parent));
931 auto commodity_mod_description = [&](
float value, std::string_view locale_base_name, std::string_view locale_farm_base_name) {
944 commodity_mod_description(
state.world.nation_get_factory_goods_output(n,
com),
"tech_output",
"tech_output");
945 commodity_mod_description(
state.world.nation_get_rgo_goods_output(n,
com),
"tech_mine_output",
"tech_farm_output");
946 commodity_mod_description(
state.world.nation_get_rgo_size(n,
com),
"tech_mine_size",
"tech_farm_size");
954 if(
state.world.commodity_get_is_mine(
com)) {
977 auto v = retrieve<economy::new_factory>(
state,
parent);
978 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
982 auto v = retrieve<economy::new_factory>(
state,
parent);
983 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
996 auto v = retrieve<economy::upgraded_factory>(
state,
parent);
997 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
1001 auto v = retrieve<economy::upgraded_factory>(
state,
parent);
1002 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
1016 std::vector<element_base*> factory_elements;
1017 std::vector<element_base*> upgrade_elements;
1018 std::vector<element_base*> build_elements;
1019 std::vector<element_base*> closed_elements;
1020 dcon::commodity_id output_commodity;
1026 if(
name ==
"prod_factory_bg") {
1027 return make_element_by_type<normal_factory_background>(
state,
id);
1028 }
else if(
name ==
"level") {
1029 auto ptr = make_element_by_type<factory_level_text>(
state,
id);
1030 factory_elements.push_back(ptr.get());
1032 }
else if(
name ==
"income") {
1033 auto ptr = make_element_by_type<factory_profit_text>(
state,
id);
1034 factory_elements.push_back(ptr.get());
1036 }
else if(
name ==
"income_icon") {
1037 auto ptr = make_element_by_type<factory_income_image>(
state,
id);
1038 factory_elements.push_back(ptr.get());
1040 }
else if(
name ==
"output") {
1041 return make_element_by_type<commodity_image>(
state,
id);
1042 }
else if(
name ==
"closed_overlay") {
1043 return make_element_by_type<invisible_element>(
state,
id);
1044 }
else if(
name ==
"factory_closed_text") {
1045 return make_element_by_type<invisible_element>(
state,
id);
1046 }
else if(
name ==
"prod_factory_inprogress_bg") {
1047 auto ptr = make_element_by_type<image_element_base>(
state,
id);
1048 build_elements.push_back(ptr.get());
1050 }
else if(
name ==
"build_factory_progress") {
1051 auto ptr = make_element_by_type<factory_build_progress_bar>(
state,
id);
1052 build_elements.push_back(ptr.get());
1054 }
else if(
name ==
"prod_cancel_progress") {
1055 auto ptr = make_element_by_type<factory_cancel_new_const_button>(
state,
id);
1056 build_elements.push_back(ptr.get());
1058 }
else if(
name ==
"upgrade_factory_progress") {
1059 auto ptr = make_element_by_type<factory_upgrade_progress_bar>(
state,
id);
1060 upgrade_elements.push_back(ptr.get());
1062 }
else if(
name ==
"progress_overlay_16_64") {
1063 auto ptr = make_element_by_type<image_element_base>(
state,
id);
1064 upgrade_elements.push_back(ptr.get());
1066 }
else if(
name ==
"employment_ratio") {
1067 auto ptr = make_element_by_type<factory_employment_image>(
state,
id);
1068 factory_elements.push_back(ptr.get());
1070 }
else if(
name ==
"priority") {
1071 auto ptr = make_element_by_type<factory_priority_button>(
state,
id);
1072 factory_elements.push_back(ptr.get());
1074 }
else if(
name ==
"upgrade") {
1075 auto ptr = make_element_by_type<factory_upgrade_button>(
state,
id);
1076 factory_elements.push_back(ptr.get());
1078 }
else if(
name ==
"subsidise") {
1079 auto ptr = make_element_by_type<factory_subsidise_button>(
state,
id);
1080 factory_elements.push_back(ptr.get());
1082 }
else if(
name ==
"delete_factory") {
1083 auto ptr = make_element_by_type<factory_delete_button>(
state,
id);
1084 closed_elements.push_back(ptr.get());
1086 }
else if(
name ==
"open_close") {
1087 auto ptr = make_element_by_type<factory_reopen_button>(
state,
id);
1088 closed_elements.push_back(ptr.get());
1089 auto ptrb = make_element_by_type<factory_close_and_delete_button>(
state,
id);
1090 factory_elements.push_back(ptrb.get());
1093 }
else if(
name.substr(0, 6) ==
"input_") {
1094 auto input_index = size_t(std::stoi(std::string(
name.substr(6))));
1095 if(
name.ends_with(
"_lack2")) {
1096 auto ptr = make_element_by_type<image_element_base>(
state,
id);
1097 input_lack_icons[input_index] = ptr.
get();
1100 auto ptr = make_element_by_type<factory_input_icon>(
state,
id);
1113 auto content = any_cast<production_factory_slot_data>(payload);
1115 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
1116 dcon::factory_type_fat_id fat_btid(
state.world, dcon::factory_type_id{});
1117 if(std::holds_alternative<economy::new_factory>(content.activity)) {
1122 for(
auto const& e : factory_elements)
1123 e->set_visible(
state,
false);
1124 for(
auto const& e : upgrade_elements)
1125 e->set_visible(
state,
false);
1126 for(
auto const& e : build_elements)
1127 e->set_visible(
state,
true);
1128 for(
auto const& e : closed_elements)
1129 e->set_visible(
state,
false);
1130 }
else if(std::holds_alternative<economy::upgraded_factory>(content.activity)) {
1135 for(
auto const& e : factory_elements)
1136 e->set_visible(
state,
true);
1137 for(
auto const& e : upgrade_elements)
1138 e->set_visible(
state,
true);
1139 for(
auto const& e : build_elements)
1140 e->set_visible(
state,
false);
1141 for(
auto const& e : closed_elements)
1142 e->set_visible(
state,
false);
1145 dcon::factory_id fid = content.id;
1146 fat_btid =
state.world.factory_get_building_type(fid);
1149 for(
auto const& e : factory_elements)
1150 e->set_visible(
state,
true);
1151 for(
auto const& e : upgrade_elements)
1152 e->set_visible(
state,
false);
1153 for(
auto const& e : build_elements)
1154 e->set_visible(
state,
false);
1155 for(
auto const& e : closed_elements)
1156 e->set_visible(
state, is_closed);
1159 auto s = retrieve<dcon::state_instance_id>(
state,
parent);
1160 auto market =
state.world.state_instance_get_market_from_local_market(s);
1162 auto& cset = fat_btid.get_inputs();
1164 if(input_icons[
size_t(i)]) {
1165 dcon::commodity_id cid = cset.commodity_type[size_t(i)];
1166 input_icons[size_t(i)]->
frame = int32_t(
state.world.commodity_get_icon(cid));
1167 input_icons[size_t(i)]->
com = cid;
1168 bool is_lack = cid != dcon::commodity_id{} ?
state.world.market_get_demand_satisfaction(market, cid) < 0.5f :
false;
1172 output_commodity = fat_btid.get_output().id;
1180 auto content = any_cast<production_factory_slot_data>(p_payload);
1181 if(payload.holds_type<dcon::factory_id>()) {
1182 payload.emplace<dcon::factory_id>(content.id);
1185 if(std::holds_alternative<economy::upgraded_factory>(content.activity))
1189 if(std::holds_alternative<economy::new_factory>(content.activity))
1192 }
else if(payload.holds_type<dcon::commodity_id>()) {
1193 payload.emplace<dcon::commodity_id>(output_commodity);
1195 }
else if(payload.holds_type<dcon::province_id>()) {
1196 payload.emplace<dcon::province_id>(
state.world.factory_get_province_from_factory_location(content.id));
1207 std::vector<element_base*> infos;
1208 std::vector<state_factory_slot> factories;
1213 auto content = any_cast<commodity_filter_query_data>(payload);
1214 return content.filter;
1222 int16_t num_cols = 8;
1224 for(int16_t factory_index = 0; factory_index < int16_t(
state.defines.factories_per_state); ++factory_index) {
1225 auto ptr = make_element_by_type<production_factory_info>(
state,
1227 ptr->index =
uint8_t(factory_index);
1228 ptr->base_data.position.x = (factory_index % num_cols) * ptr->base_data.size.x;
1229 ptr->base_data.position.y += std::max<int16_t>(0, (factory_index / num_cols) * (ptr->base_data.size.y - 26));
1230 infos.push_back(ptr.get());
1234 * ((int16_t(
state.defines.factories_per_state) + num_cols - 1) / num_cols);
1238 auto state_id = retrieve<dcon::state_instance_id>(
state,
parent);
1240 for(
auto const c : infos)
1241 c->set_visible(
state,
false);
1243 std::vector<bool> visited_types(
state.world.factory_type_size(),
false);
1247 dcon::commodity_id cid =
state.world.factory_type_get_output(nf.type).id;
1248 if(!visited_types[nf.type.index()] && get_filter(
state, cid) && index <
state.defines.factories_per_state) {
1249 factories[index].activity = nf;
1250 factories[index].id = dcon::factory_id{};
1251 visited_types[nf.type.index()] =
true;
1252 infos[index]->set_visible(
state,
true);
1258 dcon::commodity_id cid =
state.world.factory_type_get_output(uf.
type).id;
1259 if(!visited_types[uf.
type.index()] && get_filter(
state, cid) && index <
state.defines.factories_per_state) {
1260 factories[index].activity = uf;
1261 province::for_each_province_in_state_instance(state, state_id, [&](dcon::province_id prov) {
1262 for(auto fa : state.world.province_get_factory_location(prov)) {
1263 if(fa.get_factory().get_building_type() == uf.type) {
1264 factories[index].id = fa.get_factory().id;
1269 visited_types[uf.
type.index()] =
true;
1270 infos[index]->set_visible(
state,
true);
1276 dcon::fatten(
state.world, pid).for_each_factory_location_as_province([&](dcon::factory_location_id flid) {
1277 dcon::factory_id fid =
state.world.factory_location_get_factory(flid);
1278 dcon::factory_type_id ftid =
state.world.factory_get_building_type(fid);
1279 dcon::commodity_id cid =
state.world.factory_type_get_output(ftid).
id;
1280 if(!visited_types[ftid.index()] && get_filter(state, cid) && index <
state.defines.factories_per_state) {
1281 factories[index].activity = std::monostate{};
1283 infos[index]->set_visible(state,
true);
1292 auto content = any_cast<production_factory_slot_data>(payload);
1293 auto index = content.index;
1295 content.index = index;
1297 return message_result::consumed;
1299 return message_result::unseen;
1306 const dcon::province_id pid = retrieve<dcon::province_id>(
state, parent);
1307 const dcon::state_instance_id sid =
state.world.province_get_state_membership(pid);
1308 const dcon::nation_id n = retrieve<dcon::nation_id>(
state, parent);
1310 bool can_build =
false;
1311 state.world.for_each_factory_type([&](dcon::factory_type_id ftid) {
1315 disabled = !can_build;
1320 const dcon::province_id pid = retrieve<dcon::province_id>(
state, parent);
1321 const dcon::state_instance_id sid =
state.world.province_get_state_membership(pid);
1331 return tooltip_behavior::variable_tooltip;
1335 const dcon::province_id pid = retrieve<dcon::province_id>(
state, parent);
1336 const dcon::state_instance_id sid =
state.world.province_get_state_membership(pid);
1337 const dcon::nation_id n = retrieve<dcon::nation_id>(
state, parent);
1339 bool non_colonial = !
state.world.province_get_is_colonial(
state.world.state_instance_get_capital(sid));
1341 bool is_civilized =
state.world.nation_get_is_civilized(n);
1349 if(n ==
state.local_player_nation) {
1350 auto rules =
state.world.nation_get_combined_issue_rules(n);
1357 auto target =
state.world.nation_get_combined_issue_rules(n);
1366 auto r = num_factories < int32_t(
state.defines.factories_per_state);
1382 const dcon::state_instance_id sid = retrieve<dcon::state_instance_id>(
state, parent);
1383 const dcon::nation_id n = retrieve<dcon::nation_id>(
state, parent);
1385 bool can_build =
false;
1386 state.world.for_each_factory_type([&](dcon::factory_type_id ftid) {
1390 disabled = !can_build;
1395 dcon::state_instance_id sid = retrieve<dcon::state_instance_id>(
state, parent);
1401 return tooltip_behavior::variable_tooltip;
1405 const dcon::state_instance_id sid = retrieve<dcon::state_instance_id>(
state, parent);
1406 const dcon::nation_id n = retrieve<dcon::nation_id>(
state, parent);
1408 bool non_colonial = !
state.world.province_get_is_colonial(
state.world.state_instance_get_capital(sid));
1410 bool is_civilized =
state.world.nation_get_is_civilized(n);
1418 if(n ==
state.local_player_nation) {
1419 auto rules =
state.world.nation_get_combined_issue_rules(n);
1426 auto target =
state.world.nation_get_combined_issue_rules(n);
1435 auto r = num_factories < int32_t(
state.defines.factories_per_state);
1450 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1451 return bool(
state.world.state_instance_get_owner_focus(content).id)
1452 ?
state.world.state_instance_get_owner_focus(content).get_icon() - 1
1458 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1459 dcon::nation_id n = retrieve<dcon::nation_id>(
state, parent);
1461 for(
auto nfid :
state.world.in_national_focus) {
1464 frame = get_icon_frame(
state);
1468 auto sid = retrieve<dcon::state_instance_id>(
state, parent);
1473 auto sid = retrieve<dcon::state_instance_id>(
state, parent);
1478 return tooltip_behavior::variable_tooltip;
1484 auto sid = retrieve<dcon::state_instance_id>(
state, parent);
1488 auto content =
state.world.state_instance_get_owner_focus(sid);
1494 if(fat_nf.get_promotion_type()) {
1496 if(fat_nf.get_promotion_type() ==
state.culture_definitions.clergy) {
1500 }
else if(fat_nf.get_promotion_type() ==
state.culture_definitions.bureaucrat) {
1510 if(
auto mid =
state.world.national_focus_get_modifier(content); mid) {
1519 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1522 auto unemployed = total - employed;
1526 return tooltip_behavior::variable_tooltip;
1529 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1532 auto unemployed = total - employed;
1540 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1543 auto unemployed = total - employed;
1547 return tooltip_behavior::variable_tooltip;
1550 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1553 auto unemployed = total - employed;
1561 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1562 auto total =
state.world.state_instance_get_demographics(content,
1569 set_text(
state,
"0.0%");
1576 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1578 float p_total = 0.0f;
1591 if(
name ==
"state_focus") {
1592 return make_element_by_type<production_national_focus_button>(
state,
id);
1593 }
else if(
name ==
"state_name") {
1594 return make_element_by_type<state_name_text>(
state,
id);
1595 }
else if(
name ==
"factory_count") {
1596 auto temp = make_element_by_type<state_factory_count_text>(
state,
id);
1599 }
else if(
name ==
"build_new_factory") {
1600 return make_element_by_type<production_build_new_factory>(
state,
id);
1601 }
else if(
name ==
"avg_infra_text") {
1602 return make_element_by_type<state_infrastructure>(
state,
id);
1603 }
else if(
name ==
"factory_info_bounds") {
1604 return make_element_by_type<production_factory_info_bounds_window>(
state,
id);
1611 constexpr int16_t num_cols = 8;
1612 base_data.size.y +=
state.ui_defs.gui[
state.ui_state.
defs_by_name.find(
state.lookup_key(
"factory_info"))->second.definition].size.y
1613 * (((int16_t(
state.defines.factories_per_state) + num_cols - 1) / num_cols) - 1);
1616 xy_pair base_sort_template_offset =
1620 auto text_elm = std::make_unique< per_state_primary_worker_amount>();
1621 memcpy(&(text_elm->base_data), &factory_number_def,
sizeof(
ui::element_data));
1622 text_elm->base_data.position.x = int16_t(500 + base_sort_template_offset.
x * 0);
1623 text_elm->on_create(
state);
1624 add_child_to_front(std::move(text_elm));
1627 auto text_elm = std::make_unique< per_state_secondary_worker_amount>();
1628 memcpy(&(text_elm->base_data), &factory_number_def,
sizeof(
ui::element_data));
1629 text_elm->base_data.position.x = int16_t(500 + base_sort_template_offset.x * 1);
1630 text_elm->on_create(
state);
1631 add_child_to_front(std::move(text_elm));
1634 auto text_elm = std::make_unique< per_state_capitalist_amount>();
1635 memcpy(&(text_elm->base_data), &factory_number_def,
sizeof(
ui::element_data));
1636 text_elm->base_data.position.x = int16_t(500 + base_sort_template_offset.x * 2);
1637 text_elm->on_create(state);
1638 add_child_to_front(std::move(text_elm));
1652 return "state_info";
1659 row_contents.clear();
1661 auto show_empty = retrieve<bool>(
state, parent);
1662 dcon::nation_id n = retrieve<production_foreign_invest_target>(
state, parent).n;
1670 if(payload.holds_type<dcon::nation_id>()) {
1671 payload.emplace<dcon::nation_id>(retrieve<production_foreign_invest_target>(
state, parent).n);
1672 return message_result::consumed;
1674 return message_result::unseen;
1681 return "state_info";
1688 row_contents.clear();
1690 auto show_empty = retrieve<bool>(
state, parent);
1691 const dcon::nation_id n = retrieve<dcon::nation_id>(
state, parent);
1704 return "military_goods";
1706 return "raw_material_goods";
1708 return "industrial_goods";
1710 return "consumer_goods";
1713 return "industrial_and_consumer_goods";
1721 if(
name ==
"cat_name") {
1722 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1723 goods_cat_name = ptr.
get();
1732 auto group = any_cast<sys::commodity_group>(payload);
1734 return message_result::consumed;
1736 return message_result::unseen;
1746 .header =
"method_name",
1753 return a.index() < b.index();
1756 auto item =
state.world.factory_type_get_output(
id).id;
1757 std::string padding = item.index() < 10 ?
"0" :
"";
1758 std::string description =
"@$" + padding + std::to_string(item.index());
1763 .cell_definition_string =
"thin_cell_name",
1764 .header_definition_string =
"thin_cell_name"
1769 .header =
"method_input",
1771 auto nation = retrieve<dcon::nation_id>(
state, container);
1772 auto market = retrieve<dcon::market_id>(
state, container);
1779 return a.index() < b.index();
1782 auto nation = retrieve<dcon::nation_id>(
state, container);
1783 auto market = retrieve<dcon::market_id>(
state, container);
1792 .header =
"method_output",
1794 auto nation = retrieve<dcon::nation_id>(
state, container);
1795 auto market = retrieve<dcon::market_id>(
state, container);
1802 return a.index() < b.index();
1805 auto nation = retrieve<dcon::nation_id>(
state, container);
1806 auto market = retrieve<dcon::market_id>(
state, container);
1815 .header =
"method_profit",
1817 auto nation = retrieve<dcon::nation_id>(
state, container);
1818 auto market = retrieve<dcon::market_id>(
state, container);
1827 return a.index() < b.index();
1830 auto nation = retrieve<dcon::nation_id>(
state, container);
1831 auto market = retrieve<dcon::market_id>(
state, container);
1841 .header =
"method_margin",
1843 auto nation = retrieve<dcon::nation_id>(
state, container);
1844 auto market = retrieve<dcon::market_id>(
state, container);
1857 return a.index() < b.index();
1860 auto nation = retrieve<dcon::nation_id>(
state, container);
1861 auto market = retrieve<dcon::market_id>(
state, container);
1872 .header =
"method_cost",
1874 auto nation = retrieve<dcon::nation_id>(
state, container);
1875 auto market = retrieve<dcon::market_id>(
state, container);
1883 return a.index() < b.index();
1886 auto nation = retrieve<dcon::nation_id>(
state, container);
1887 auto market = retrieve<dcon::market_id>(
state, container);
1896 .header =
"method_payback",
1898 auto nation = retrieve<dcon::nation_id>(
state, container);
1899 auto market = retrieve<dcon::market_id>(
state, container);
1905 av = std::max(0.f, av);
1906 bv = std::max(0.f, bv);
1913 return a.index() < b.index();
1916 auto nation = retrieve<dcon::nation_id>(
state, container);
1917 auto market = retrieve<dcon::market_id>(
state, container);
1921 value = std::max(0.f, value);
1930 .header =
"method_research",
1932 auto nation = retrieve<dcon::nation_id>(
state, container);
1933 auto market = retrieve<dcon::market_id>(
state, container);
1935 auto av =
state.world.nation_get_factory_type_experience(nation, a);
1936 auto bv =
state.world.nation_get_factory_type_experience(nation, b);
1941 return a.index() < b.index();
1944 auto nation = retrieve<dcon::nation_id>(
state, container);
1945 auto market = retrieve<dcon::market_id>(
state, container);
1947 auto value =
state.world.nation_get_factory_type_experience(nation,
id);
1954 bool show_empty_states =
true;
1955 std::unique_ptr<bool[]> show_output_commodity;
1965 dcon::state_instance_id focus_state{};
1966 dcon::nation_id foreign_nation{};
1967 xy_pair base_commodity_offset{33, 50};
1968 xy_pair commodity_offset{33, 50};
1970 std::vector<element_base*> factory_elements;
1971 std::vector<element_base*> investment_brow_elements;
1972 std::vector<element_base*> project_elements;
1973 std::vector<element_base*> good_elements;
1974 std::vector<element_base*> investment_nation;
1975 std::vector<bool> commodity_filters;
1976 bool open_foreign_invest =
false;
1978 void set_visible_vector_elements(
sys::state&
state, std::vector<element_base*>& elements,
bool v)
noexcept {
1979 for(
auto element : elements)
1980 element->set_visible(
state, v);
1984 set_visible_vector_elements(
state, factory_elements,
false);
1985 set_visible_vector_elements(
state, investment_brow_elements,
false);
1986 set_visible_vector_elements(
state, project_elements,
false);
1987 set_visible_vector_elements(
state, good_elements,
false);
1988 set_visible_vector_elements(
state, investment_nation,
false);
1993 generic_tabbed_window::on_create(
state);
1996 commodity_filters.resize(
state.world.commodity_size(),
true);
1999 auto ptr = make_element_by_type<national_focus_window>(
state,
"state_focus_window");
2000 ptr->set_visible(
state,
false);
2002 add_child_to_front(std::move(ptr));
2005 auto win = make_element_by_type<factory_build_window>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"build_factory"))->second.definition);
2006 build_win = win.
get();
2007 add_child_to_front(std::move(win));
2009 auto win2 = make_element_by_type<project_investment_window>(
state,
2011 win2->set_visible(
state,
false);
2012 project_window = win2.
get();
2013 add_child_to_front(std::move(win2));
2015 show_output_commodity = std::unique_ptr<bool[]>(
new bool[
state.world.commodity_size()]);
2016 set_visible(
state,
false);
2019 if(
name ==
"main_bg") {
2020 return make_element_by_type<image_element_base>(
state,
id);
2021 }
else if(
name ==
"table_production_methods") {
2022 std::vector<table::column<dcon::factory_type_id>> columns = {
2033 auto ptr = make_element_by_type<table::display<dcon::factory_type_id>>(
2036 std::string(
"table_production_methods_body"),
2039 ptr->set_visible(
state,
false);
2041 state.world.for_each_factory_type([&](dcon::factory_type_id ft) {
2042 ptr->content.data.push_back(ft);
2045 good_elements.push_back(ptr.get());
2047 }
else if(
name ==
"prod_bg") {
2048 return make_element_by_type<opaque_element_base>(
state,
id);
2049 }
else if(
name ==
"close_button") {
2050 return make_element_by_type<generic_close_button>(
state,
id);
2051 }
else if(
name ==
"tab_factories") {
2052 auto ptr = make_element_by_type<generic_tab_button<production_window_tab>>(
state, id);
2053 ptr->target = production_window_tab::factories;
2055 }
else if(
name ==
"tab_invest") {
2056 auto ptr = make_element_by_type<generic_tab_button<production_window_tab>>(
state, id);
2057 ptr->target = production_window_tab::investments;
2059 }
else if(
name ==
"tab_popprojects") {
2060 auto ptr = make_element_by_type<generic_tab_button<production_window_tab>>(
state, id);
2061 ptr->target = production_window_tab::projects;
2063 }
else if(
name ==
"tab_goodsproduction") {
2064 auto ptr = make_element_by_type<generic_tab_button<production_window_tab>>(
state, id);
2065 ptr->target = production_window_tab::goods;
2067 }
else if(
name ==
"tab_factories_text") {
2068 return make_element_by_type<invisible_element>(
state,
id);
2069 }
else if(
name ==
"tab_invest_text") {
2070 return make_element_by_type<invisible_element>(
state,
id);
2071 }
else if(
name ==
"tab_goodsproduction_text") {
2072 return make_element_by_type<invisible_element>(
state,
id);
2073 }
else if(
name ==
"tab_popprojects_text") {
2074 return make_element_by_type<invisible_element>(
state,
id);
2075 }
else if(
name ==
"factory_buttons") {
2076 auto ptr = make_element_by_type<factory_buttons_window>(
state,
id);
2077 factory_elements.push_back(ptr.get());
2078 ptr->set_visible(
state,
true);
2080 }
else if(
name ==
"invest_buttons") {
2081 auto ptr = make_element_by_type<production_foreign_investment_window>(
state,
id);
2082 foreign_invest_win = ptr.
get();
2083 investment_nation.push_back(ptr.get());
2084 ptr->set_visible(
state,
false);
2086 }
else if(
name ==
"state_listbox") {
2087 auto ptr = make_element_by_type<production_state_listbox>(
state,
id);
2088 state_listbox = ptr.
get();
2089 factory_elements.push_back(ptr.get());
2090 ptr->set_visible(
state,
true);
2092 }
else if(
name ==
"state_listbox_invest") {
2093 auto ptr = make_element_by_type<production_state_invest_listbox>(
state,
id);
2094 state_listbox_invest = ptr.
get();
2095 investment_nation.push_back(ptr.get());
2096 ptr->set_visible(
state,
false);
2098 }
else if(
name ==
"investment_browser") {
2099 auto ptr = make_element_by_type<invest_brow_window>(
state,
id);
2100 investment_brow_elements.push_back(ptr.get());
2101 ptr->set_visible(
state,
false);
2103 }
else if(
name ==
"sort_by_state") {
2104 auto ptr = make_element_by_type<button_element_base>(
state,
id);
2105 project_elements.push_back(ptr.get());
2106 ptr->set_visible(
state,
false);
2108 }
else if(
name ==
"sort_by_projects") {
2109 auto ptr = make_element_by_type<button_element_base>(
state,
id);
2110 project_elements.push_back(ptr.get());
2111 ptr->set_visible(
state,
false);
2113 }
else if(
name ==
"sort_by_completion") {
2114 auto ptr = make_element_by_type<button_element_base>(
state,
id);
2115 project_elements.push_back(ptr.get());
2116 ptr->set_visible(
state,
false);
2118 }
else if(
name ==
"sort_by_projecteers") {
2119 auto ptr = make_element_by_type<button_element_base>(
state,
id);
2120 project_elements.push_back(ptr.get());
2121 ptr->set_visible(
state,
false);
2123 }
else if(
name ==
"pop_sort_buttons") {
2124 auto ptr = make_element_by_type<pop_sort_buttons_window>(
state,
id);
2125 factory_elements.push_back(ptr.get());
2126 ptr->set_visible(
state,
true);
2128 }
else if(
name ==
"project_listbox") {
2129 auto ptr = make_element_by_type<production_project_listbox>(
state,
id);
2130 project_elements.push_back(ptr.get());
2131 ptr->set_visible(
state,
false);
2140 auto enum_val = any_cast<production_window_tab>(payload);
2141 hide_sub_windows(
state);
2143 case production_window_tab::factories:
2144 set_visible_vector_elements(
state, factory_elements,
true);
2146 case production_window_tab::investments:
2147 set_visible_vector_elements(
state, investment_brow_elements,
true);
2150 case production_window_tab::projects:
2151 set_visible_vector_elements(
state, project_elements,
true);
2153 case production_window_tab::goods:
2154 set_visible_vector_elements(
state, good_elements,
true);
2157 active_tab = enum_val;
2158 return message_result::consumed;
2161 return message_result::consumed;
2163 hide_sub_windows(
state);
2164 auto target = any_cast<open_investment_nation>(payload).id;
2165 active_tab = production_window_tab::investments;
2167 set_visible_vector_elements(
state, investment_nation,
true);
2168 return message_result::consumed;
2170 auto sort_type = any_cast<production_sort_order>(payload);
2174 state_listbox_invest->
sort_order = sort_type;
2177 }
else if(payload.holds_type<dcon::state_instance_id>()) {
2178 payload.emplace<dcon::state_instance_id>(focus_state);
2179 return message_result::consumed;
2180 }
else if(payload.holds_type<dcon::market_id>()) {
2181 auto capitol =
state.world.nation_get_capital(
state.local_player_nation);
2182 auto s =
state.world.province_get_state_membership(capitol);
2183 auto m =
state.world.state_instance_get_market_from_local_market(s);
2184 payload.emplace<dcon::market_id>(m);
2185 return message_result::consumed;
2187 auto data = any_cast<production_selection_wrapper>(payload);
2188 focus_state = data.data;
2191 move_child_to_front(build_win);
2195 move_child_to_front(nf_win);
2197 impl_on_update(
state);
2198 return message_result::consumed;
2199 }
else if(payload.holds_type<
bool>()) {
2200 payload.emplace<
bool>(show_empty_states);
2201 return message_result::consumed;
2203 show_empty_states = any_cast<element_selection_wrapper<bool>>(payload).data;
2204 impl_on_update(
state);
2205 return message_result::consumed;
2207 auto content = any_cast<commodity_filter_query_data>(payload);
2208 content.filter = commodity_filters[content.cid.index()];
2210 return message_result::consumed;
2212 auto content = any_cast<commodity_filter_toggle_data>(payload);
2213 commodity_filters[content.data.index()] = !commodity_filters[content.data.index()];
2214 impl_on_update(
state);
2215 return message_result::consumed;
2217 auto content = any_cast<element_selection_wrapper<production_action>>(payload).data;
2219 case production_action::investment_window:
2222 case production_action::foreign_invest_window:
2228 impl_on_update(
state);
2229 return message_result::consumed;
2231 foreign_nation = any_cast<element_selection_wrapper<dcon::nation_id>>(payload).data;
2232 open_foreign_invest =
true;
2234 return message_result::consumed;
2235 }
else if(payload.holds_type<dcon::nation_id>()) {
2237 payload.emplace<dcon::nation_id>(foreign_nation);
2239 payload.emplace<dcon::nation_id>(
state.local_player_nation);
2240 return message_result::consumed;
2242 return message_result::unseen;
2246void open_foreign_investment(
sys::state& state, dcon::nation_id n);
2247void open_build_foreign_factory(
sys::state& state, dcon::state_instance_id st);
void add_child_to_front(std::unique_ptr< element_base > child) noexcept final
void impl_on_update(sys::state &state) noexcept override
virtual message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
message_result impl_get(sys::state &state, Cyto::Any &payload) noexcept
void set_visible(sys::state &state, bool vis)
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void on_update(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void on_update(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void button_action(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void on_update(sys::state &state) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
dcon::nation_id curr_nation
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
message_result set(sys::state &state, Cyto::Any &payload) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void on_create(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
ui::element_data factory_number_def
void on_update(sys::state &state) noexcept override
production_sort_order sort_order
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
std::string_view get_row_element_name() override
production_sort_order sort_order
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_update(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void button_action(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_create(sys::state &state) noexcept override
bool can_cancel_factory_building_construction(sys::state &state, dcon::nation_id source, dcon::state_instance_id location, dcon::factory_type_id type)
bool can_delete_factory(sys::state &state, dcon::nation_id source, dcon::factory_id f)
bool can_begin_factory_building_construction(sys::state &state, dcon::nation_id source, dcon::state_instance_id location, dcon::factory_type_id type, bool is_upgrade)
bool can_change_factory_settings(sys::state &state, dcon::nation_id source, dcon::factory_id f, uint8_t priority, bool subsidized)
bool can_set_national_focus(sys::state &state, dcon::nation_id source, dcon::state_instance_id target_state, dcon::national_focus_id focus)
void set_national_focus(sys::state &state, dcon::nation_id source, dcon::state_instance_id target_state, dcon::national_focus_id focus)
@ change_factory_settings
@ cancel_factory_building_construction
@ begin_factory_building_construction
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
constexpr dcon::demographics_key total(0)
dcon::demographics_key to_key(sys::state const &state, dcon::pop_type_id v)
dcon::demographics_key to_employment_key(sys::state const &state, dcon::pop_type_id v)
float factory_input_total_cost(sys::state const &state, dcon::market_id m, dcon::factory_type_id fac_type)
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)
float factory_max_production_scale(sys::state const &state, dcon::factory_id fac, float mobilization_impact, bool occupied)
float factory_min_e_input_available(sys::state const &state, dcon::market_id m, dcon::factory_type_id fac_type)
float factory_type_output_cost(sys::state &state, dcon::nation_id n, dcon::market_id m, dcon::factory_type_id factory_type)
void for_each_new_factory(sys::state &state, dcon::state_instance_id s, F &&func)
float factory_e_input_total_cost(sys::state const &state, dcon::market_id m, dcon::factory_type_id fac_type)
float factory_desired_raw_profit(dcon::factory_id fac, float spendings)
float factory_max_employment(sys::state const &state, dcon::factory_id f)
int32_t state_factory_count(sys::state &state, dcon::state_instance_id sid, dcon::nation_id n)
float factory_min_input_available(sys::state const &state, dcon::market_id m, dcon::factory_type_id fac_type)
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)
float price(sys::state const &state, dcon::state_instance_id s, dcon::commodity_id c)
int32_t factory_priority(sys::state const &state, dcon::factory_id f)
constexpr float factory_closed_threshold
float factory_type_build_cost(sys::state &state, dcon::nation_id n, dcon::market_id m, dcon::factory_type_id factory_type)
void for_each_upgraded_factory(sys::state &state, dcon::state_instance_id s, F &&func)
float pop_min_wage_factor(sys::state &state, dcon::nation_id n)
std::vector< dcon::factory_type_id > commodity_get_factory_types_as_output(sys::state const &state, dcon::commodity_id output_good)
float factory_type_input_cost(sys::state &state, dcon::nation_id n, dcon::market_id m, dcon::factory_type_id factory_type)
float factory_output_multiplier(sys::state const &state, dcon::factory_id fac, dcon::nation_id n, dcon::market_id m, dcon::province_id p)
constexpr uint32_t build_factory
constexpr uint32_t can_subsidise
constexpr uint32_t allow_foreign_investment
constexpr uint32_t factory_priority
constexpr uint32_t expand_factory
float mobilization_impact(sys::state const &state, dcon::nation_id n)
bool are_at_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
void for_each_province_in_state_instance(sys::state &state, dcon::state_instance_id s, F const &func)
float state_admin_efficiency(sys::state &state, dcon::state_instance_id id)
@ industrial_and_consumer_goods
void add_line_break_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
std::string format_money(float num)
layout_box open_layout_box(layout_base &dest, int32_t indent)
void add_unparsed_text_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view sv, substitution_map const &mp)
void localised_single_sub_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, variable_type subkey, substitution value)
void localised_format_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, text::substitution_map const &sub)
std::string prettify(int64_t num)
std::string format_float(float num, size_t digits)
void add_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
void add_line_with_condition(sys::state &state, layout_base &dest, std::string_view key, bool condition_met, int32_t indent)
void add_line_break_to_layout(sys::state &state, columnar_layout &dest)
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
std::string format_percentage(float num, size_t digits)
void add_space_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
void close_layout_box(columnar_layout &dest, layout_box &box)
void modifier_description(sys::state &state, text::layout_base &layout, dcon::modifier_id mid, int32_t indentation=0)
table::column< dcon::factory_type_id > factory_type_payback
table::column< dcon::factory_type_id > factory_type_profit
table::column< dcon::factory_type_id > factory_type_output_cost
table::column< dcon::factory_type_id > factory_type_cost
void send(sys::state &state, element_base *parent, T value)
table::column< dcon::factory_type_id > factory_type_research
table::column< dcon::factory_type_id > factory_type_profit_margin
void populate_production_states_list(sys::state &state, std::vector< dcon::state_instance_id > &row_contents, dcon::nation_id n, bool show_empty, production_sort_order sort_order)
table::column< dcon::factory_type_id > factory_type_name
table::column< dcon::factory_type_id > factory_type_input_cost
void active_modifiers_description(sys::state &state, text::layout_base &layout, dcon::nation_id n, int32_t identation, dcon::national_modifier_value nmid, bool header)
static constexpr uint32_t set_size
static constexpr uint32_t set_size
dcon::factory_type_id type
Holds important data about the game world, state, and other data regarding windowing,...
dcon::state_instance_id data
std::variant< std::monostate, economy::upgraded_factory, economy::new_factory > activity
element_base * topbar_subwindow
ankerl::unordered_dense::map< dcon::text_key, element_target, hash_text_key > defs_by_name
std::unique_ptr< element_base > root
element_base * production_subwindow