Project Alice
Loading...
Searching...
No Matches
crisis.hpp
Go to the documentation of this file.
1#pragma once
2std::vector<uint32_t> crisis_map_from(sys::state& state) {
3 uint32_t province_size = state.world.province_size();
4 uint32_t texture_size = province_size + 256 - province_size % 256;
5
6 std::vector<uint32_t> prov_color(texture_size * 2);
7 state.world.for_each_province([&](dcon::province_id prov_id) {
8 auto fat_id = dcon::fatten(state.world, prov_id);
9 auto nation = fat_id.get_nation_from_province_ownership();
10 auto i = province::to_map_id(prov_id);
11
12 if(nation) {
13 auto color = ogl::color_gradient(fat_id.get_state_membership().get_flashpoint_tension() / 100.0f, sys::pack_color(247, 15, 15), sys::pack_color(46, 247, 15));
14 prov_color[i] = color;
15 prov_color[i + texture_size] = color;
16 }
17 });
18 return prov_color;
19}
std::vector< uint32_t > crisis_map_from(sys::state &state)
Definition: crisis.hpp:2
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)
Definition: color.hpp:42
constexpr uint16_t to_map_id(dcon::province_id id)
Definition: province.hpp:10
uint32_t pack_color(float r, float g, float b)
uint uint32_t