3#include "dcon_generated.hpp"
14 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
23 auto c = retrieve<dcon::commodity_id>(
state,
parent);
31 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
40 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
49 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
58 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
68 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
78 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
86 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
95 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
104 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
113 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
144template<trade_sort Sort, trade_sort_assoc Assoc>
165 if(
name ==
"goods_type") {
166 return make_element_by_type<commodity_image>(
state,
id);
167 }
else if(
name ==
"cost") {
168 return make_element_by_type<commodity_price_text>(
state,
id);
169 }
else if(
name ==
"activity") {
170 return make_element_by_type<commodity_player_availability_text>(
state,
id);
179 return "market_activity_entry";
191 state.world.for_each_commodity([&](dcon::commodity_id
id) {
199 return a.index() < b.index();
204 auto av = state.world.commodity_get_current_price(a);
205 auto bv = state.world.commodity_get_current_price(b);
209 return a.index() < b.index();
214 auto av = state.world.nation_get_demand_satisfaction(state.local_player_nation, a);
215 auto bv = state.world.nation_get_demand_satisfaction(state.local_player_nation, b);
219 return a.index() < b.index();
235 if(
name ==
"goods_type") {
236 return make_element_by_type<commodity_image>(
state,
id);
237 }
else if(
name ==
"value") {
238 return make_element_by_type<commodity_national_player_stockpile_text>(
state,
id);
239 }
else if(
name ==
"change") {
240 return make_element_by_type<commodity_player_stockpile_increase_text>(
state,
id);
249 return "stockpile_entry";
261 state.world.for_each_commodity([&](dcon::commodity_id
id) {
263 row_contents.push_back(id);
269 return a.index() < b.index();
274 auto av = state.world.nation_get_stockpiles(state.local_player_nation, a);
275 auto bv = state.world.nation_get_stockpiles(state.local_player_nation, b);
279 return a.index() < b.index();
284 auto av = economy::stockpile_commodity_daily_increase(state, a, state.local_player_nation);
285 auto bv = economy::stockpile_commodity_daily_increase(state, b, state.local_player_nation);
289 return a.index() < b.index();
305 if(
name ==
"goods_type") {
306 return make_element_by_type<commodity_image>(
state,
id);
307 }
else if(
name ==
"total") {
308 return make_element_by_type<commodity_global_market_text>(
state,
id);
309 }
else if(
name ==
"produce_change") {
310 return make_element_by_type<commodity_player_real_demand_text>(
state,
id);
311 }
else if(
name ==
"exported") {
312 return make_element_by_type<commodity_player_domestic_market_text>(
state,
id);
321 return "common_market_entry";
332 state.world.for_each_commodity([&](dcon::commodity_id
id) {
340 return a.index() < b.index();
345 auto av = state.world.commodity_get_global_market_pool(a);
346 auto bv = state.world.commodity_get_global_market_pool(b);
350 return a.index() < b.index();
355 auto av = state.world.nation_get_real_demand(state.local_player_nation, a);
356 auto bv = state.world.nation_get_real_demand(state.local_player_nation, b);
360 return a.index() < b.index();
365 auto av = state.world.nation_get_domestic_market_pool(state.local_player_nation, a);
366 auto bv = state.world.nation_get_domestic_market_pool(state.local_player_nation, b);
370 return a.index() < b.index();
387 if(
name ==
"goods_type") {
388 return make_element_by_type<commodity_image>(
state,
id);
389 }
else if(
name ==
"value") {
390 return make_element_by_type<T>(
state,
id);
400 return "goods_needs_entry";
411 state.world.for_each_commodity([&](dcon::commodity_id
id) {
413 row_contents.push_back(id);
419 return a.index() < b.index();
424 auto av = economy::government_consumption(state, state.local_player_nation, a);
425 auto bv = economy::government_consumption(state, state.local_player_nation, b);
429 return a.index() < b.index();
445 return "goods_needs_entry";
456 state.world.for_each_commodity([&](dcon::commodity_id
id) {
458 row_contents.push_back(id);
464 return a.index() < b.index();
469 auto av = economy::nation_factory_consumption(state, state.local_player_nation, a);
470 auto bv = economy::nation_factory_consumption(state, state.local_player_nation, b);
474 return a.index() < b.index();
490 return "goods_needs_entry";
501 state.world.for_each_commodity([&](dcon::commodity_id
id) {
503 row_contents.push_back(id);
509 return a.index() < b.index();
514 auto av = economy::nation_pop_consumption(state, state.local_player_nation, a);
515 auto bv = economy::nation_pop_consumption(state, state.local_player_nation, b);
519 return a.index() < b.index();
542 auto com = retrieve<dcon::commodity_id>(
state,
parent);
543 auto sat =
state.world.nation_get_demand_satisfaction(
state.local_player_nation, com);
551 }
else if(sat >= 1.f) {
580 auto com = retrieve<dcon::commodity_id>(
state,
parent);
582 struct tagged_value {
586 static std::vector<tagged_value> producers;
589 for(
auto n :
state.world.in_nation) {
590 if(n.get_domestic_market_pool(com) >= 0.05f) {
591 producers.push_back(tagged_value{ n.get_domestic_market_pool(com), n.id });
594 if(producers.size() > 0) {
595 std::sort(producers.begin(), producers.end(), [](
auto const& a,
auto const& b) { return a.v > b.v; });
603 for(
uint32_t i = 0; i < producers.size() && i <
state.defines.great_nations_count; ++i) {
605 auto ident =
state.world.nation_get_identity_from_identity_holder(producers[i].n);
614 float r_total = 0.0f;
625 auto com = retrieve<dcon::commodity_id>(
state,
parent);
626 if(
state.world.nation_get_drawing_on_stockpiles(
state.local_player_nation, com)) {
627 if(
state.world.nation_get_stockpiles(
state.local_player_nation, com) > 0)
631 }
else if(
state.world.nation_get_stockpiles(
state.local_player_nation, com) <
state.world.nation_get_stockpile_targets(
state.local_player_nation, com)) {
639 auto com = retrieve<dcon::commodity_id>(
state,
parent);
640 if(
state.world.nation_get_drawing_on_stockpiles(
state.local_player_nation, com)) {
642 }
else if(
state.world.nation_get_stockpiles(
state.local_player_nation, com) <
state.world.nation_get_stockpile_targets(
state.local_player_nation, com)) {
651 auto com = retrieve<dcon::commodity_id>(
state,
parent);
652 if(
state.world.nation_get_drawing_on_stockpiles(
state.local_player_nation, com)) {
653 if(
state.world.nation_get_stockpiles(
state.local_player_nation, com) > 0)
655 }
else if(
state.world.nation_get_stockpiles(
state.local_player_nation, com) <
state.world.nation_get_stockpile_targets(
state.local_player_nation, com)) {
666 auto com = retrieve<dcon::commodity_id>(
state,
parent);
669 if(current_price > previous_price) {
671 }
else if(current_price < previous_price) {
683 if(
name ==
"entry_button") {
684 return make_element_by_type<trade_commodity_entry_button>(
state,
id);
685 }
else if(
name ==
"goods_type") {
686 return make_element_by_type<commodity_image>(
state,
id);
687 }
else if(
name ==
"price") {
688 auto ptr = make_element_by_type<commodity_effective_price_text>(
state,
id);
689 ptr->base_data.position.y += ptr->base_data.size.y / 2;
691 return make_element_by_type<commodity_price_text>(
state,
id);
692 }
else if(
name ==
"trend_indicator") {
693 return make_element_by_type<commodity_price_trend>(
state,
id);
694 }
else if(
name ==
"selling_indicator") {
695 return make_element_by_type<commodity_stockpile_indicator>(
state,
id);
696 }
else if(
name ==
"automation_indicator") {
697 return make_element_by_type<invisible_element>(
state,
id);
704 if(payload.holds_type<dcon::commodity_id>()) {
761 return !(*
this == o);
773 auto ptr = make_element_by_type<image_element_base>(
state,
id);
776 }
else if(
name ==
"title") {
777 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
780 }
else if(
name ==
"value") {
781 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
784 }
else if(
name ==
"output_icon") {
785 auto ptr = make_element_by_type<image_element_base>(
state,
id);
786 output_icon = ptr.
get();
794 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
806 auto ftid =
state.world.factory_get_building_type(fid);
809 amount +=
state.world.factory_get_actual_production(fid);
812 auto& inputs =
state.world.factory_type_get_inputs(ftid);
813 for(
uint32_t i = 0; i < inputs.set_size; ++i)
814 if(inputs.commodity_type[i] == commodity_id)
815 amount += inputs.commodity_amounts[i];
816 output_icon->
frame =
state.world.commodity_get_icon(
state.world.factory_type_get_output(ftid));
819 output_icon->
frame =
state.world.commodity_get_icon(
state.world.factory_type_get_output(ftid));
824 auto name =
state.world.factory_type_get_name(ftid);
838 auto name =
state.world.province_get_name(pid);
850 if(value->is_visible())
857 return "trade_flow_entry";
862 auto commodity_id = retrieve<dcon::commodity_id>(
state,
parent);
863 for(
auto const fat_stown_id :
state.world.nation_get_state_ownership(
state.local_player_nation)) {
865 auto fat_id = dcon::fatten(state.world, pid);
866 fat_id.for_each_factory_location_as_province([&](dcon::factory_location_id flid) {
867 auto fid = state.world.factory_location_get_factory(flid);
868 if(factory_func(fid)) {
869 trade_flow_data td{};
870 td.type = trade_flow_data::type::factory;
872 td.data.factory_id = fid;
873 td.trade_good = commodity_id;
874 row_contents.push_back(td);
878 if(
state.world.province_get_rgo_actual_production_per_good(pid, commodity_id) > 0.f) {
882 td.data.province_id = pid;
883 td.trade_good = commodity_id;
894 auto commodity_id = retrieve<dcon::commodity_id>(
state, parent);
896 row_contents.clear();
899 [&](dcon::factory_id fid) ->
bool {
900 auto ftid =
state.world.factory_get_building_type(fid);
901 return state.world.factory_type_get_output(ftid) == commodity_id;
903 trade_flow_data::value_type::produced_by);
910 auto commodity_id = retrieve<dcon::commodity_id>(
state, parent);
912 row_contents.clear();
915 [&](dcon::factory_id fid) ->
bool {
916 auto ftid =
state.world.factory_get_building_type(fid);
917 auto& inputs =
state.world.factory_type_get_inputs(ftid);
918 for(
uint32_t i = 0; i < inputs.set_size; ++i)
919 if(inputs.commodity_type[i] == commodity_id)
920 return inputs.commodity_amounts[i] > 0.f;
923 trade_flow_data::value_type::used_by);
930 auto commodity_id = retrieve<dcon::commodity_id>(
state, parent);
932 row_contents.clear();
935 [&](dcon::factory_id fid) ->
bool {
936 auto ftid =
state.world.factory_get_building_type(fid);
937 auto& inputs =
state.world.factory_type_get_inputs(ftid);
938 for(
uint32_t i = 0; i < inputs.set_size; ++i)
939 if(inputs.commodity_type[i] == commodity_id)
940 return inputs.commodity_amounts[i] == 0.f;
943 trade_flow_data::value_type::may_be_used_by);
951 auto com = retrieve<dcon::commodity_id>(
state, parent);
952 distribution.clear();
953 for(
auto n :
state.world.in_nation)
954 if(n.get_owned_province_count() != 0)
955 distribution.emplace_back(n.id, n.get_domestic_market_pool(com));
963 auto com = retrieve<dcon::commodity_id>(
state, parent);
964 distribution.clear();
965 for(
auto n :
state.world.in_nation)
966 if(n.get_owned_province_count() != 0)
967 distribution.emplace_back(n.id, n.get_real_demand(com));
976 auto com = retrieve<dcon::commodity_id>(
state, parent);
977 distribution.clear();
981 for(
const auto pc :
state.world.nation_get_province_control(
state.local_player_nation)) {
982 for(
const auto fl : pc.get_province().get_factory_location()) {
983 if(fl.get_factory().get_building_type().get_output() == com)
984 amount += fl.get_factory().get_actual_production();
988 distribution.emplace_back(
state.culture_definitions.capitalists, amount);
992 for(
const auto pc :
state.world.nation_get_province_control(
state.local_player_nation)) {
993 amount += pc.get_province().get_rgo_actual_production_per_good(com);
996 distribution.emplace_back(
state.culture_definitions.aristocrat, amount);
999 auto amount =
state.world.nation_get_artisan_actual_production(
state.local_player_nation, com);
1001 distribution.emplace_back(
state.culture_definitions.artisans, amount);
1004 auto produced =
state.world.nation_get_domestic_market_pool(
state.local_player_nation, com);
1005 if(produced >= total) {
1006 distribution.emplace_back(
state.culture_definitions.laborers, total - produced);
1008 update_chart(
state);
1015 if(
name ==
"current_price_label") {
1016 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1018 ptr->base_data.size.x *= 2;
1020 }
else if(
name ==
"current_price_value"
1021 ||
name ==
"price_linechart"
1022 ||
name ==
"price_chart_low"
1023 ||
name ==
"price_chart_time") {
1024 return make_element_by_type<invisible_element>(
state,
id);
1025 }
else if(
name ==
"price_chart_high") {
1026 auto ptr = make_element_by_type<invisible_element>(
state,
id);
1028 auto ov_elm = make_element_by_type<image_element_base>(
state,
"generic_piechart_overlay");
1029 ov_elm->base_data.position.x = ptr->base_data.position.x;
1030 ov_elm->base_data.position.y = ptr->base_data.position.y;
1031 auto pc_elm = make_element_by_type<trade_flow_producers_piechart>(
state,
"generic_piechart");
1032 pc_elm->base_data.position.x += ov_elm->base_data.position.x;
1033 pc_elm->base_data.position.y += ov_elm->base_data.position.y;
1034 auto lg_elm = make_element_by_type<simple_text_element_base>(
state,
id);
1036 lg_elm->base_data.position.x = ptr->base_data.position.x;
1037 lg_elm->base_data.position.y = ptr->base_data.position.y - 8;
1038 add_child_to_front(std::move(lg_elm));
1039 add_child_to_front(std::move(pc_elm));
1040 add_child_to_front(std::move(ov_elm));
1043 auto ov_elm = make_element_by_type<image_element_base>(
state,
"generic_piechart_overlay");
1044 ov_elm->base_data.position.x = ptr->base_data.position.x + (ov_elm->base_data.size.x + 20) * 1;
1045 ov_elm->base_data.position.y = ptr->base_data.position.y;
1046 auto pc_elm = make_element_by_type<trade_flow_consumers_piechart>(
state,
"generic_piechart");
1047 pc_elm->base_data.position.x += ov_elm->base_data.position.x;
1048 pc_elm->base_data.position.y += ov_elm->base_data.position.y;
1049 auto lg_elm = make_element_by_type<simple_text_element_base>(
state,
id);
1051 lg_elm->base_data.position.x = ptr->base_data.position.x + (ov_elm->base_data.size.x + 20) * 1;
1052 lg_elm->base_data.position.y = ptr->base_data.position.y - 8;
1053 add_child_to_front(std::move(lg_elm));
1054 add_child_to_front(std::move(pc_elm));
1055 add_child_to_front(std::move(ov_elm));
1058 auto ov_elm = make_element_by_type<image_element_base>(
state,
"generic_piechart_overlay");
1059 ov_elm->base_data.position.x = ptr->base_data.position.x + (ov_elm->base_data.size.x + 20) * 2;
1060 ov_elm->base_data.position.y = ptr->base_data.position.y;
1061 auto pc_elm = make_element_by_type<trade_flow_workers_piechart>(
state,
"generic_piechart");
1062 pc_elm->base_data.position.x += ov_elm->base_data.position.x;
1063 pc_elm->base_data.position.y += ov_elm->base_data.position.y;
1064 auto lg_elm = make_element_by_type<simple_text_element_base>(
state,
id);
1066 lg_elm->base_data.position.x = ptr->base_data.position.x + (ov_elm->base_data.size.x + 20) * 2;
1067 lg_elm->base_data.position.y = ptr->base_data.position.y - 8;
1068 add_child_to_front(std::move(lg_elm));
1069 add_child_to_front(std::move(pc_elm));
1070 add_child_to_front(std::move(ov_elm));
1082 auto commodity_id = retrieve<dcon::commodity_id>(
state, parent);
1085 for(
auto const fat_stown_id :
state.world.nation_get_state_ownership(
state.local_player_nation)) {
1087 auto fat_id = dcon::fatten(state.world, pid);
1088 fat_id.for_each_factory_location_as_province([&](dcon::factory_location_id flid) {
1089 auto fid = state.world.factory_location_get_factory(flid);
1090 auto ftid = state.world.factory_get_building_type(fid);
1091 if(state.world.factory_type_get_output(ftid) == commodity_id)
1092 amount += state.world.factory_get_actual_production(fid);
1094 if(
state.world.province_get_rgo(pid) == commodity_id)
1095 amount +=
state.world.province_get_rgo_actual_production_per_good(pid, commodity_id);
1105 auto commodity_id = retrieve<dcon::commodity_id>(
state, parent);
1113 window_element_base::on_create(
state);
1114 set_visible(
state,
false);
1118 if(
name ==
"close_button") {
1119 return make_element_by_type<generic_close_button>(
state,
id);
1120 }
else if(
name ==
"trade_flow_bg") {
1121 return make_element_by_type<draggable_target>(
state,
id);
1122 }
else if(
name ==
"material_name") {
1123 return make_element_by_type<generic_name_text<dcon::commodity_id>>(
state, id);
1124 }
else if(
name ==
"material_icon_big") {
1125 return make_element_by_type<commodity_image>(
state,
id);
1126 }
else if(
name ==
"header_produced_by") {
1127 auto ptr = make_element_by_type<single_multiline_text_element_base>(
state,
id);
1130 }
else if(
name ==
"header_used_by") {
1131 auto ptr = make_element_by_type<single_multiline_text_element_base>(
state,
id);
1134 }
else if(
name ==
"header_may_be_used_by") {
1135 auto ptr = make_element_by_type<single_multiline_text_element_base>(
state,
id);
1138 }
else if(
name ==
"total_produced_text") {
1139 auto ptr = make_element_by_type<single_multiline_text_element_base>(
state,
id);
1141 ptr->base_data.position.x += 48;
1143 }
else if(
name ==
"total_used_text") {
1144 auto ptr = make_element_by_type<single_multiline_text_element_base>(
state,
id);
1146 ptr->base_data.position.x += 48;
1148 }
else if(
name ==
"total_produced_value") {
1149 return make_element_by_type<trade_flow_total_produced_text>(
state,
id);
1150 }
else if(
name ==
"total_used_value") {
1151 return make_element_by_type<trade_flow_total_used_text>(
state,
id);
1152 }
else if(
name ==
"price_graph") {
1153 return make_element_by_type<trade_flow_price_graph_window>(
state,
id);
1154 }
else if(
name ==
"produced_by_listbox") {
1155 return make_element_by_type<trade_flow_produced_by_listbox>(
state,
id);
1156 }
else if(
name ==
"used_by_listbox") {
1157 return make_element_by_type<trade_flow_used_by_listbox>(
state,
id);
1158 }
else if(
name ==
"may_be_used_by_listbox") {
1159 return make_element_by_type<trade_flow_may_be_used_by_listbox>(
state,
id);
1166template<sys::commodity_group Group>
1170 window_element_base::on_create(
state);
1173 state.world.for_each_commodity([&](dcon::commodity_id
id) {
1176 auto ptr = make_element_by_type<trade_commodity_entry>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"goods_entry"))->second.definition);
1177 ptr->commodity_id =
id;
1178 ptr->base_data.position = offset;
1179 offset.x += cell_size.
x;
1180 if(offset.x + cell_size.
x - 1 >= base_data.size.x) {
1182 offset.y += cell_size.y;
1183 if(offset.y + cell_size.y >= base_data.size.y) {
1184 offset.x += cell_size.x;
1188 add_child_to_front(std::move(ptr));
1201 auto price_a =
state.world.commodity_get_current_price(a);
1202 auto price_b =
state.world.commodity_get_current_price(b);
1203 return price_a < price_b;
1216 auto supply =
state.world.commodity_get_total_production(item);
1217 auto demand =
state.world.commodity_get_total_real_demand(item);
1218 auto balance = supply - demand;
1240 return value_a < value_b;
1243 auto value_a =
state.world.commodity_get_total_production(a);
1244 auto value_b =
state.world.commodity_get_total_production(b);
1245 return value_a < value_b;
1248 auto value_a =
state.world.commodity_get_total_real_demand(a);
1249 auto value_b =
state.world.commodity_get_total_real_demand(b);
1250 return value_a < value_b;
1253 auto supply_a =
state.world.commodity_get_total_production(a);
1254 auto demand_a =
state.world.commodity_get_total_real_demand(a);
1255 auto balance_a = supply_a - demand_a;
1257 auto supply_b =
state.world.commodity_get_total_production(b);
1258 auto demand_b =
state.world.commodity_get_total_real_demand(b);
1259 auto balance_b = supply_b - demand_b;
1261 return balance_a < balance_b;
1264 auto value_a =
state.world.commodity_get_global_market_pool(a);
1265 auto value_b =
state.world.commodity_get_global_market_pool(b);
1266 return value_a < value_b;
1269 auto value_a =
state.world.nation_get_stockpiles(
state.local_player_nation, a);
1270 auto value_b =
state.world.nation_get_stockpiles(
state.local_player_nation, b);
1271 return value_a < value_b;
1276 .header =
"trade_good_name_header",
1279 .cell_definition_string =
"thin_cell_name",
1280 .header_definition_string =
"thin_cell_name"
1287 .cell_definition_string =
"thin_cell_number"
1295 .cell_definition_string =
"thin_cell_number"
1302 .cell_definition_string =
"thin_cell_number"
1306 .header =
"balance",
1309 .cell_definition_string =
"thin_cell_number"
1313 .header =
"market_stockpiles",
1316 .cell_definition_string =
"thin_cell_number"
1320 .header =
"national_stockpile",
1323 .cell_definition_string =
"thin_cell_number"
1329 .header =
"government_need",
1336 return a.index() < b.index();
1346 .header =
"factory_need",
1353 return a.index() < b.index();
1363 .header =
"pop_need",
1370 return a.index() < b.index();
1380 .header =
"rgo_production",
1384 for(
auto p :
state.world.in_province) {
1385 if(p.get_nation_from_province_ownership()) {
1386 av += p.get_rgo_actual_production_per_good(a);
1389 for(
auto p :
state.world.in_province) {
1390 if(p.get_nation_from_province_ownership()) {
1391 bv += p.get_rgo_actual_production_per_good(b);
1397 return a.index() < b.index();
1401 for(
auto p :
state.world.in_province) {
1402 if(p.get_nation_from_province_ownership()) {
1403 value += p.get_rgo_actual_production_per_good(
id);
1412 .header =
"artisan_production",
1416 for(
auto n :
state.world.in_nation) {
1417 av +=
state.world.nation_get_artisan_actual_production(n, a);
1419 for(
auto n :
state.world.in_nation) {
1420 bv +=
state.world.nation_get_artisan_actual_production(n, b);
1425 return a.index() < b.index();
1429 for(
auto n :
state.world.in_nation) {
1430 value +=
state.world.nation_get_artisan_actual_production(n,
id);
1438 .header =
"factory_production",
1442 for(
auto f :
state.world.in_factory) {
1443 if(f.get_building_type().get_output() == a)
1444 av += f.get_actual_production();
1446 for(
auto f :
state.world.in_factory) {
1447 if(f.get_building_type().get_output() == b)
1448 bv += f.get_actual_production();
1453 return a.index() < b.index();
1457 for(
auto f :
state.world.in_factory) {
1458 if(f.get_building_type().get_output() == id)
1459 value += f.get_actual_production();
1467 .header =
"artisan_distribution",
1474 return a.index() < b.index();
1484 .header =
"artisan_distribution",
1486 auto av =
state.world.nation_get_demand_satisfaction(
state.local_player_nation, a);
1487 auto bv =
state.world.nation_get_demand_satisfaction(
state.local_player_nation, b);
1491 return a.index() < b.index();
1494 auto value =
state.world.nation_get_demand_satisfaction(
state.local_player_nation,
id);
1501 .header =
"produced_nation",
1503 auto av =
state.world.nation_get_domestic_market_pool(
state.local_player_nation, a);
1504 auto bv =
state.world.nation_get_domestic_market_pool(
state.local_player_nation, b);
1508 return a.index() < b.index();
1511 auto value =
state.world.nation_get_domestic_market_pool(
state.local_player_nation,
id);
1518 .header =
"consumed_nation",
1520 auto av =
state.world.nation_get_real_demand(
state.local_player_nation, a)
1521 *
state.world.nation_get_demand_satisfaction(
state.local_player_nation, a);
1522 auto bv =
state.world.nation_get_real_demand(
state.local_player_nation, b)
1523 *
state.world.nation_get_demand_satisfaction(
state.local_player_nation, b);
1527 return a.index() < b.index();
1530 auto value =
state.world.nation_get_real_demand(
state.local_player_nation,
id) *
1531 state.world.nation_get_demand_satisfaction(
state.local_player_nation,
id);
1538 .header =
"nation_name",
1545 return a.index() < b.index();
1551 .cell_definition_string =
"thin_cell_name",
1552 .header_definition_string =
"thin_cell_name"
1557 .header =
"produced_nation",
1559 dcon::commodity_id good = retrieve<dcon::commodity_id>(
state, container);
1560 auto av =
state.world.nation_get_domestic_market_pool(a, good);
1561 auto bv =
state.world.nation_get_domestic_market_pool(b, good);
1565 return a.index() < b.index();
1568 dcon::commodity_id good = retrieve<dcon::commodity_id>(
state, container);
1569 auto value =
state.world.nation_get_domestic_market_pool(
id, good);
1576 .header =
"demanded_nation",
1578 dcon::commodity_id good = retrieve<dcon::commodity_id>(
state, container);
1579 auto av =
state.world.nation_get_real_demand(a, good);
1580 auto bv =
state.world.nation_get_real_demand(b, good);
1584 return a.index() < b.index();
1587 dcon::commodity_id good = retrieve<dcon::commodity_id>(
state, container);
1588 auto value =
state.world.nation_get_real_demand(
id, good);
1595 .header =
"consumed_nation",
1597 dcon::commodity_id good = retrieve<dcon::commodity_id>(
state, container);
1598 auto av =
state.world.nation_get_real_demand(a, good)
1599 *
state.world.nation_get_demand_satisfaction(a, good);
1600 auto bv =
state.world.nation_get_real_demand(b, good)
1601 *
state.world.nation_get_demand_satisfaction(b, good);
1605 return a.index() < b.index();
1608 dcon::commodity_id good = retrieve<dcon::commodity_id>(
state, container);
1609 auto value =
state.world.nation_get_real_demand(
id, good)
1610 *
state.world.nation_get_demand_satisfaction(
id, good);
1623 auto commodity_id = retrieve<dcon::commodity_id>(
state, parent);
1645 line_graph::on_create(
state);
1649 auto com = retrieve<dcon::commodity_id>(
state, parent);
1653 std::vector<float> datapoints(32);
1658 set_data_points(
state, datapoints);
1661 auto com = retrieve<dcon::commodity_id>(
state, parent);
1662 line_graph::render(
state, x, y);
1669 auto com = retrieve<dcon::commodity_id>(
state, parent);
1672 float max_price =
state.world.commodity_get_price_record(com, newest_index);
1674 for(int32_t i = 1; i < 32; ++i) {
1684 auto com = retrieve<dcon::commodity_id>(
state, parent);
1687 float min_price =
state.world.commodity_get_price_record(com, newest_index);
1689 for(int32_t i = 1; i < 32; ++i) {
1699 auto com = retrieve<dcon::commodity_id>(
state, parent);
1700 if(
state.world.nation_get_drawing_on_stockpiles(
state.local_player_nation, com)) {
1708 auto com = retrieve<dcon::commodity_id>(
state, parent);
1709 button_element_base::render(
state, x, y);
1713 auto com = retrieve<dcon::commodity_id>(
state, parent);
1721 auto com = retrieve<dcon::commodity_id>(
state, parent);
1732 auto com = retrieve<dcon::commodity_id>(
state, parent);
1733 simple_text_element_base::render(
state, x, y);
1743 auto com = retrieve<dcon::commodity_id>(
state, parent);
1751 auto com = retrieve<dcon::commodity_id>(
state, parent);
1768 float a = std::pow(10.0f,
float(v) * (6.0f / 2000.0f)) - 1.0f;
1771 commit_changes(
state);
1775 auto com = retrieve<dcon::commodity_id>(
state, parent);
1782 auto value =
state.world.nation_get_stockpile_targets(
state.local_player_nation, com);
1783 auto a = std::log10(value + 1.0f);
1784 auto b = a * (2000.0f / 6.0f);
1785 update_raw_value(
state, int32_t(b));
1791 auto com = retrieve<dcon::commodity_id>(
state, parent);
1792 scrollbar::impl_render(
state, x, y);
1795 commit_changes(
state);
1798 auto com = retrieve<dcon::commodity_id>(
state, parent);
1799 float v = std::pow(10.0f,
float(raw_value()) * (6.0f / 2000.0f)) - 1.0f;
1807 auto com = retrieve<dcon::commodity_id>(
state, parent);
1808 auto val = retrieve<get_stockpile_target>(
state, parent);
1818 float trade_amount = 0.0f;
1821 if(
name ==
"trade_flow_bg") {
1822 return make_element_by_type<image_element_base>(
state,
id);
1823 }
else if(
name ==
"goods_icon") {
1824 return make_element_by_type<commodity_image>(
state,
id);
1825 }
else if(
name ==
"goods_title") {
1826 return make_element_by_type<generic_name_text<dcon::commodity_id>>(
state, id);
1827 }
else if(
name ==
"goods_price") {
1828 return make_element_by_type<commodity_price_text>(
state,
id);
1829 }
else if(
name ==
"automate_label") {
1830 return make_element_by_type<invisible_element>(
state,
id);
1831 }
else if(
name ==
"automate") {
1832 return make_element_by_type<invisible_element>(
state,
id);
1833 }
else if(
name ==
"price_linechart") {
1834 return make_element_by_type<prices_line_graph>(
state,
id);
1835 }
else if(
name ==
"price_chart_low") {
1836 return make_element_by_type<price_chart_low>(
state,
id);
1837 }
else if(
name ==
"price_chart_high") {
1838 return make_element_by_type<price_chart_high>(
state,
id);
1839 }
else if(
name ==
"price_chart_time") {
1840 return make_element_by_type<invisible_element>(
state,
id);
1841 }
else if(
name ==
"sell_stockpile") {
1842 return make_element_by_type<stockpile_sell_button>(
state,
id);
1843 }
else if(
name ==
"sell_stockpile_label") {
1844 return make_element_by_type<stockpile_sell_label>(
state,
id);
1845 }
else if(
name ==
"sell_slidier_desc") {
1846 return make_element_by_type<stockpile_slider_label>(
state,
id);
1847 }
else if(
name ==
"sell_slider") {
1848 return make_element_by_type<trade_slider>(
state,
id);
1849 }
else if(
name ==
"slider_value") {
1850 auto ptr = make_element_by_type<trade_slider_amount>(
state,
id);
1851 slider_value_display = ptr.
get();
1853 }
else if(
name ==
"confirm_trade") {
1854 return make_element_by_type<stockpile_amount_label>(
state,
id);
1855 }
else if(
name ==
"goods_details") {
1856 return make_element_by_type<trade_details_button>(
state,
id);
1857 }
else if(
name ==
"goods_need_gov_desc") {
1858 return make_element_by_type<invisible_element>(
state,
id);
1859 }
else if(
name ==
"goods_need_factory_desc") {
1860 return make_element_by_type<invisible_element>(
state,
id);
1861 }
else if(
name ==
"produced_detail_desc") {
1862 return make_element_by_type<detail_domestic_production>(
state,
id);
1863 }
else if(
name ==
"goods_need_pop_desc") {
1864 return make_element_by_type<invisible_element>(
state,
id);
1873 return message_result::consumed;
1875 trade_amount = any_cast<stockpile_target_change>(payload).
value;
1877 return message_result::consumed;
1880 return message_result::unseen;
1890 button_element_base::on_create(
state);
1904 if(index == 1 && subindex == 2) {
1907 button_element_base::render(
state, x, y);
1913 if(click_amount >= 10)
1915 if(click_amount >= 15)
1921 return tooltip_behavior::variable_tooltip;
1925 std::string key =
"alice_stockpile_button_" + std::to_string(index) +
"_" + std::to_string(subindex);
1937 send<signal_global_table>(
state, parent, signal);
1944 send<signal_nation_table>(
state, parent, signal);
1951 send<signal_trade_good_table>(
state, parent, signal);
1958 dcon::commodity_id commodity_id{1};
1973 window_element_base::on_create(
state);
1975 auto ptr = make_element_by_type<trade_flow_window>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"trade_flow"))->second.definition);
1976 trade_flow_win = ptr.
get();
1977 add_child_to_front(std::move(ptr));
1979 set_visible(
state,
false);
1983 if(
name ==
"main_bg") {
1984 return make_element_by_type<image_element_base>(
state,
id);
1985 }
else if(
name ==
"bg_trade") {
1986 return make_element_by_type<opaque_element_base>(
state,
id);
1987 }
else if(
name ==
"close_button") {
1988 return make_element_by_type<generic_close_button>(
state,
id);
1989 }
else if(
name ==
"market_activity_list") {
1990 auto ptr = make_element_by_type<trade_market_activity_listbox>(
state,
id);
1991 list_ma = ptr.
get();
1993 }
else if(
name ==
"common_market_list") {
1994 auto ptr = make_element_by_type<trade_common_market_listbox>(
state,
id);
1995 list_cm = ptr.
get();
1997 }
else if(
name ==
"stockpile_list") {
1998 auto ptr = make_element_by_type<trade_stockpile_listbox>(
state,
id);
1999 list_sp = ptr.
get();
2001 }
else if(
name ==
"commodity_table_nation") {
2002 std::vector<table::column<dcon::commodity_id>> columns = {
2013 auto ptr = make_element_by_type<table::display<dcon::commodity_id>>(
2016 std::string(
"commodity_table_body"),
2019 table_nation = ptr.
get();
2022 send<trade_details_select_commodity>(
state, container, payload);
2024 state.world.for_each_commodity([&](dcon::commodity_id
id) {
2025 table_nation->content.data.push_back(
id);
2027 table_nation->set_visible(
state,
false);
2029 }
else if(
name ==
"commodity_table_global") {
2030 std::vector<table::column<dcon::commodity_id>> columns = {
2041 auto ptr = make_element_by_type<table::display<dcon::commodity_id>>(
2044 std::string(
"commodity_table_body"),
2047 table_global = ptr.
get();
2050 send<trade_details_select_commodity>(
state, container, payload);
2052 state.world.for_each_commodity([&](dcon::commodity_id
id) {
2053 table_global->content.data.push_back(
id);
2056 }
else if(
name ==
"trade_good_global_stats") {
2057 std::vector<table::column<dcon::nation_id>> columns = {
2060 auto ptr = make_element_by_type<table::display<dcon::nation_id>>(
2063 std::string(
"commodity_table_body"),
2066 table_trade_good_stats = ptr.
get();
2067 table_trade_good_stats->set_visible(
state,
false);
2068 state.world.for_each_nation([&](dcon::nation_id
id) {
2069 table_trade_good_stats->content.data.push_back(
id);
2072 }
else if(
name ==
"market_table_global") {
2073 return make_element_by_type<switch_to_global_button>(
state,
id);
2074 }
else if(
name ==
"market_table_nation") {
2075 return make_element_by_type<switch_to_nation_button>(
state,
id);
2076 }
else if(
name ==
"market_table_trade_good_global") {
2077 return make_element_by_type<switch_to_trade_good_button>(
state,
id);
2099 }
else if(
name ==
"trade_details") {
2100 auto ptr = make_element_by_type<trade_details_window>(
state,
id);
2101 details_win = ptr.
get();
2103 }
else if(
name ==
"market_activity_sort_by_goods") {
2104 return make_element_by_type<trade_sort_button<trade_sort::commodity, trade_sort_assoc::market_activity>>(
state, id);
2105 }
else if(
name ==
"market_activity_sort_by_activity") {
2106 return make_element_by_type<trade_sort_button<trade_sort::demand_satisfaction, trade_sort_assoc::market_activity>>(
state, id);
2107 }
else if(
name ==
"market_activity_sort_by_cost") {
2108 return make_element_by_type<trade_sort_button<trade_sort::price, trade_sort_assoc::market_activity>>(
state, id);
2109 }
else if(
name ==
"stockpile_sort_by_goods") {
2110 return make_element_by_type<trade_sort_button<trade_sort::commodity, trade_sort_assoc::stockpile>>(
state, id);
2111 }
else if(
name ==
"stockpile_sort_by_value") {
2112 return make_element_by_type<trade_sort_button<trade_sort::stockpile, trade_sort_assoc::stockpile>>(
state, id);
2113 }
else if(
name ==
"stockpile_sort_by_change") {
2114 return make_element_by_type<trade_sort_button<trade_sort::stockpile_change, trade_sort_assoc::stockpile>>(
state, id);
2115 }
else if(
name ==
"common_market_sort_by_goods") {
2116 return make_element_by_type<trade_sort_button<trade_sort::commodity, trade_sort_assoc::common_market>>(
state, id);
2117 }
else if(
name ==
"common_market_sort_by_produced") {
2118 return make_element_by_type<trade_sort_button<trade_sort::global_market_pool, trade_sort_assoc::common_market>>(
state, id);
2119 }
else if(
name ==
"common_market_sort_by_diff") {
2120 return make_element_by_type<trade_sort_button<trade_sort::real_demand, trade_sort_assoc::common_market>>(
state, id);
2121 }
else if(
name ==
"common_market_sort_by_exported") {
2122 return make_element_by_type<trade_sort_button<trade_sort::domestic_market, trade_sort_assoc::common_market>>(
state, id);
2123 }
else if(
name ==
"needs_government_sort_by_goods") {
2124 return make_element_by_type<trade_sort_button<trade_sort::commodity, trade_sort_assoc::needs_government>>(
state, id);
2125 }
else if(
name ==
"needs_government_sort_by_value") {
2126 return make_element_by_type<trade_sort_button<trade_sort::needs, trade_sort_assoc::needs_government>>(
state, id);
2127 }
else if(
name ==
"needs_factories_sort_by_goods") {
2128 return make_element_by_type<trade_sort_button<trade_sort::commodity, trade_sort_assoc::needs_factories>>(
state, id);
2129 }
else if(
name ==
"needs_factories_sort_by_value") {
2130 return make_element_by_type<trade_sort_button<trade_sort::needs, trade_sort_assoc::needs_factories>>(
state, id);
2131 }
else if(
name ==
"needs_pops_sort_by_goods") {
2132 return make_element_by_type<trade_sort_button<trade_sort::commodity, trade_sort_assoc::needs_pops>>(
state, id);
2133 }
else if(
name ==
"needs_pops_sort_by_value") {
2134 return make_element_by_type<trade_sort_button<trade_sort::needs, trade_sort_assoc::needs_pops>>(
state, id);
2136 }
else if(
name ==
"group_industrial_and_consumer_goods") {
2137 return make_element_by_type<trade_commodity_group_window<sys::commodity_group::industrial_and_consumer_goods>>(
state, id);
2157 }
else if(payload.holds_type<dcon::commodity_id>()) {
2158 payload.emplace<dcon::commodity_id>(commodity_id);
2159 return message_result::consumed;
2161 commodity_id = any_cast<trade_details_open_window>(payload).commodity_id;
2164 return message_result::consumed;
2166 commodity_id = any_cast<trade_details_select_commodity>(payload).commodity_id;
2168 details_win->
trade_amount =
state.world.nation_get_stockpile_targets(
state.local_player_nation, commodity_id);
2170 return message_result::consumed;
2171 }
else if(payload.holds_type<dcon::nation_id>()) {
2172 payload.emplace<dcon::nation_id>(
state.local_player_nation);
2173 return message_result::consumed;
2175 auto d = any_cast<trade_sort_data>(payload);
2177 case trade_sort_assoc::market_activity:
2178 if(list_ma->
sort == d.sort)
2182 list_ma->
sort = d.sort;
2185 case trade_sort_assoc::stockpile:
2186 if(list_sp->
sort == d.sort)
2190 list_sp->
sort = d.sort;
2193 case trade_sort_assoc::common_market:
2194 if(list_cm->
sort == d.sort)
2198 list_cm->
sort = d.sort;
2201 case trade_sort_assoc::needs_government:
2202 if(list_gn->
sort == d.sort)
2206 list_gn->
sort = d.sort;
2209 case trade_sort_assoc::needs_factories:
2210 if(list_fn->
sort == d.sort)
2214 list_fn->
sort = d.sort;
2217 case trade_sort_assoc::needs_pops:
2218 if(list_pn->
sort == d.sort)
2222 list_pn->
sort = d.sort;
2228 return message_result::consumed;
2230 return message_result::unseen;
ui::message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(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
tooltip_behavior has_tooltip(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
void on_update(sys::state &state) noexcept override
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
virtual void impl_on_update(sys::state &state) noexcept
message_result impl_get(sys::state &state, Cyto::Any &payload) noexcept
void set_visible(sys::state &state, bool vis)
std::vector< dcon::commodity_id > row_contents
void update(sys::state &state)
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
void on_create(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 on_create(sys::state &state) 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 on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) 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 button_right_action(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
dcon::commodity_id commodity_id
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
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 on_create(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
bool operator==(trade_flow_data const &o) const
bool operator!=(trade_flow_data const &o) const
dcon::province_id province_id
dcon::commodity_id trade_good
dcon::factory_id factory_id
union ui::trade_flow_data::@5 data
dcon::province_id pop_province_id
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
std::string_view get_row_element_name() override
void populate_rows(sys::state &state, F &&factory_func, enum trade_flow_data::value_type vt)
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
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(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
void on_create(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
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
void on_create(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
std::string_view get_row_element_name() 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
void commit_changes(sys::state &state) noexcept
void impl_render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept final
void on_drag_finish(sys::state &state) noexcept override
void on_value_change(sys::state &state, int32_t v) noexcept final
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::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
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
#define assert(condition)
@ change_stockpile_settings
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
float global_market_commodity_daily_increase(sys::state &state, dcon::commodity_id c)
float government_consumption(sys::state &state, dcon::nation_id n, dcon::commodity_id c)
float nation_factory_consumption(sys::state &state, dcon::nation_id n, dcon::commodity_id c)
constexpr uint32_t price_history_length
constexpr dcon::commodity_id money(0)
int32_t most_recent_price_record_index(sys::state &state)
float stockpile_commodity_daily_increase(sys::state &state, dcon::commodity_id c, dcon::nation_id n)
float get_artisan_distribution_slow(sys::state &state, dcon::nation_id n, dcon::commodity_id c)
float nation_pop_consumption(sys::state &state, dcon::nation_id n, dcon::commodity_id c)
void for_each_province_in_state_instance(sys::state &state, dcon::state_instance_id s, F const &func)
uint32_t pack_color(float r, float g, float b)
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
std::string resolve_string_substitution(sys::state &state, dcon::text_key source_text, substitution_map const &mp)
std::string format_money(float num)
std::string get_name_as_string(sys::state &state, T t)
layout_box open_layout_box(layout_base &dest, int32_t indent)
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_break_to_layout(sys::state &state, columnar_layout &dest)
void add_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
dcon::text_key get_name(sys::state &state, dcon::nation_id 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)
dcon::text_key find_or_add_key(sys::state &state, std::string_view key, bool as_unicode)
void close_layout_box(columnar_layout &dest, layout_box &box)
table::column< dcon::commodity_id > trade_good_consumed_nation
std::string stockpile_target_player_view_commodity_id(sys::state &state, element_base *container, dcon::commodity_id item)
table::column< dcon::commodity_id > trade_good_satisfaction
table::column< dcon::commodity_id > trade_good_production_artisan
bool compare_stockpile_market(sys::state &state, element_base *container, dcon::commodity_id a, dcon::commodity_id b)
std::string price_view_commodity_id(sys::state &state, element_base *container, dcon::commodity_id item)
table::column< dcon::commodity_id > trade_good_production_factory
std::string stockpile_player_view_commodity_id(sys::state &state, element_base *container, dcon::commodity_id item)
bool compare_name(sys::state &state, element_base *container, dcon::commodity_id a, dcon::commodity_id b)
table::column< dcon::nation_id > nation_name
bool compare_stockpile_player(sys::state &state, element_base *container, dcon::commodity_id a, dcon::commodity_id b)
std::string supply_view_commodity_id(sys::state &state, element_base *container, dcon::commodity_id item)
bool compare_balance(sys::state &state, element_base *container, dcon::commodity_id a, dcon::commodity_id b)
table::column< dcon::commodity_id > trade_good_demand_column
bool compare_demand(sys::state &state, element_base *container, dcon::commodity_id a, dcon::commodity_id b)
table::column< dcon::commodity_id > trade_good_artisan_distribution
bool compare_supply(sys::state &state, element_base *container, dcon::commodity_id a, dcon::commodity_id b)
table::column< dcon::nation_id > nation_consumption
table::column< dcon::commodity_id > trade_good_player_gov_needs
table::column< dcon::nation_id > nation_demand
void send(sys::state &state, element_base *parent, T value)
std::string stockpile_market_view_commodity_id(sys::state &state, element_base *container, dcon::commodity_id item)
std::string demand_view_commodity_id(sys::state &state, element_base *container, dcon::commodity_id item)
table::column< dcon::commodity_id > trade_good_player_pop_needs
std::string name_view_commodity_id(sys::state &state, element_base *container, dcon::commodity_id item)
table::column< dcon::commodity_id > trade_good_market_stockpile_column
table::column< dcon::commodity_id > trade_good_name_column
bool compare_price(sys::state &state, element_base *container, const dcon::commodity_id a, const dcon::commodity_id b)
table::column< dcon::commodity_id > trade_good_production_rgo
table::column< dcon::commodity_id > trade_good_produced_nation
table::column< dcon::commodity_id > trade_good_player_stockpile_column
table::column< dcon::commodity_id > trade_good_player_factory_needs
table::column< dcon::nation_id > nation_production
table::column< dcon::commodity_id > trade_good_price_column
std::string balance_view_commodity_id(sys::state &state, element_base *container, dcon::commodity_id item)
table::column< dcon::commodity_id > trade_good_supply_column
table::column< dcon::commodity_id > trade_good_balance_column
element_base * trade_subwindow
ankerl::unordered_dense::map< dcon::text_key, element_target, hash_text_key > defs_by_name
element_base * drag_target
dcon::commodity_id commodity_id
dcon::commodity_id commodity_id