7 base.h = fmod(base.h + (
float(roff.low & 0x1F) - 15.5f), 360.0f);
8 base.s = std::clamp(base.s + (
float((roff.low >> 8) & 0xFF) / 255.0f) * 0.2f - 0.1f, 0.0f, 1.0f);
9 base.v = std::clamp(base.v + (
float((roff.high >> 4) & 0xFF) / 255.0f) * 0.2f - 0.1f, 0.0f, 1.0f);
14 uint32_t province_size = state.world.province_size();
15 uint32_t texture_size = province_size + 256 - province_size % 256;
17 std::vector<uint32_t> prov_color(texture_size * 2);
19 std::vector<uint32_t> nation_color(state.world.nation_size() + 1);
20 state.world.for_each_nation([&](dcon::nation_id n) {
21 nation_color[n.value] = state.world.nation_get_color(n);
22 auto olr = state.world.nation_get_overlord_as_subject(n);
23 auto ol = state.world.overlord_get_ruler(olr);
27 olr = state.world.nation_get_overlord_as_subject(ol);
29 ol = state.world.overlord_get_ruler(olr);
33 auto ol_color = state.world.nation_get_color(ol);
34 switch(state.user_settings.vassal_color) {
35 case sys::map_vassal_color_mode::inherit:
36 nation_color[n.value] = derive_color_from_ol_color(state, ol_color, n);
38 case sys::map_vassal_color_mode::same:
39 nation_color[n.value] = ol_color;
41 case sys::map_vassal_color_mode::none:
47 state.world.for_each_province([&](dcon::province_id prov_id) {
50 if(prov_id.index() >= state.province_definitions.first_sea_province.index()) {
52 prov_color[i + texture_size] = 0;
54 dcon::nation_id first_n{};
55 dcon::nation_id second_n{};
56 for(
const auto adj : fat_id.get_province_adjacency_as_connected_provinces()) {
57 auto p2 = adj.get_connected_provinces(adj.get_connected_provinces(0) == prov_id ? 1 : 0);
58 if(p2.get_is_coast()) {
59 auto n = p2.get_province_control_as_province().get_nation();
60 if(!n || second_n == n || first_n == n)
62 if(!
bool(second_n) || n.get_rank() > state.world.nation_get_rank(second_n)) {
63 if(!
bool(first_n) || n.get_rank() > state.world.nation_get_rank(first_n)) {
74 prov_color[i] = nation_color[first_n.value];
75 prov_color[i] |= 0xff000000;
77 prov_color[i + texture_size] = nation_color[second_n.value];
78 prov_color[i + texture_size] |= 0xff000000;
82 auto id = fat_id.get_nation_from_province_ownership();
85 color = nation_color[
id.id.value];
87 color = 255 << 16 | 255 << 8 | 255;
89 auto occupier = fat_id.get_nation_from_province_control();
90 uint32_t color_b = occupier ? nation_color[occupier.id.value] :
93 prov_color[i] = color;
94 prov_color[i + texture_size] = color_b;
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
constexpr uint16_t to_map_id(dcon::province_id id)
random_pair get_random_pair(sys::state const &state, uint32_t value_in)
uint32_t pack_color(float r, float g, float b)
uint32_t hsv_to_rgb(hsv v)
hsv rgb_to_hsv(uint32_t v)
uint32_t derive_color_from_ol_color(sys::state &state, uint32_t ol_color, dcon::nation_id n)
std::vector< uint32_t > political_map_from(sys::state &state)