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::religion_id primary_religion, secondary_religion;
13 float primary_religion_percent = 0.f, secondary_religion_percent = 0.f;
15 state.world.for_each_religion([&](dcon::religion_id religion_id) {
17 auto volume = state.world.province_get_demographics(prov_id, demo_key);
18 float percent = volume / total_pops;
20 if(percent > primary_religion_percent) {
21 secondary_religion = primary_religion;
22 secondary_religion_percent = primary_religion_percent;
23 primary_religion = religion_id;
24 primary_religion_percent = percent;
25 }
else if(percent > secondary_religion_percent) {
26 secondary_religion = religion_id;
27 secondary_religion_percent = percent;
31 dcon::religion_fat_id fat_primary_religion =
dcon::fatten(state.world, primary_religion);
33 uint32_t primary_religion_color = fat_primary_religion.get_color();
34 uint32_t secondary_religion_color = 0xFFAAAAAA;
36 if(
bool(secondary_religion)) {
37 dcon::religion_fat_id fat_secondary_religion =
dcon::fatten(state.world, secondary_religion);
38 secondary_religion_color = fat_secondary_religion.get_color();
41 if(secondary_religion_percent >= .35) {
42 prov_color[id] = primary_religion_color;
43 prov_color[
id + texture_size] = secondary_religion_color;
45 prov_color[id] = primary_religion_color;
46 prov_color[
id + texture_size] = primary_religion_color;
54 auto fat_selected_id =
dcon::fatten(state.world, state.map_state.get_selected_province());
55 auto religion_id = fat_selected_id.get_dominant_religion();
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(religion_id)) {
64 uint32_t full_color = religion_id.get_color();
68 if((full_color & 0xFF) + (full_color >> 8 & 0xFF) + (full_color >> 16 & 0xFF) > 140 * 3) {
69 empty_color = 0x222222;
71 state.world.for_each_province([&](dcon::province_id prov_id) {
74 auto religion_pop = state.world.province_get_demographics(prov_id, religion_key);
75 auto ratio = religion_pop / total_pop;
77 prov_color[i] = color;
78 prov_color[i + texture_size] = color;
85 std::vector<uint32_t> prov_color;
86 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_religion_global_color(sys::state &state)
std::vector< uint32_t > get_religion_diaspora_color(sys::state &state)
std::vector< uint32_t > religion_map_from(sys::state &state)