7 for(
auto const fat_id :
state.world.nation_get_state_ownership(n)) {
8 if(show_empty && !fat_id.get_state().get_capital().get_is_colonial()) {
9 row_contents.push_back(fat_id.get_state());
14 auto ffact_id = dcon::fatten(state.world, pid);
15 ffact_id.for_each_factory_location_as_province([&](dcon::factory_location_id flid) {
16 auto fid = state.world.factory_location_get_factory(flid);
17 Cyto::Any payload = commodity_filter_query_data{
18 state.world.factory_type_get_output(state.world.factory_get_building_type(fid)).id, false};
19 state.ui_state.production_subwindow->impl_get(state, payload);
20 auto content = any_cast<commodity_filter_query_data>(payload);
21 count += content.filter ? 1 : 0;
24 for(
auto construct : fat_id.get_state().get_state_building_construction()) {
27 auto content = any_cast<commodity_filter_query_data>(payload);
28 count += content.filter ? 1 : 0;
33 row_contents.push_back(fat_id.get_state());
37 auto sort_by_name = [&](dcon::state_instance_id a, dcon::state_instance_id b) {
42 return a_name < b_name;
44 auto sort_by_factories = [&](dcon::state_instance_id a, dcon::state_instance_id b) {
47 return acount > bcount;
49 auto sort_by_primary_workers = [&](dcon::state_instance_id a, dcon::state_instance_id b) {
50 return state.world.state_instance_get_demographics(a,
52 state.world.state_instance_get_demographics(b,
55 auto sort_by_secondary_workers = [&](dcon::state_instance_id a, dcon::state_instance_id b) {
56 return state.world.state_instance_get_demographics(a,
58 state.world.state_instance_get_demographics(b,
61 auto sort_by_owners = [&](dcon::state_instance_id a, dcon::state_instance_id b) {
69 auto sort_by_infrastructure = [&](dcon::state_instance_id a, dcon::state_instance_id b) {
71 float ap_total = 0.0f;
77 float bp_total = 0.0f;
82 return atotal / ap_total > btotal / bp_total;
87 std::sort(row_contents.begin(), row_contents.end(), sort_by_name);
90 std::sort(row_contents.begin(), row_contents.end(), sort_by_factories);
93 std::sort(row_contents.begin(), row_contents.end(), sort_by_primary_workers);
96 std::sort(row_contents.begin(), row_contents.end(), sort_by_secondary_workers);
99 std::sort(row_contents.begin(), row_contents.end(), sort_by_owners);
102 std::sort(row_contents.begin(), row_contents.end(), sort_by_infrastructure);
message_result impl_get(sys::state &state, Cyto::Any &payload) noexcept
void set_visible(sys::state &state, bool vis)
constexpr dcon::demographics_key total(0)
dcon::demographics_key to_key(sys::state const &state, dcon::pop_type_id v)
int32_t state_factory_count(sys::state &state, dcon::state_instance_id sid, dcon::nation_id n)
bool has_factory(sys::state const &state, dcon::state_instance_id si)
void for_each_province_in_state_instance(sys::state &state, dcon::state_instance_id s, F const &func)
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
void send(sys::state &state, element_base *parent, T value)
void open_foreign_investment(sys::state &state, dcon::nation_id n)
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)
void open_build_foreign_factory(sys::state &state, dcon::state_instance_id st)
element_base * topbar_subwindow
std::unique_ptr< element_base > root
element_base * production_subwindow