19 dcon::state_instance_id
data{};
27 auto content = retrieve<dcon::factory_id>(
state,
parent);
28 frame = int32_t(
state.world.factory_get_primary_employment(content) * 10.f);
36 auto fid = retrieve<dcon::factory_id>(
state,
parent);
63 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
64 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
66 auto rules =
state.world.nation_get_combined_issue_rules(n);
71 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
96 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
97 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
98 if(n !=
state.local_player_nation)
131 auto fid = retrieve<dcon::factory_id>(
state,
parent);
133 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
136 fat.get_building_type().id,
true);
145 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
146 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
147 for(
auto p :
state.world.state_definition_get_abstract_state_membership_as_state(
state.world.state_instance_get_definition(sid))) {
148 for(
auto fac : p.get_province().get_factory_location()) {
150 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true)) {
152 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true);
159 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
160 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
161 for(
auto p :
state.world.state_definition_get_abstract_state_membership_as_state(
state.world.state_instance_get_definition(sid))) {
162 for(
auto fac : p.get_province().get_factory_location()) {
163 if(fac.get_factory().get_primary_employment() >= 0.95f && fac.get_factory().get_production_scale() > 0.8f) {
165 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true)) {
167 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true);
175 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
176 for(
auto p :
state.world.nation_get_province_ownership(n)) {
177 for(
auto fac : p.get_province().get_factory_location()) {
179 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true)) {
181 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true);
188 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
189 for(
auto p :
state.world.nation_get_province_ownership(n)) {
190 for(
auto fac : p.get_province().get_factory_location()) {
191 if(fac.get_factory().get_primary_employment() >= 0.95f && fac.get_factory().get_production_scale() > 0.8f) {
193 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true)) {
195 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true);
203 auto fid = retrieve<dcon::factory_id>(
state,
parent);
204 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
205 for(
auto p :
state.world.nation_get_province_ownership(n)) {
206 for(
auto fac : p.get_province().get_factory_location()) {
207 if(fac.get_factory().get_building_type() ==
state.world.factory_get_building_type(fid)
209 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true)) {
211 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true);
218 auto fid = retrieve<dcon::factory_id>(
state,
parent);
219 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
220 for(
auto p :
state.world.nation_get_province_ownership(n)) {
221 for(
auto fac : p.get_province().get_factory_location()) {
222 if(fac.get_factory().get_building_type() ==
state.world.factory_get_building_type(fid)
223 && fac.get_factory().get_primary_employment() >= 0.95f && fac.get_factory().get_production_scale() > 0.8f) {
225 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true)) {
227 p.get_province().get_state_membership(), fac.get_factory().get_building_type(),
true);
235 auto fid = retrieve<dcon::factory_id>(
state,
parent);
237 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
242 auto fid = retrieve<dcon::factory_id>(
state,
parent);
243 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
244 auto type =
state.world.factory_get_building_type(fid);
248 bool is_not_upgrading =
true;
249 for(
auto p :
state.world.state_instance_get_state_building_construction(sid)) {
250 if(p.get_type() ==
type)
251 is_not_upgrading =
false;
253 if(is_not_upgrading) {
263 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
265 const dcon::state_instance_id sid = retrieve<dcon::state_instance_id>(
state,
parent);
266 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
268 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) {
284 bool is_civ =
state.world.nation_get_is_civilized(
state.local_player_nation);
287 bool state_is_not_colonial = !
state.world.province_get_is_colonial(
state.world.state_instance_get_capital(sid));
290 bool is_activated =
state.world.nation_get_active_building(n,
type) ==
true ||
state.world.factory_type_get_is_available_from_start(
type);
292 if(n !=
state.local_player_nation) {
293 bool gp_condition = (
state.world.nation_get_is_great_power(
state.local_player_nation) ==
true &&
294 state.world.nation_get_is_great_power(n) ==
false);
299 auto rules =
state.world.nation_get_combined_issue_rules(n);
306 auto rules =
state.world.nation_get_combined_issue_rules(
state.local_player_nation);
320 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
325 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
338 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
339 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
340 if(n ==
state.local_player_nation) {
353 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
354 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
355 auto rules =
state.world.nation_get_combined_issue_rules(n);
357 frame =
state.world.factory_get_subsidized(fid) ? 1 : 0;
361 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
362 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
364 if(fat.get_subsidized()) {
381 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
382 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
383 if(n ==
state.local_player_nation) {
403 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
404 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
409 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
410 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
419 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
420 if(n ==
state.local_player_nation) {
435 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
436 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
443 auto prov = retrieve<dcon::province_id>(
state,
parent);
449 const dcon::factory_id fid = retrieve<dcon::factory_id>(
state,
parent);
450 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
464 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
465 if(n ==
state.local_player_nation) {
477 std::variant<std::monostate, economy::upgraded_factory, economy::new_factory>
activity;
494 auto nf = retrieve< economy::new_factory>(
state,
parent);
495 auto si = retrieve<dcon::state_instance_id>(
state,
parent);
498 for(
auto p :
state.world.state_instance_get_state_building_construction(si)) {
499 if(p.get_type() == nf.type) {
500 float admin_eff =
state.world.nation_get_administrative_efficiency(p.get_nation());
501 float factory_mod =
state.world.nation_get_modifier_values(p.get_nation(), sys::national_mod_offsets::factory_cost) + 1.0f;
502 float pop_factory_mod = std::max(0.1f,
state.world.nation_get_modifier_values(p.get_nation(), sys::national_mod_offsets::factory_owner_cost));
503 float admin_cost_factor = (p.get_is_pop_project() ? pop_factory_mod : (2.0f - admin_eff)) * factory_mod;
505 auto&
goods =
state.world.factory_type_get_construction_costs(nf.type);
506 auto& cgoods = p.get_purchased_goods();
509 if(
goods.commodity_type[i]) {
535 auto nf = retrieve<economy::upgraded_factory>(
state,
parent);
536 auto si = retrieve<dcon::state_instance_id>(
state,
parent);
539 for(
auto p :
state.world.state_instance_get_state_building_construction(si)) {
540 if(p.get_type() == nf.type) {
541 float admin_eff =
state.world.nation_get_administrative_efficiency(p.get_nation());
542 float factory_mod =
state.world.nation_get_modifier_values(p.get_nation(), sys::national_mod_offsets::factory_cost) + 1.0f;
543 float pop_factory_mod = std::max(0.1f,
state.world.nation_get_modifier_values(p.get_nation(), sys::national_mod_offsets::factory_owner_cost));
544 float admin_cost_factor = (p.get_is_pop_project() ? pop_factory_mod : (2.0f - admin_eff)) * factory_mod;
546 auto&
goods =
state.world.factory_type_get_construction_costs(nf.type);
547 auto& cgoods = p.get_purchased_goods();
550 if(
goods.commodity_type[i]) {
572 auto fid = retrieve<dcon::factory_id>(
state,
parent);
575 dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
576 auto p =
state.world.factory_get_province_from_factory_location(retrieve<dcon::factory_id>(
state,
parent));
577 auto p_fat = fatten(
state.world, p);
578 auto sdef =
state.world.abstract_state_membership_get_state(
state.world.province_get_abstract_state_membership(p));
579 dcon::state_instance_id s{};
580 state.world.for_each_state_instance([&](dcon::state_instance_id
id) {
581 if(
state.world.state_instance_get_definition(
id) == sdef)
588 auto cap_prov =
state.world.nation_get_capital(n);
589 auto cap_continent =
state.world.province_get_continent(cap_prov);
590 auto cap_region =
state.world.province_get_connected_region_id(cap_prov);
593 auto fac = fatten(
state.world, fid);
594 auto type =
state.world.factory_get_building_type(fid);
596 auto& inputs =
type.get_inputs();
597 auto& einputs =
type.get_efficiency_inputs();
609 float e_input_multiplier =
state.world.nation_get_modifier_values(n, sys::national_mod_offsets::factory_maintenance) + 1.0f;
617 p_fat.get_nation_from_province_control() != n
620 float effective_production_scale = std::min(fac.get_production_scale() * fac.get_level(), max_production_scale);
622 auto amount = (0.75f + 0.25f * min_e_input_available) * min_input_available *
state.world.factory_get_production_scale(fid);
640 float total_expenses = 0.f;
642 int position_demand_sat = 100;
643 int position_amount = 180;
644 int position_cost = 250;
646 auto input_cost_line = [&] (
647 dcon::commodity_id cid,
663 auto sat =
state.world.nation_get_demand_satisfaction(n, cid);
673 * throughput_multiplier
674 * min_input_available
675 * effective_production_scale;
678 state.world.nation_get_effective_prices(n, cid)
681 total_expenses += cost;
690 auto e_input_cost_line = [&](
691 dcon::commodity_id cid,
707 auto sat =
state.world.nation_get_demand_satisfaction(n, cid);
716 * input_multiplier * e_input_multiplier
717 * min_e_input_available
718 * min_input_available
719 * effective_production_scale;
722 state.world.nation_get_effective_prices(n, cid)
725 total_expenses += cost;
734 auto named_money_line = [&](
735 std::string_view loc,
742 cost.x_position += position_cost;
752 auto output_cost_line = [&](
753 dcon::commodity_id cid,
761 amount.x_position += position_amount;
762 cost.x_position += position_cost;
769 * (0.75f + 0.25f * min_e_input_available)
770 * throughput_multiplier
772 * min_input_available
773 * effective_production_scale;
776 state.world.nation_get_effective_prices(n, cid)
787 if(inputs.commodity_type[i]) {
788 input_cost_line(inputs.commodity_type[i], inputs.commodity_amounts[i]);
799 if(einputs.commodity_type[i]) {
800 e_input_cost_line(einputs.commodity_type[i], einputs.commodity_amounts[i]);
811 float wage_estimation =
813 *
state.defines.alice_factory_per_level_employment
814 /
state.defines.alice_needs_scaling_factor
815 * effective_production_scale;
817 total_expenses += wage_estimation;
819 named_money_line(
"factory_stats_wage",
825 named_money_line(
"factory_stats_expenses",
829 output_cost_line(
type.get_output(),
type.get_output_amount());
833 named_money_line(
"factory_stats_desired_income",
849 auto p =
state.world.factory_get_province_from_factory_location(retrieve<dcon::factory_id>(
state,
parent));
858 auto commodity_mod_description = [&](
float value, std::string_view locale_base_name, std::string_view locale_farm_base_name) {
871 commodity_mod_description(
state.world.nation_get_factory_goods_output(n,
com),
"tech_output",
"tech_output");
872 commodity_mod_description(
state.world.nation_get_rgo_goods_output(n,
com),
"tech_mine_output",
"tech_farm_output");
873 commodity_mod_description(
state.world.nation_get_rgo_size(n,
com),
"tech_mine_size",
"tech_farm_size");
874 if(
state.world.commodity_get_key_factory(
com)) {
880 if(
state.world.commodity_get_is_mine(
com)) {
903 auto v = retrieve<economy::new_factory>(
state,
parent);
904 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
908 auto v = retrieve<economy::new_factory>(
state,
parent);
909 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
922 auto v = retrieve<economy::upgraded_factory>(
state,
parent);
923 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
927 auto v = retrieve<economy::upgraded_factory>(
state,
parent);
928 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
942 std::vector<element_base*> factory_elements;
943 std::vector<element_base*> upgrade_elements;
944 std::vector<element_base*> build_elements;
945 std::vector<element_base*> closed_elements;
946 dcon::commodity_id output_commodity;
952 if(
name ==
"prod_factory_bg") {
953 return make_element_by_type<normal_factory_background>(
state,
id);
954 }
else if(
name ==
"level") {
955 auto ptr = make_element_by_type<factory_level_text>(
state,
id);
956 factory_elements.push_back(ptr.get());
958 }
else if(
name ==
"income") {
959 auto ptr = make_element_by_type<factory_profit_text>(
state,
id);
960 factory_elements.push_back(ptr.get());
962 }
else if(
name ==
"income_icon") {
963 auto ptr = make_element_by_type<factory_income_image>(
state,
id);
964 factory_elements.push_back(ptr.get());
966 }
else if(
name ==
"output") {
967 return make_element_by_type<commodity_image>(
state,
id);
968 }
else if(
name ==
"closed_overlay") {
969 return make_element_by_type<invisible_element>(
state,
id);
970 }
else if(
name ==
"factory_closed_text") {
971 return make_element_by_type<invisible_element>(
state,
id);
972 }
else if(
name ==
"prod_factory_inprogress_bg") {
973 auto ptr = make_element_by_type<image_element_base>(
state,
id);
974 build_elements.push_back(ptr.get());
976 }
else if(
name ==
"build_factory_progress") {
977 auto ptr = make_element_by_type<factory_build_progress_bar>(
state,
id);
978 build_elements.push_back(ptr.get());
980 }
else if(
name ==
"prod_cancel_progress") {
981 auto ptr = make_element_by_type<factory_cancel_new_const_button>(
state,
id);
982 build_elements.push_back(ptr.get());
984 }
else if(
name ==
"upgrade_factory_progress") {
985 auto ptr = make_element_by_type<factory_upgrade_progress_bar>(
state,
id);
986 upgrade_elements.push_back(ptr.get());
988 }
else if(
name ==
"progress_overlay_16_64") {
989 auto ptr = make_element_by_type<image_element_base>(
state,
id);
990 upgrade_elements.push_back(ptr.get());
992 }
else if(
name ==
"employment_ratio") {
993 auto ptr = make_element_by_type<factory_employment_image>(
state,
id);
994 factory_elements.push_back(ptr.get());
996 }
else if(
name ==
"priority") {
997 auto ptr = make_element_by_type<factory_priority_button>(
state,
id);
998 factory_elements.push_back(ptr.get());
1000 }
else if(
name ==
"upgrade") {
1001 auto ptr = make_element_by_type<factory_upgrade_button>(
state,
id);
1002 factory_elements.push_back(ptr.get());
1004 }
else if(
name ==
"subsidise") {
1005 auto ptr = make_element_by_type<factory_subsidise_button>(
state,
id);
1006 factory_elements.push_back(ptr.get());
1008 }
else if(
name ==
"delete_factory") {
1009 auto ptr = make_element_by_type<factory_delete_button>(
state,
id);
1010 closed_elements.push_back(ptr.get());
1012 }
else if(
name ==
"open_close") {
1013 auto ptr = make_element_by_type<factory_reopen_button>(
state,
id);
1014 closed_elements.push_back(ptr.get());
1015 auto ptrb = make_element_by_type<factory_close_and_delete_button>(
state,
id);
1016 factory_elements.push_back(ptrb.get());
1019 }
else if(
name.substr(0, 6) ==
"input_") {
1020 auto input_index = size_t(std::stoi(std::string(
name.substr(6))));
1021 if(
name.ends_with(
"_lack2")) {
1022 auto ptr = make_element_by_type<image_element_base>(
state,
id);
1023 input_lack_icons[input_index] = ptr.
get();
1026 auto ptr = make_element_by_type<factory_input_icon>(
state,
id);
1039 auto content = any_cast<production_factory_slot_data>(payload);
1041 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
1042 dcon::factory_type_fat_id fat_btid(
state.world, dcon::factory_type_id{});
1043 if(std::holds_alternative<economy::new_factory>(content.activity)) {
1048 for(
auto const& e : factory_elements)
1049 e->set_visible(
state,
false);
1050 for(
auto const& e : upgrade_elements)
1051 e->set_visible(
state,
false);
1052 for(
auto const& e : build_elements)
1053 e->set_visible(
state,
true);
1054 for(
auto const& e : closed_elements)
1055 e->set_visible(
state,
false);
1056 }
else if(std::holds_alternative<economy::upgraded_factory>(content.activity)) {
1061 for(
auto const& e : factory_elements)
1062 e->set_visible(
state,
true);
1063 for(
auto const& e : upgrade_elements)
1064 e->set_visible(
state,
true);
1065 for(
auto const& e : build_elements)
1066 e->set_visible(
state,
false);
1067 for(
auto const& e : closed_elements)
1068 e->set_visible(
state,
false);
1071 dcon::factory_id fid = content.id;
1072 fat_btid =
state.world.factory_get_building_type(fid);
1075 for(
auto const& e : factory_elements)
1076 e->set_visible(
state,
true);
1077 for(
auto const& e : upgrade_elements)
1078 e->set_visible(
state,
false);
1079 for(
auto const& e : build_elements)
1080 e->set_visible(
state,
false);
1081 for(
auto const& e : closed_elements)
1082 e->set_visible(
state, is_closed);
1085 auto& cset = fat_btid.get_inputs();
1087 if(input_icons[
size_t(i)]) {
1088 dcon::commodity_id cid = cset.commodity_type[size_t(i)];
1089 input_icons[size_t(i)]->
frame = int32_t(
state.world.commodity_get_icon(cid));
1090 input_icons[size_t(i)]->
com = cid;
1091 bool is_lack = cid != dcon::commodity_id{} ?
state.world.nation_get_demand_satisfaction(n, cid) < 0.5f :
false;
1095 output_commodity = fat_btid.get_output().id;
1103 auto content = any_cast<production_factory_slot_data>(p_payload);
1104 if(payload.holds_type<dcon::factory_id>()) {
1105 payload.emplace<dcon::factory_id>(content.id);
1108 if(std::holds_alternative<economy::upgraded_factory>(content.activity))
1112 if(std::holds_alternative<economy::new_factory>(content.activity))
1115 }
else if(payload.holds_type<dcon::commodity_id>()) {
1116 payload.emplace<dcon::commodity_id>(output_commodity);
1118 }
else if(payload.holds_type<dcon::province_id>()) {
1119 payload.emplace<dcon::province_id>(
state.world.factory_get_province_from_factory_location(content.id));
1130 std::vector<element_base*> infos;
1131 std::vector<state_factory_slot> factories;
1136 auto content = any_cast<commodity_filter_query_data>(payload);
1137 return content.filter;
1145 int16_t num_cols = 8;
1147 for(int16_t factory_index = 0; factory_index < int16_t(
state.defines.factories_per_state); ++factory_index) {
1148 auto ptr = make_element_by_type<production_factory_info>(
state,
1150 ptr->index =
uint8_t(factory_index);
1151 ptr->base_data.position.x = (factory_index % num_cols) * ptr->base_data.size.x;
1152 ptr->base_data.position.y += std::max<int16_t>(0, (factory_index / num_cols) * (ptr->base_data.size.y - 26));
1153 infos.push_back(ptr.get());
1157 * ((int16_t(
state.defines.factories_per_state) + num_cols - 1) / num_cols);
1161 auto state_id = retrieve<dcon::state_instance_id>(
state,
parent);
1163 for(
auto const c : infos)
1164 c->set_visible(
state,
false);
1166 std::vector<bool> visited_types(
state.world.factory_type_size(),
false);
1170 dcon::commodity_id cid =
state.world.factory_type_get_output(nf.type).id;
1171 if(!visited_types[nf.type.index()] && get_filter(
state, cid) && index <
state.defines.factories_per_state) {
1172 factories[index].activity = nf;
1173 factories[index].id = dcon::factory_id{};
1174 visited_types[nf.type.index()] =
true;
1175 infos[index]->set_visible(
state,
true);
1181 dcon::commodity_id cid =
state.world.factory_type_get_output(uf.
type).id;
1182 if(!visited_types[uf.
type.index()] && get_filter(
state, cid) && index <
state.defines.factories_per_state) {
1183 factories[index].activity = uf;
1184 province::for_each_province_in_state_instance(state, state_id, [&](dcon::province_id prov) {
1185 for(auto fa : state.world.province_get_factory_location(prov)) {
1186 if(fa.get_factory().get_building_type() == uf.type) {
1187 factories[index].id = fa.get_factory().id;
1192 visited_types[uf.
type.index()] =
true;
1193 infos[index]->set_visible(
state,
true);
1199 dcon::fatten(
state.world, pid).for_each_factory_location_as_province([&](dcon::factory_location_id flid) {
1200 dcon::factory_id fid =
state.world.factory_location_get_factory(flid);
1201 dcon::factory_type_id ftid =
state.world.factory_get_building_type(fid);
1202 dcon::commodity_id cid =
state.world.factory_type_get_output(ftid).
id;
1203 if(!visited_types[ftid.index()] && get_filter(state, cid) && index <
state.defines.factories_per_state) {
1204 factories[index].activity = std::monostate{};
1206 infos[index]->set_visible(state,
true);
1215 auto content = any_cast<production_factory_slot_data>(payload);
1216 auto index = content.index;
1218 content.index = index;
1220 return message_result::consumed;
1222 return message_result::unseen;
1229 const dcon::province_id pid = retrieve<dcon::province_id>(
state, parent);
1230 const dcon::state_instance_id sid =
state.world.province_get_state_membership(pid);
1231 const dcon::nation_id n = retrieve<dcon::nation_id>(
state, parent);
1233 bool can_build =
false;
1234 state.world.for_each_factory_type([&](dcon::factory_type_id ftid) {
1238 disabled = !can_build;
1243 const dcon::province_id pid = retrieve<dcon::province_id>(
state, parent);
1244 const dcon::state_instance_id sid =
state.world.province_get_state_membership(pid);
1254 return tooltip_behavior::variable_tooltip;
1258 const dcon::province_id pid = retrieve<dcon::province_id>(
state, parent);
1259 const dcon::state_instance_id sid =
state.world.province_get_state_membership(pid);
1260 const dcon::nation_id n = retrieve<dcon::nation_id>(
state, parent);
1262 bool non_colonial = !
state.world.province_get_is_colonial(
state.world.state_instance_get_capital(sid));
1264 bool is_civilized =
state.world.nation_get_is_civilized(n);
1272 if(n ==
state.local_player_nation) {
1273 auto rules =
state.world.nation_get_combined_issue_rules(n);
1280 auto target =
state.world.nation_get_combined_issue_rules(n);
1289 auto r = num_factories < int32_t(
state.defines.factories_per_state);
1305 const dcon::state_instance_id sid = retrieve<dcon::state_instance_id>(
state, parent);
1306 const dcon::nation_id n = retrieve<dcon::nation_id>(
state, parent);
1308 bool can_build =
false;
1309 state.world.for_each_factory_type([&](dcon::factory_type_id ftid) {
1313 disabled = !can_build;
1318 dcon::state_instance_id sid = retrieve<dcon::state_instance_id>(
state, parent);
1324 return tooltip_behavior::variable_tooltip;
1328 const dcon::state_instance_id sid = retrieve<dcon::state_instance_id>(
state, parent);
1329 const dcon::nation_id n = retrieve<dcon::nation_id>(
state, parent);
1331 bool non_colonial = !
state.world.province_get_is_colonial(
state.world.state_instance_get_capital(sid));
1333 bool is_civilized =
state.world.nation_get_is_civilized(n);
1341 if(n ==
state.local_player_nation) {
1342 auto rules =
state.world.nation_get_combined_issue_rules(n);
1349 auto target =
state.world.nation_get_combined_issue_rules(n);
1358 auto r = num_factories < int32_t(
state.defines.factories_per_state);
1373 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1374 return bool(
state.world.state_instance_get_owner_focus(content).id)
1375 ?
state.world.state_instance_get_owner_focus(content).get_icon() - 1
1381 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1382 dcon::nation_id n = retrieve<dcon::nation_id>(
state, parent);
1384 for(
auto nfid :
state.world.in_national_focus) {
1387 frame = get_icon_frame(
state);
1391 auto sid = retrieve<dcon::state_instance_id>(
state, parent);
1396 auto sid = retrieve<dcon::state_instance_id>(
state, parent);
1401 return tooltip_behavior::variable_tooltip;
1407 auto sid = retrieve<dcon::state_instance_id>(
state, parent);
1411 auto content =
state.world.state_instance_get_owner_focus(sid);
1417 if(fat_nf.get_promotion_type()) {
1419 if(fat_nf.get_promotion_type() ==
state.culture_definitions.clergy) {
1423 }
else if(fat_nf.get_promotion_type() ==
state.culture_definitions.bureaucrat) {
1433 if(
auto mid =
state.world.national_focus_get_modifier(content); mid) {
1442 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1445 auto unemployed = total - employed;
1449 return tooltip_behavior::variable_tooltip;
1452 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1455 auto unemployed = total - employed;
1463 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1466 auto unemployed = total - employed;
1470 return tooltip_behavior::variable_tooltip;
1473 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1476 auto unemployed = total - employed;
1484 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1485 auto total =
state.world.state_instance_get_demographics(content,
1492 set_text(
state,
"0.0%");
1499 auto content = retrieve<dcon::state_instance_id>(
state, parent);
1501 float p_total = 0.0f;
1514 if(
name ==
"state_focus") {
1515 return make_element_by_type<production_national_focus_button>(
state,
id);
1516 }
else if(
name ==
"state_name") {
1517 return make_element_by_type<state_name_text>(
state,
id);
1518 }
else if(
name ==
"factory_count") {
1519 auto temp = make_element_by_type<state_factory_count_text>(
state,
id);
1522 }
else if(
name ==
"build_new_factory") {
1523 return make_element_by_type<production_build_new_factory>(
state,
id);
1524 }
else if(
name ==
"avg_infra_text") {
1525 return make_element_by_type<state_infrastructure>(
state,
id);
1526 }
else if(
name ==
"factory_info_bounds") {
1527 return make_element_by_type<production_factory_info_bounds_window>(
state,
id);
1534 constexpr int16_t num_cols = 8;
1535 base_data.size.y +=
state.ui_defs.gui[
state.ui_state.
defs_by_name.find(
state.lookup_key(
"factory_info"))->second.definition].size.y
1536 * (((int16_t(
state.defines.factories_per_state) + num_cols - 1) / num_cols) - 1);
1539 xy_pair base_sort_template_offset =
1543 auto text_elm = std::make_unique< per_state_primary_worker_amount>();
1544 memcpy(&(text_elm->base_data), &factory_number_def,
sizeof(
ui::element_data));
1545 text_elm->base_data.position.x = int16_t(500 + base_sort_template_offset.
x * 0);
1546 text_elm->on_create(
state);
1547 add_child_to_front(std::move(text_elm));
1550 auto text_elm = std::make_unique< per_state_secondary_worker_amount>();
1551 memcpy(&(text_elm->base_data), &factory_number_def,
sizeof(
ui::element_data));
1552 text_elm->base_data.position.x = int16_t(500 + base_sort_template_offset.x * 1);
1553 text_elm->on_create(
state);
1554 add_child_to_front(std::move(text_elm));
1557 auto text_elm = std::make_unique< per_state_capitalist_amount>();
1558 memcpy(&(text_elm->base_data), &factory_number_def,
sizeof(
ui::element_data));
1559 text_elm->base_data.position.x = int16_t(500 + base_sort_template_offset.x * 2);
1560 text_elm->on_create(state);
1561 add_child_to_front(std::move(text_elm));
1575 return "state_info";
1582 row_contents.clear();
1584 auto show_empty = retrieve<bool>(
state, parent);
1585 dcon::nation_id n = retrieve<production_foreign_invest_target>(
state, parent).n;
1593 if(payload.holds_type<dcon::nation_id>()) {
1594 payload.emplace<dcon::nation_id>(retrieve<production_foreign_invest_target>(
state, parent).n);
1595 return message_result::consumed;
1597 return message_result::unseen;
1604 return "state_info";
1611 row_contents.clear();
1613 auto show_empty = retrieve<bool>(
state, parent);
1614 const dcon::nation_id n = retrieve<dcon::nation_id>(
state, parent);
1627 return "military_goods";
1629 return "raw_material_goods";
1631 return "industrial_goods";
1633 return "consumer_goods";
1636 return "industrial_and_consumer_goods";
1644 if(
name ==
"cat_name") {
1645 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1646 goods_cat_name = ptr.
get();
1655 auto group = any_cast<sys::commodity_group>(payload);
1657 return message_result::consumed;
1659 return message_result::unseen;
1665 auto content = retrieve<dcon::commodity_id>(
state, parent);
1675 for(
auto province_ownership :
state.world.nation_get_province_ownership(nation)) {
1676 auto province = province_ownership.get_province();
1684 for(
auto province_ownership :
state.world.nation_get_province_ownership(nation)) {
1685 auto province = province_ownership.get_province();
1686 for(
auto fac :
province.get_factory_location()) {
1687 if(fac.get_factory().get_building_type().get_output() == content) {
1705 auto content = retrieve<dcon::commodity_id>(
state, parent);
1716 for(
auto province_ownership :
state.world.nation_get_province_ownership(nation)) {
1717 auto province = province_ownership.get_province();
1718 for(
auto fac :
province.get_factory_location()) {
1719 if(fac.get_factory().get_building_type().get_output() == content) {
1728 for(
auto province_ownership :
state.world.nation_get_province_ownership(nation)) {
1729 auto province = province_ownership.get_province();
1730 for(
auto fac :
province.get_factory_location()) {
1731 if(fac.get_factory().get_building_type().get_output() == content) {
1747 auto commodity_id = retrieve<dcon::commodity_id>(
state, parent);
1761 if(
name ==
"output_factory") {
1762 return make_element_by_type<commodity_image>(
state,
id);
1763 }
else if(
name ==
"output_total") {
1764 auto ptr = make_element_by_type<commodity_player_production_text>(
state,
id);
1765 good_output_total = ptr.
get();
1767 }
else if(
name ==
"prod_producing_not_total") {
1768 auto ptr = make_element_by_type<image_element_base>(
state,
id);
1769 good_not_producing_overlay = ptr.
get();
1771 }
else if(
name ==
"pop_factory") {
1772 auto ptr = make_element_by_type<image_element_base>(
state,
id);
1773 ptr->frame = int32_t(
dcon::fatten(
state.world,
state.culture_definitions.primary_factory_worker).get_sprite() - 1);
1775 }
else if(
name ==
"pop_factory2") {
1776 auto ptr = make_element_by_type<image_element_base>(
state,
id);
1777 ptr->frame = int32_t(
dcon::fatten(
state.world,
state.culture_definitions.secondary_factory_worker).get_sprite() - 1);
1779 }
else if(
name ==
"output") {
1780 return make_element_by_type<commodity_primary_worker_amount>(
state,
id);
1781 }
else if(
name ==
"output2") {
1782 return make_element_by_type<commodity_secondary_worker_amount>(
state,
id);
1796 if(payload.holds_type<dcon::commodity_id>()) {
1797 payload.emplace<dcon::commodity_id>(commodity_id);
1798 return message_result::consumed;
1800 return message_result::unseen;
1810 .header =
"method_name",
1817 return a.index() < b.index();
1823 .cell_definition_string =
"thin_cell_name",
1824 .header_definition_string =
"thin_cell_name"
1829 .header =
"method_input",
1836 return a.index() < b.index();
1846 .header =
"method_output",
1853 return a.index() < b.index();
1863 .header =
"method_profit",
1872 return a.index() < b.index();
1883 .header =
"method_margin",
1896 return a.index() < b.index();
1908 .header =
"method_cost",
1916 return a.index() < b.index();
1926 .header =
"method_payback",
1934 av = std::max(0.f, av);
1935 bv = std::max(0.f, bv);
1942 return a.index() < b.index();
1947 value = std::max(0.f, value);
1955 bool show_empty_states =
true;
1956 std::unique_ptr<bool[]> show_output_commodity;
1966 dcon::state_instance_id focus_state{};
1967 dcon::nation_id foreign_nation{};
1968 xy_pair base_commodity_offset{33, 50};
1969 xy_pair commodity_offset{33, 50};
1971 std::vector<element_base*> factory_elements;
1972 std::vector<element_base*> investment_brow_elements;
1973 std::vector<element_base*> project_elements;
1974 std::vector<element_base*> good_elements;
1975 std::vector<element_base*> investment_nation;
1976 std::vector<bool> commodity_filters;
1977 bool open_foreign_invest =
false;
1979 void set_visible_vector_elements(
sys::state&
state, std::vector<element_base*>& elements,
bool v)
noexcept {
1980 for(
auto element : elements)
1981 element->set_visible(
state, v);
1985 set_visible_vector_elements(
state, factory_elements,
false);
1986 set_visible_vector_elements(
state, investment_brow_elements,
false);
1987 set_visible_vector_elements(
state, project_elements,
false);
1988 set_visible_vector_elements(
state, good_elements,
false);
1989 set_visible_vector_elements(
state, investment_nation,
false);
1994 generic_tabbed_window::on_create(
state);
1997 commodity_filters.resize(
state.world.commodity_size(),
true);
2057 auto ptr = make_element_by_type<national_focus_window>(
state,
"state_focus_window");
2058 ptr->set_visible(
state,
false);
2060 add_child_to_front(std::move(ptr));
2063 auto win = make_element_by_type<factory_build_window>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"build_factory"))->second.definition);
2064 build_win = win.
get();
2065 add_child_to_front(std::move(win));
2067 auto win2 = make_element_by_type<project_investment_window>(
state,
2069 win2->set_visible(
state,
false);
2070 project_window = win2.
get();
2071 add_child_to_front(std::move(win2));
2073 show_output_commodity = std::unique_ptr<bool[]>(
new bool[
state.world.commodity_size()]);
2074 set_visible(
state,
false);
2077 if(
name ==
"main_bg") {
2078 return make_element_by_type<image_element_base>(
state,
id);
2079 }
else if(
name ==
"table_production_methods") {
2080 std::vector<table::column<dcon::factory_type_id>> columns = {
2090 auto ptr = make_element_by_type<table::display<dcon::factory_type_id>>(
2093 std::string(
"table_production_methods_body"),
2096 ptr->set_visible(
state,
false);
2098 state.world.for_each_factory_type([&](dcon::factory_type_id ft) {
2099 ptr->content.data.push_back(ft);
2102 good_elements.push_back(ptr.get());
2104 }
else if(
name ==
"prod_bg") {
2105 return make_element_by_type<opaque_element_base>(
state,
id);
2106 }
else if(
name ==
"close_button") {
2107 return make_element_by_type<generic_close_button>(
state,
id);
2108 }
else if(
name ==
"tab_factories") {
2109 auto ptr = make_element_by_type<generic_tab_button<production_window_tab>>(
state, id);
2110 ptr->target = production_window_tab::factories;
2112 }
else if(
name ==
"tab_invest") {
2113 auto ptr = make_element_by_type<generic_tab_button<production_window_tab>>(
state, id);
2114 ptr->target = production_window_tab::investments;
2116 }
else if(
name ==
"tab_popprojects") {
2117 auto ptr = make_element_by_type<generic_tab_button<production_window_tab>>(
state, id);
2118 ptr->target = production_window_tab::projects;
2120 }
else if(
name ==
"tab_goodsproduction") {
2121 auto ptr = make_element_by_type<generic_tab_button<production_window_tab>>(
state, id);
2122 ptr->target = production_window_tab::goods;
2124 }
else if(
name ==
"tab_factories_text") {
2125 return make_element_by_type<invisible_element>(
state,
id);
2126 }
else if(
name ==
"tab_invest_text") {
2127 return make_element_by_type<invisible_element>(
state,
id);
2128 }
else if(
name ==
"tab_goodsproduction_text") {
2129 return make_element_by_type<invisible_element>(
state,
id);
2130 }
else if(
name ==
"tab_popprojects_text") {
2131 return make_element_by_type<invisible_element>(
state,
id);
2132 }
else if(
name ==
"factory_buttons") {
2133 auto ptr = make_element_by_type<factory_buttons_window>(
state,
id);
2134 factory_elements.push_back(ptr.get());
2135 ptr->set_visible(
state,
true);
2137 }
else if(
name ==
"invest_buttons") {
2138 auto ptr = make_element_by_type<production_foreign_investment_window>(
state,
id);
2139 foreign_invest_win = ptr.
get();
2140 investment_nation.push_back(ptr.get());
2141 ptr->set_visible(
state,
false);
2143 }
else if(
name ==
"state_listbox") {
2144 auto ptr = make_element_by_type<production_state_listbox>(
state,
id);
2145 state_listbox = ptr.
get();
2146 factory_elements.push_back(ptr.get());
2147 ptr->set_visible(
state,
true);
2149 }
else if(
name ==
"state_listbox_invest") {
2150 auto ptr = make_element_by_type<production_state_invest_listbox>(
state,
id);
2151 state_listbox_invest = ptr.
get();
2152 investment_nation.push_back(ptr.get());
2153 ptr->set_visible(
state,
false);
2155 }
else if(
name ==
"investment_browser") {
2156 auto ptr = make_element_by_type<invest_brow_window>(
state,
id);
2157 investment_brow_elements.push_back(ptr.get());
2158 ptr->set_visible(
state,
false);
2160 }
else if(
name ==
"sort_by_state") {
2161 auto ptr = make_element_by_type<button_element_base>(
state,
id);
2162 project_elements.push_back(ptr.get());
2163 ptr->set_visible(
state,
false);
2165 }
else if(
name ==
"sort_by_projects") {
2166 auto ptr = make_element_by_type<button_element_base>(
state,
id);
2167 project_elements.push_back(ptr.get());
2168 ptr->set_visible(
state,
false);
2170 }
else if(
name ==
"sort_by_completion") {
2171 auto ptr = make_element_by_type<button_element_base>(
state,
id);
2172 project_elements.push_back(ptr.get());
2173 ptr->set_visible(
state,
false);
2175 }
else if(
name ==
"sort_by_projecteers") {
2176 auto ptr = make_element_by_type<button_element_base>(
state,
id);
2177 project_elements.push_back(ptr.get());
2178 ptr->set_visible(
state,
false);
2180 }
else if(
name ==
"pop_sort_buttons") {
2181 auto ptr = make_element_by_type<pop_sort_buttons_window>(
state,
id);
2182 factory_elements.push_back(ptr.get());
2183 ptr->set_visible(
state,
true);
2185 }
else if(
name ==
"project_listbox") {
2186 auto ptr = make_element_by_type<production_project_listbox>(
state,
id);
2187 project_elements.push_back(ptr.get());
2188 ptr->set_visible(
state,
false);
2197 auto enum_val = any_cast<production_window_tab>(payload);
2198 hide_sub_windows(
state);
2200 case production_window_tab::factories:
2201 set_visible_vector_elements(
state, factory_elements,
true);
2203 case production_window_tab::investments:
2204 set_visible_vector_elements(
state, investment_brow_elements,
true);
2207 case production_window_tab::projects:
2208 set_visible_vector_elements(
state, project_elements,
true);
2210 case production_window_tab::goods:
2211 set_visible_vector_elements(
state, good_elements,
true);
2214 active_tab = enum_val;
2215 return message_result::consumed;
2218 return message_result::consumed;
2220 hide_sub_windows(
state);
2221 auto target = any_cast<open_investment_nation>(payload).id;
2222 active_tab = production_window_tab::investments;
2224 set_visible_vector_elements(
state, investment_nation,
true);
2225 return message_result::consumed;
2227 auto sort_type = any_cast<production_sort_order>(payload);
2231 state_listbox_invest->
sort_order = sort_type;
2234 }
else if(payload.holds_type<dcon::state_instance_id>()) {
2235 payload.emplace<dcon::state_instance_id>(focus_state);
2236 return message_result::consumed;
2238 auto data = any_cast<production_selection_wrapper>(payload);
2239 focus_state = data.data;
2242 move_child_to_front(build_win);
2246 move_child_to_front(nf_win);
2248 impl_on_update(
state);
2249 return message_result::consumed;
2250 }
else if(payload.holds_type<
bool>()) {
2251 payload.emplace<
bool>(show_empty_states);
2252 return message_result::consumed;
2254 show_empty_states = any_cast<element_selection_wrapper<bool>>(payload).data;
2255 impl_on_update(
state);
2256 return message_result::consumed;
2258 auto content = any_cast<commodity_filter_query_data>(payload);
2259 content.filter = commodity_filters[content.cid.index()];
2261 return message_result::consumed;
2263 auto content = any_cast<commodity_filter_toggle_data>(payload);
2264 commodity_filters[content.data.index()] = !commodity_filters[content.data.index()];
2265 impl_on_update(
state);
2266 return message_result::consumed;
2268 auto content = any_cast<element_selection_wrapper<production_action>>(payload).data;
2270 case production_action::investment_window:
2273 case production_action::foreign_invest_window:
2279 impl_on_update(
state);
2280 return message_result::consumed;
2282 foreign_nation = any_cast<element_selection_wrapper<dcon::nation_id>>(payload).data;
2283 open_foreign_invest =
true;
2285 return message_result::consumed;
2286 }
else if(payload.holds_type<dcon::nation_id>()) {
2288 payload.emplace<dcon::nation_id>(foreign_nation);
2290 payload.emplace<dcon::nation_id>(
state.local_player_nation);
2291 return message_result::consumed;
2293 return message_result::unseen;
2297void open_foreign_investment(
sys::state& state, dcon::nation_id n);
2298void open_build_foreign_factory(
sys::state& state, dcon::state_instance_id st);
void on_update(sys::state &state) noexcept override
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
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::commodity_id commodity_id
void on_update(sys::state &state) 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)
void for_each_new_factory(sys::state &state, dcon::state_instance_id s, F &&func)
float factory_type_input_cost(sys::state &state, dcon::nation_id n, dcon::factory_type_id factory_type)
float factory_desired_raw_profit(dcon::factory_fat_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 &state, dcon::nation_id n, dcon::factory_type_fat_id fac_type)
commodity_production_type get_commodity_production_type(sys::state &state, dcon::commodity_id c)
int32_t factory_priority(sys::state const &state, dcon::factory_id f)
constexpr float factory_closed_threshold
float factory_throughput_multiplier(sys::state &state, dcon::factory_type_fat_id fac_type, dcon::nation_id n, dcon::province_id p, dcon::state_instance_id s)
float pop_factory_min_wage(sys::state &state, dcon::nation_id n, float min_wage_factor)
float factory_max_production_scale(sys::state &state, dcon::factory_fat_id fac, float mobilization_impact, bool occupied)
float commodity_daily_production_amount(sys::state &state, dcon::commodity_id c)
void for_each_upgraded_factory(sys::state &state, dcon::state_instance_id s, F &&func)
float factory_secondary_employment(sys::state const &state, dcon::factory_id f)
float pop_min_wage_factor(sys::state &state, dcon::nation_id n)
float factory_input_multiplier(sys::state &state, dcon::factory_fat_id fac, dcon::nation_id n, dcon::province_id p, dcon::state_instance_id s)
float factory_input_total_cost(sys::state &state, dcon::nation_id n, dcon::factory_type_fat_id fac_type)
float factory_e_input_total_cost(sys::state &state, dcon::nation_id n, dcon::factory_type_fat_id fac_type)
float factory_type_output_cost(sys::state &state, dcon::nation_id n, dcon::factory_type_id factory_type)
float factory_primary_employment(sys::state const &state, dcon::factory_id f)
float get_artisan_distribution_slow(sys::state &state, dcon::nation_id n, dcon::commodity_id c)
float factory_output_multiplier(sys::state &state, dcon::factory_fat_id fac, dcon::nation_id n, dcon::province_id p)
float factory_min_e_input_available(sys::state &state, dcon::nation_id n, dcon::factory_type_fat_id fac_type)
float factory_type_build_cost(sys::state &state, dcon::nation_id n, dcon::factory_type_id factory_type)
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 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_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
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