4 uint32_t province_size = state.world.province_size() + 1;
5 uint32_t texture_size = province_size + 256 - province_size % 256;
7 std::vector<uint32_t> prov_color(texture_size * 2);
8 state.world.for_each_province([&](dcon::province_id prov_id) {
12 dcon::culture_id primary_culture, secondary_culture;
13 float primary_culture_percent = 0.f, secondary_culture_percent = 0.f;
15 state.world.for_each_culture([&](dcon::culture_id culture_id) {
17 auto volume = state.world.province_get_demographics(prov_id, demo_key);
18 float percent = volume / total_pops;
20 if(percent > primary_culture_percent) {
21 secondary_culture = primary_culture;
22 secondary_culture_percent = primary_culture_percent;
23 primary_culture = culture_id;
24 primary_culture_percent = percent;
25 }
else if(percent > secondary_culture_percent) {
26 secondary_culture = culture_id;
27 secondary_culture_percent = percent;
31 dcon::culture_fat_id fat_primary_culture =
dcon::fatten(state.world, primary_culture);
33 uint32_t primary_culture_color = fat_primary_culture.get_color();
34 uint32_t secondary_culture_color = 0xFFAAAAAA;
36 if(
bool(secondary_culture)) {
37 dcon::culture_fat_id fat_secondary_culture =
dcon::fatten(state.world, secondary_culture);
38 secondary_culture_color = fat_secondary_culture.get_color();
41 if(secondary_culture_percent >= .35) {
42 prov_color[id] = primary_culture_color;
43 prov_color[
id + texture_size] = secondary_culture_color;
45 prov_color[id] = primary_culture_color;
46 prov_color[
id + texture_size] = primary_culture_color;
54 auto fat_selected_id =
dcon::fatten(state.world, state.map_state.get_selected_province());
55 auto culture_id = fat_selected_id.get_dominant_culture();
58 uint32_t province_size = state.world.province_size() + 1;
59 uint32_t texture_size = province_size + 256 - province_size % 256;
61 std::vector<uint32_t> prov_color(texture_size * 2);
63 if(
bool(culture_id)) {
64 uint32_t full_color = culture_id.get_color();
68 if((full_color & 0xFF) + (full_color >> 8 & 0xFF) + (full_color >> 16 & 0xFF) > 140 * 3) {
69 empty_color = 0x222222;
72 state.world.for_each_province([&](dcon::province_id prov_id) {
76 auto culture_pop = state.world.province_get_demographics(prov_id, culture_key);
77 auto ratio = culture_pop / total_pop;
81 prov_color[i] = color;
82 prov_color[i + texture_size] = color;
89 std::vector<uint32_t> prov_color;
90 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)
dcon::demographics_key to_key(sys::state const &state, dcon::pop_type_id v)
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 > get_nationality_diaspora_color(sys::state &state)
std::vector< uint32_t > nationality_map_from(sys::state &state)
std::vector< uint32_t > get_nationality_global_color(sys::state &state)