Project Alice
Loading...
Searching...
No Matches
colonial.hpp
Go to the documentation of this file.
1#pragma once
2std::vector<uint32_t> colonial_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 i = province::to_map_id(prov_id);
10
11 if(!(fat_id.get_nation_from_province_ownership())) {
12 if(province::is_colonizing(state, state.local_player_nation, fat_id.get_state_from_abstract_state_membership())) {
13 if(province::can_invest_in_colony(state, state.local_player_nation, fat_id.get_state_from_abstract_state_membership())) {
14 prov_color[i] = sys::pack_color(140, 247, 15);
15 prov_color[i + texture_size] = sys::pack_color(140, 247, 15);
16 } else {
17 prov_color[i] = sys::pack_color(250, 250, 5);
18 prov_color[i + texture_size] = sys::pack_color(250, 250, 5);
19 }
20 } else if(province::can_start_colony(state, state.local_player_nation, fat_id.get_state_from_abstract_state_membership())) {
21 prov_color[i] = sys::pack_color(46, 247, 15);
22 prov_color[i + texture_size] = sys::pack_color(46, 247, 15);
23 } else {
24 prov_color[i] = sys::pack_color(247, 15, 15);
25 prov_color[i + texture_size] = sys::pack_color(247, 15, 15);
26 }
27 }
28 });
29 return prov_color;
30}
std::vector< uint32_t > colonial_map_from(sys::state &state)
Definition: colonial.hpp:2
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
bool is_colonizing(sys::state &state, dcon::nation_id n, dcon::state_definition_id d)
Definition: province.cpp:1014
bool can_start_colony(sys::state &state, dcon::nation_id n, dcon::state_definition_id d)
Definition: province.cpp:1097
bool can_invest_in_colony(sys::state &state, dcon::nation_id n, dcon::state_definition_id d)
Definition: province.cpp:1023
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