4 std::vector<float> prov_population(state.world.province_size() + 1);
5 std::unordered_map<int32_t, float> continent_max_pop = {};
7 state.world.for_each_province([&](dcon::province_id prov_id) {
10 auto cid = fat_id.get_continent().id.index();
11 continent_max_pop[cid] = std::max(continent_max_pop[cid], population);
13 prov_population[i] = population;
16 uint32_t province_size = state.world.province_size() + 1;
17 uint32_t texture_size = province_size + 256 - province_size % 256;
19 std::vector<uint32_t> prov_color(texture_size * 2);
21 state.world.for_each_province([&](dcon::province_id prov_id) {
23 auto cid = fat_id.get_continent().id.index();
25 float gradient_index = prov_population[i] / continent_max_pop[cid];
28 prov_color[i] = color;
29 prov_color[i + texture_size] = color;
36 auto fat_selected_id =
dcon::fatten(state.world, state.map_state.get_selected_province());
37 auto nat_id = fat_selected_id.get_nation_from_province_ownership();
41 float max_population = 0.f;
42 std::vector<float> prov_population(state.world.province_size() + 1);
44 state.world.for_each_province([&](dcon::province_id prov_id) {
47 if(fat_id.get_nation_from_province_ownership().id == nat_id.id) {
49 max_population = std::max(max_population, population);
50 prov_population[i] = population;
52 prov_population[i] = -1.f;
56 uint32_t province_size = state.world.province_size() + 1;
57 uint32_t texture_size = province_size + 256 - province_size % 256;
59 std::vector<uint32_t> prov_color(texture_size * 2);
61 for(
size_t i = 0; i < prov_population.size(); i++) {
63 if(prov_population[i] > -1.f) {
64 float gradient_index = prov_population[i] / max_population;
67 prov_color[i] = color;
68 prov_color[i + texture_size] = color;
75 std::vector<uint32_t> prov_color;
76 if(state.map_state.get_selected_province()) {
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
constexpr dcon::demographics_key total(0)
uint32_t color_gradient(float percent, uint32_t top_color, uint32_t bot_color)
constexpr uint16_t to_map_id(dcon::province_id id)
std::vector< uint32_t > population_map_from(sys::state &state)
std::vector< uint32_t > get_global_population_color(sys::state &state)
std::vector< uint32_t > get_national_population_color(sys::state &state)