5 uint32_t province_size = state.world.province_size();
6 uint32_t texture_size = province_size + 256 - province_size % 256;
7 std::vector<uint32_t> prov_color(texture_size * 2);
8 auto sel_nation = state.world.province_get_nation_from_province_ownership(state.map_state.get_selected_province());
9 std::unordered_map<uint16_t, float> rebels_in_province = {};
10 std::unordered_map<int32_t, float> continent_max_rebels = {};
11 state.world.for_each_rebel_faction([&](dcon::rebel_faction_id
id) {
13 if((sel_nation && sel_nation == rebellion.get_ruler_from_rebellion_within().id) || !sel_nation) {
14 for(
auto members : state.world.rebel_faction_get_pop_rebellion_membership(
id)) {
15 rebels_in_province[
province::to_map_id(members.get_pop().get_province_from_pop_location().id)] += members.get_pop().get_size();
19 for(
auto& [p, value] : rebels_in_province) {
21 auto cid =
dcon::fatten(state.world, pid).get_continent().id.index();
22 continent_max_rebels[cid] = std::max(continent_max_rebels[cid], value);
24 state.world.for_each_province([&](dcon::province_id prov_id) {
25 auto nation = state.world.province_get_nation_from_province_ownership(prov_id);
26 if((sel_nation && nation == sel_nation) || !sel_nation) {
29 auto cid = fat_id.get_continent().id.index();
32 if(rebels_in_province[i] > 0.0f) {
33 float gradient_index = (continent_max_rebels[cid] == 0.f ? 0.f : (rebels_in_province[i] / continent_max_rebels[cid]));
39 prov_color[i] = color;
40 prov_color[i + texture_size] = color;
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
uint32_t color_gradient(float percent, uint32_t top_color, uint32_t bot_color)
constexpr dcon::province_id from_map_id(uint16_t id)
constexpr uint16_t to_map_id(dcon::province_id id)
uint32_t pack_color(float r, float g, float b)
std::vector< uint32_t > revolt_map_from(sys::state &state)