Project Alice
Loading...
Searching...
No Matches
map_tooltip.cpp
Go to the documentation of this file.
1#include "map_tooltip.hpp"
2#include "demographics.hpp"
3#include "rebels.hpp"
4#include "unit_tooltip.hpp"
5
6namespace ui {
7
8float selected_relative_attrition_amount(sys::state& state, dcon::nation_id n, std::vector<dcon::army_id>& list, dcon::province_id prov) {
9 float total_army_weight = 0.f;
10 for(auto army : list) {
11 auto ar = dcon::fatten(state.world, army);
12 if(ar.get_black_flag() == false && ar.get_is_retreating() == false && !bool(ar.get_navy_from_army_transport())) {
13 for(auto rg : ar.get_army_membership()) {
14 total_army_weight += 3.0f * rg.get_regiment().get_strength();
15 }
16 }
17 }
18 for(auto ar : state.world.province_get_army_location(prov)) {
19 if(ar.get_army().get_black_flag() == false && ar.get_army().get_is_retreating() == false && !bool(ar.get_army().get_navy_from_army_transport())) {
20 for(auto rg : ar.get_army().get_army_membership()) {
21 total_army_weight += 3.0f * rg.get_regiment().get_strength();
22 }
23 }
24 }
25 auto prov_attrition_mod = state.world.province_get_modifier_values(prov, sys::provincial_mod_offsets::attrition);
26 auto army_controller = dcon::fatten(state.world, n);
27 auto supply_limit = military::supply_limit_in_province(state, army_controller, prov);
28 auto attrition_mod = 1.0f + army_controller.get_modifier_values(sys::national_mod_offsets::land_attrition);
29 float greatest_hostile_fort = 0.0f;
30 for(auto adj : state.world.province_get_province_adjacency(prov)) {
32 auto other = adj.get_connected_provinces(0) != prov ? adj.get_connected_provinces(0) : adj.get_connected_provinces(1);
33 if(other.get_building_level(uint8_t(economy::province_building_type::fort)) > 0) {
34 if(military::are_at_war(state, army_controller, other.get_nation_from_province_control())) {
35 greatest_hostile_fort = std::max(greatest_hostile_fort, float(other.get_building_level(uint8_t(economy::province_building_type::fort))));
36 }
37 }
38 }
39 }
40 return total_army_weight * attrition_mod - (supply_limit + prov_attrition_mod + greatest_hostile_fort) > 0;
41}
42
43void country_name_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
44 auto fat = dcon::fatten(state.world, prov);
45 auto owner = fat.get_nation_from_province_ownership();
46 auto box = text::open_layout_box(contents);
47
48 if(state.cheat_data.show_province_id_tooltip) {
49 text::localised_format_box(state, contents, box, "province_id", text::substitution_map{});
50 text::add_to_layout_box(state, contents, box, std::string_view(":"));
52 text::add_to_layout_box(state, contents, box, prov.index());
54 text::localised_format_box(state, contents, box, "nation_tag", text::substitution_map{});
55 text::add_to_layout_box(state, contents, box, std::string_view(":"));
57 text::add_to_layout_box(state, contents, box, nations::int_to_tag(owner.get_identity_from_identity_holder().get_identifying_int()));
59 text::localised_format_box(state, contents, box, "province_sorting_distance", text::substitution_map{});
60 text::add_to_layout_box(state, contents, box, std::string_view(":"));
62 text::add_to_layout_box(state, contents, box, text::fp_four_places{ province::sorting_distance(state, state.map_state.selected_province, prov) });
64
66 }
67
68 if(owner) {
69 text::add_to_layout_box(state, contents, box, fat.get_name());
70 text::add_to_layout_box(state, contents, box, std::string_view{ " (" });
71 text::add_to_layout_box(state, contents, box, text::embedded_flag{ state.world.nation_get_identity_from_identity_holder(owner) });
73 text::add_to_layout_box(state, contents, box, text::get_name(state, owner.id));
74 text::add_to_layout_box(state, contents, box, std::string_view{ ")" });
75 } else {
76 text::add_to_layout_box(state, contents, box, fat.get_name());
77 }
78 text::close_layout_box(contents, box);
79
80 if(state.selected_armies.size() > 0) {
81 text::add_line(state, contents, "alice_supply_limit_desc", text::variable_type::x, text::int_wholenum{ military::supply_limit_in_province(state, state.local_player_nation, fat) });
82 ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::supply_limit, true);
83 ui::active_modifiers_description(state, contents, fat, 0, sys::provincial_mod_offsets::supply_limit, true);
84
85 for(const auto a : state.selected_armies) {
86 auto controller = dcon::fatten(state.world, state.local_player_nation);
89 auto tag_str = std::string("@") + nations::int_to_tag(controller.get_identity_from_identity_holder().get_identifying_int()) + "@(A)";
90 text::add_to_substitution_map(sub, text::variable_type::m, std::string_view{ tag_str });
95 auto resolved = text::resolve_string_substitution(state, "alice_unit_relative_attrition", sub);
96 box = text::open_layout_box(contents);
97 text::add_unparsed_text_to_layout_box(state, contents, box, resolved);
98 text::close_layout_box(contents, box);
99 }
100 } else if(state.selected_navies.size() > 0) {
101 text::add_line(state, contents, "alice_supply_limit_desc", text::variable_type::x, text::int_wholenum{ military::supply_limit_in_province(state, state.local_player_nation, fat) });
102 ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::supply_limit, true);
103 ui::active_modifiers_description(state, contents, fat, 0, sys::provincial_mod_offsets::supply_limit, true);
104 }
105}
106
107// 19 out of 22 (2 cant be finished so 21 of 22) finished
108
109void terrain_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
110 auto fat = dcon::fatten(state.world, prov);
111 country_name_box(state, contents, prov);
112 auto box = text::open_layout_box(contents);
113 text::add_to_layout_box(state, contents, box, fat.get_terrain().get_name());
116 text::close_layout_box(contents, box);
117
118 if(fat.get_terrain().id) {
119 ui::modifier_description(state, contents, fat.get_terrain().id);
120 }
121}
122
123void political_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
124 country_name_box(state, contents, prov);
125 if(auto n = state.world.province_get_nation_from_province_control(prov); n && n != state.world.province_get_nation_from_province_ownership(prov)) {
126 auto fat_id = dcon::fatten(state.world, n);
127 auto box = text::open_layout_box(contents);
128 text::add_to_layout_box(state, contents, box, text::embedded_flag{ state.world.nation_get_identity_from_identity_holder(n) });
129 text::add_space_to_layout_box(state, contents, box);
131 text::close_layout_box(contents, box);
132 } else if(auto rf = state.world.province_get_rebel_faction_from_province_rebel_control(prov); rf) {
133 auto fat_id = dcon::fatten(state.world, rf);
134 auto box = text::open_layout_box(contents);
135 text::add_to_layout_box(state, contents, box, text::embedded_flag{ state.national_definitions.rebel_id });
136 text::add_space_to_layout_box(state, contents, box);
137 auto name = rebel::rebel_name(state, rf);
138 text::add_to_layout_box(state, contents, box, std::string_view{ name });
139 text::close_layout_box(contents, box);
140 }
141}
142
143void militancy_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
144 auto fat = dcon::fatten(state.world, prov);
145 country_name_box(state, contents, prov);
146
147 if(prov.value < state.province_definitions.first_sea_province.value) {
149 ui::active_modifiers_description(state, contents, prov, 0, sys::provincial_mod_offsets::pop_militancy_modifier, true);
150 ui::active_modifiers_description(state, contents, state.world.province_control_get_nation(state.world.province_get_province_control_as_province(prov)), 0, sys::national_mod_offsets::core_pop_militancy_modifier, true);
151 ui::active_modifiers_description(state, contents, state.world.province_control_get_nation(state.world.province_get_province_control_as_province(prov)), 0, sys::national_mod_offsets::global_pop_militancy_modifier, true);
152 ui::active_modifiers_description(state, contents, state.world.province_control_get_nation(state.world.province_get_province_control_as_province(prov)), 0, sys::national_mod_offsets::non_accepted_pop_militancy_modifier, true);
153 }
154}
155
156void diplomatic_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
157 auto fat = dcon::fatten(state.world, prov);
158 country_name_box(state, contents, prov);
159
160 if(prov.value < state.province_definitions.first_sea_province.value) {
161 auto box = text::open_layout_box(contents);
162 dcon::nation_fat_id nationundermouse = fat.get_nation_from_province_ownership();
163 //if(selectednation.get_is_great_power() && fat.get_nation_from_province_ownership() != selectednation) {
164 if(nationundermouse) {
165 dcon::nation_fat_id selectednation = (dcon::fatten(state.world, state.map_state.selected_province).get_nation_from_province_ownership().is_valid()) ?
166 dcon::fatten(state.world, state.map_state.selected_province).get_nation_from_province_ownership() :
167 dcon::fatten(state.world, state.local_player_nation);
168 uint8_t level = uint8_t(nations::influence::get_level(state, selectednation, fat.get_nation_from_province_ownership()));
169 level = level & nations::influence::level_mask;
170 if(nationundermouse.get_overlord_as_subject().get_ruler() == selectednation && nationundermouse.get_is_substate()) {
171 text::localised_format_box(state, contents, box, std::string_view("diplo_they_substate"));
173 } else if(selectednation.get_overlord_as_subject().get_ruler() == nationundermouse && selectednation.get_is_substate()) {
174 text::localised_format_box(state, contents, box, std::string_view("diplo_we_substate"));
176 } else if(nationundermouse.get_overlord_as_subject().get_ruler() == selectednation && !nationundermouse.get_is_substate()) {
177 text::localised_format_box(state, contents, box, std::string_view("diplo_they_satellite"));
179 } else if(selectednation.get_overlord_as_subject().get_ruler() == nationundermouse && !selectednation.get_is_substate()) {
180 text::localised_format_box(state, contents, box, std::string_view("diplo_we_satellite"));
182 } else if(selectednation.get_is_great_power() && nationundermouse != selectednation) {
183 text::add_to_layout_box(state, contents, box, fat.get_nation_from_province_ownership().id);
184 text::add_to_layout_box(state, contents, box, std::string_view(": "));
185 auto str = text::get_influence_level_name(state, level);
186 text::add_to_layout_box(state, contents, box, std::string_view(str));
188 }
189 text::localised_format_box(state, contents, box, std::string_view("following_have_claims"));
191 for(auto c : fat.get_core()) {
192 text::add_to_layout_box(state, contents, box, std::string_view("• "));
193 text::add_to_layout_box(state, contents, box, text::embedded_flag{ c.get_identity().id });
194 text::add_to_layout_box(state, contents, box, c.get_identity().get_name());
196 }
197 text::close_layout_box(contents, box);
198 }
199 }
200}
201
202void region_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
203 auto fat = dcon::fatten(state.world, prov);
204 country_name_box(state, contents, prov);
205
206 if(prov.value < state.province_definitions.first_sea_province.value) {
207 auto box = text::open_layout_box(contents);
211 text::add_to_substitution_map(sub, text::variable_type::continentname, fat.get_continent().get_name());
212 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_state_entry"), sub);
213 text::close_layout_box(contents, box);
214 }
215}
216
217void infrastructure_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done, doesnt appear to produce same results as V2 though
218 auto fat = dcon::fatten(state.world, prov);
219 country_name_box(state, contents, prov);
220
221 if(prov.value < state.province_definitions.first_sea_province.value) {
222 auto box = text::open_layout_box(contents);
223 text::add_to_layout_box(state, contents, box, fat.get_rgo().get_name(), text::text_color::yellow);
224 int32_t current_rails_lvl = state.world.province_get_building_level(prov, uint8_t(economy::province_building_type::railroad));
225 int32_t max_local_rails_lvl = state.world.nation_get_max_building_level(fat.get_nation_from_province_ownership().id, uint8_t(economy::province_building_type::railroad));
227 text::localised_single_sub_box(state, contents, box, std::string_view("infra_level_here"), text::variable_type::val, uint16_t(float(current_rails_lvl) / float(max_local_rails_lvl)));
228 text::close_layout_box(contents, box);
229 }
230}
231
232void colonial_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
233 auto fat = dcon::fatten(state.world, prov);
234 country_name_box(state, contents, prov);
235
236 if(prov.value < state.province_definitions.first_sea_province.value) {
237 auto box = text::open_layout_box(contents);
238 if(fat.get_is_coast()) {
240 text::add_to_substitution_map(sub, text::variable_type::val, std::string_view(text::format_float(province::direct_distance(state, dcon::fatten(state.world, state.local_player_nation).get_capital().id, prov), 0)));
241 text::localised_format_box(state, contents, box, std::string_view("colonial_range"), sub);
242 }
244 text::add_to_layout_box(state, contents, box, fat.get_rgo().get_name(), text::text_color::yellow);
245 text::close_layout_box(contents, box);
246
247 auto distance = province::direct_distance(state, dcon::fatten(state.world, state.local_player_nation).get_capital().id, prov);
248 if(!province::can_start_colony(state, state.local_player_nation, fat.get_state_from_abstract_state_membership().id)) {
249 if(fat.get_life_rating() > state.world.nation_get_modifier_values(state.local_player_nation, sys::national_mod_offsets::colonial_life_rating)) {
250 ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::colonial_life_rating, false);
251 }
252 if(province::has_an_owner(state, prov)) {
253 auto box3 = text::open_layout_box(contents);
255 text::localised_format_box(state, contents, box3, std::string_view("colonize_settled"));
257 text::close_layout_box(contents, box3);
258 } else if(distance > state.economy_definitions.building_definitions[int32_t(economy::province_building_type::naval_base)].colonial_range) {
259 auto box2 = text::open_layout_box(contents);
261 text::localised_format_box(state, contents, box2, std::string_view("colonize_closest_base_to_far"));
262 text::close_layout_box(contents, box2);
263 }
264 }
265 auto box4 = text::open_layout_box(contents);
266
267 for(auto coloniser : fat.get_state_from_abstract_state_membership().get_colonization()) {
269 text::add_to_layout_box(state, contents, box4, coloniser.get_colonizer().id, text::text_color::yellow);
270 text::add_to_layout_box(state, contents, box4, std::string_view(": "), text::text_color::white);
271 text::add_to_layout_box(state, contents, box4, text::format_float(coloniser.get_level(), 0), text::text_color::yellow);
272 }
273
274 text::close_layout_box(contents, box4);
275 }
276}
277
278void admin_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
279 auto fat = dcon::fatten(state.world, prov);
280 country_name_box(state, contents, prov);
281
282 if(prov.value < state.province_definitions.first_sea_province.value) {
283 auto box = text::open_layout_box(contents);
284 text::localised_single_sub_box(state, contents, box, std::string_view("provinceview_admin"), text::variable_type::value, text::fp_one_place{ province::state_admin_efficiency(state, fat.get_state_membership().id) * 100.0f });
285 text::close_layout_box(contents, box);
286 if(fat.get_crime()) {
288 text::add_line(state, contents, state.culture_definitions.crimes[fat.get_crime()].name);
289 ui::modifier_description(state, contents, state.culture_definitions.crimes[fat.get_crime()].modifier);
290 }
291 }
292}
293
294void recruitment_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // TODO
295 auto fat = dcon::fatten(state.world, prov);
296 country_name_box(state, contents, prov);
297
298 if(prov.value < state.province_definitions.first_sea_province.value) {
299 auto box = text::open_layout_box(contents);
300
301 auto max_regiments = military::regiments_max_possible_from_province(state, prov);
302 auto created_regiments = military::regiments_created_from_province(state, prov);
304
305 if(fat.get_nation_from_province_ownership().id.value == state.local_player_nation.value) {
306 if(max_regiments == 0) {
307 text::localised_format_box(state, contents, box, std::string_view("solmp_no_soldier_pops"));
308 } else if(created_regiments < max_regiments) {
312 text::localised_format_box(state, contents, box, std::string_view("solmp_details"), sub);
313 } else {
317 text::localised_format_box(state, contents, box, std::string_view("solmp_details"), sub);
318 }
319 //text::localised_format_box(state, contents, box, std::string_view("solmp_over_recruited"));
320 }
321
322 text::close_layout_box(contents, box);
323 }
324}
325
326void nationalfocus_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // TODO - Need new
327 auto fat = dcon::fatten(state.world, prov);
328 country_name_box(state, contents, prov);
329
330 if(prov.value < state.province_definitions.first_sea_province.value) {
331 auto box = text::open_layout_box(contents);
332 if(fat.get_state_membership().get_owner_focus()) {
333 text::localised_format_box(state, contents, box, std::string_view("pw_national_focus"));
334 text::add_to_layout_box(state, contents, box, fat.get_state_membership().get_owner_focus().get_name(), text::text_color::yellow);
335 modifier_description(state, contents, fat.get_state_membership().get_owner_focus().get_modifier());
336 }
337 text::close_layout_box(contents, box);
338 }
339}
340
341void rgooutput_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
342 auto fat = dcon::fatten(state.world, prov);
343 country_name_box(state, contents, prov);
344
345 if(prov.value < state.province_definitions.first_sea_province.value) {
346 auto box = text::open_layout_box(contents);
347 text::add_to_layout_box(state, contents, box, fat.get_rgo().get_name(), text::text_color::yellow);
348 text::close_layout_box(contents, box);
349 }
350}
351
352void population_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
353 auto fat = dcon::fatten(state.world, prov);
354 country_name_box(state, contents, prov);
355
356 if(prov.value < state.province_definitions.first_sea_province.value) {
357 auto box = text::open_layout_box(contents);
358 text::localised_single_sub_box(state, contents, box, std::string_view("population_density_at_province"), text::variable_type::prov, (
359 text::produce_simple_string(state, fat.get_name()) +
360 ": " +
361 text::format_float(fat.get_demographics(demographics::total), 0) +
362 " (" +
363 text::prettify(int64_t(fat.get_demographics(demographics::total))) +
364 ")"
365 ));
366 text::close_layout_box(contents, box);
367 }
368}
369
370void nationality_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
371 auto fat = dcon::fatten(state.world, prov);
372 country_name_box(state, contents, prov);
373
374 if(prov.value < state.province_definitions.first_sea_province.value) {
375 auto box = text::open_layout_box(contents);
376
377 text::localised_single_sub_box(state, contents, box, std::string_view("mapmode_tooltip_culture_majorities"), text::variable_type::prov, prov);
378
379 std::vector<dcon::culture_fat_id> cultures;
380 for(auto pop : fat.get_pop_location()) {
381 if(std::find(cultures.begin(), cultures.end(), pop.get_pop().get_culture()) == cultures.end()) {
382 cultures.push_back(pop.get_pop().get_culture());
383 }
384 }
385 std::sort(cultures.begin(), cultures.end(), [&](auto a, auto b) {return fat.get_demographics(demographics::to_key(state, a.id)) > fat.get_demographics(demographics::to_key(state, b.id)); });
386 for(size_t i = 0; i < cultures.size(); i++) {
388 text::add_space_to_layout_box(state, contents, box);
389 text::add_to_layout_box(state, contents, box, cultures[i].get_name(), text::text_color::yellow);
390 text::add_space_to_layout_box(state, contents, box);
391 text::add_to_layout_box(state, contents, box, std::string_view("("), text::text_color::white);
392 text::add_to_layout_box(state, contents, box, text::format_percentage(fat.get_demographics(demographics::to_key(state, cultures[i].id)) / fat.get_demographics(demographics::total)), text::text_color::white);
393 text::add_to_layout_box(state, contents, box, std::string_view(")"), text::text_color::white);
394 }
395
396 text::close_layout_box(contents, box);
397 }
398}
399
400void sphere_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
401 auto fat = dcon::fatten(state.world, prov);
402 country_name_box(state, contents, prov);
403
404 if(prov.value < state.province_definitions.first_sea_province.value) {
405 auto box = text::open_layout_box(contents);
406 if(fat.get_nation_from_province_ownership().get_is_great_power()) {
407 text::localised_single_sub_box(state, contents, box, std::string_view("sphere_of_infl_great_power"), text::variable_type::country, fat.get_nation_from_province_ownership().id);
408 } else {
409 if(fat.get_nation_from_province_ownership().get_in_sphere_of().is_valid()) {
411 text::add_to_substitution_map(sub, text::variable_type::country1, fat.get_nation_from_province_ownership().id);
412 text::add_to_substitution_map(sub, text::variable_type::country2, fat.get_nation_from_province_ownership().get_in_sphere_of());
413 text::localised_format_box(state, contents, box, std::string_view("sphere_of_infl_is_in_sphere"), sub);
414 }
415
416 bool bHasDisplayedHeader = false;
417 for(auto gpr : fat.get_nation_from_province_ownership().get_gp_relationship_as_influence_target()) {
418 if(!bHasDisplayedHeader) {
420 text::localised_single_sub_box(state, contents, box, std::string_view("sphere_of_infl_is_infl_by"), text::variable_type::country, fat.get_nation_from_province_ownership());
422 bHasDisplayedHeader = true;
423 }
424 text::add_to_layout_box(state, contents, box, gpr.get_great_power().id, text::text_color::yellow);
425 text::add_to_layout_box(state, contents, box, (
426 " (" +
427 text::format_float(gpr.get_influence(), 0) +
428 ")"
431 }
432 }
433 text::close_layout_box(contents, box);
434 }
435}
436
437void supply_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
438 auto fat = dcon::fatten(state.world, prov);
439 country_name_box(state, contents, prov);
440
441 if(prov.value < state.province_definitions.first_sea_province.value) {
442 auto box = text::open_layout_box(contents);
443 text::add_to_layout_box(state, contents, box, text::produce_simple_string(state, "provinceview_supply_limit") + " ");
444 text::add_to_layout_box(state, contents, box, military::supply_limit_in_province(state, fat.get_nation_from_province_ownership().id, prov), text::text_color::yellow);
447 text::add_space_to_layout_box(state, contents, box);
448 text::add_to_layout_box(state, contents, box, text::format_float(state.world.province_get_modifier_values(prov, sys::provincial_mod_offsets::supply_limit), 1), text::text_color::yellow);
450
451 // "Borrowed" from military.cpp
452 auto prov_controller = state.world.province_get_nation_from_province_control(prov);
453 auto self_controlled = prov_controller == state.local_player_nation;
454 if(state.world.province_get_nation_from_province_ownership(prov) == state.local_player_nation && self_controlled) {
456 text::add_space_to_layout_box(state, contents, box);
459 } else if(auto dip_rel = state.world.get_diplomatic_relation_by_diplomatic_pair(prov_controller, state.local_player_nation); state.world.diplomatic_relation_get_are_allied(dip_rel) || fat.get_nation_from_province_control().get_overlord_as_subject().get_ruler() == state.local_player_nation) {
461 text::add_space_to_layout_box(state, contents, box);
464 } else if(auto uni_rel = state.world.get_unilateral_relationship_by_unilateral_pair(prov_controller, state.local_player_nation); state.world.unilateral_relationship_get_military_access(uni_rel)) {
466 text::add_space_to_layout_box(state, contents, box);
469 } else if(bool(state.world.get_core_by_prov_tag_key(prov, state.world.nation_get_identity_from_identity_holder(state.local_player_nation)))) {
471 text::add_space_to_layout_box(state, contents, box);
474 } else if(state.world.province_get_siege_progress(prov) > 0.0f) {
476 text::add_space_to_layout_box(state, contents, box);
479 }
480 text::close_layout_box(contents, box);
481 }
482}
483
484void party_loyalty_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
485 auto fat = dcon::fatten(state.world, prov);
486 country_name_box(state, contents, prov);
487
488 if(prov.value < state.province_definitions.first_sea_province.value) {
489 auto box = text::open_layout_box(contents);
490 text::localised_single_sub_box(state, contents, box, std::string_view("party_loyalty_desc_header"), text::variable_type::prov, prov);
491 std::vector<dcon::political_party_id> active_parties;
492 nations::get_active_political_parties(state, fat.get_nation_from_province_ownership(), active_parties);
493 for(auto party : active_parties) {
495 auto loyalty = state.world.province_get_party_loyalty(prov, dcon::fatten(state.world, party).get_ideology().id);
496 if(loyalty > 0) {
497 text::add_to_layout_box(state, contents, box, std::string_view("("), text::text_color::green);
498 text::add_to_layout_box(state, contents, box, dcon::fatten(state.world, party).get_ideology().get_name(), text::text_color::green);
499 text::add_to_layout_box(state, contents, box, std::string_view(") "), text::text_color::green);
500 } else {
501 text::add_to_layout_box(state, contents, box, std::string_view("("), text::text_color::yellow);
502 text::add_to_layout_box(state, contents, box, dcon::fatten(state.world, party).get_ideology().get_name(), text::text_color::yellow);
503 text::add_to_layout_box(state, contents, box, std::string_view(") "), text::text_color::yellow);
504 }
506 text::add_space_to_layout_box(state, contents, box);
508 }
509 text::close_layout_box(contents, box);
510 }
511}
512
513void rank_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
514 auto fat = dcon::fatten(state.world, prov);
515 country_name_box(state, contents, prov);
516
517 if(prov.value < state.province_definitions.first_sea_province.value) {
518 auto box = text::open_layout_box(contents);
519 switch(nations::get_status(state, fat.get_nation_from_province_ownership().id)) {
521 {
522 text::localised_single_sub_box(state, contents, box, std::string_view("sphere_of_infl_great_power"), text::variable_type::country, fat.get_nation_from_province_ownership().id);
524 break;
525 }
527 {
528 text::localised_single_sub_box(state, contents, box, std::string_view("world_ranking_secondary_power"), text::variable_type::country, fat.get_nation_from_province_ownership().id);
530 break;
531 }
532 default:
534 break;
535 };
536 text::localised_format_box(state, contents, box, std::string_view("world_ranking"));
537 text::add_space_to_layout_box(state, contents, box);
538 text::add_to_layout_box(state, contents, box, fat.get_nation_from_province_ownership().get_rank(), text::text_color::yellow);
539 text::close_layout_box(contents, box);
540 }
541}
542
543void migration_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // TODO - Needs Migration Map
544 auto fat = dcon::fatten(state.world, prov);
545 auto owner = fat.get_nation_from_province_ownership();
546
547 if(owner) {
548 {
549 auto box = text::open_layout_box(contents);
550 text::localised_format_box(state, contents, box, "im_em_header");
551 text::add_to_layout_box(state, contents, box, text::embedded_flag{ state.world.nation_get_identity_from_identity_holder(owner) });
552 text::add_space_to_layout_box(state, contents, box);
553 text::add_to_layout_box(state, contents, box, text::get_name(state, owner.id));
554 text::close_layout_box(contents, box);
555 }
556 struct nation_and_value {
557 float v;
558 dcon::nation_id n;
559 };
560
561 static dcon::nation_id last_owner;
562 static sys::date last_checked;
563 static std::vector<float> last_value;
564 static std::vector<nation_and_value> positive_vals;
565 static std::vector<nation_and_value> neg_vals;
566 static float total_pos = 0.0f;
567 static float total_neg = 0.0f;
568
569 auto d = state.ui_date;
570 if(d != last_checked || last_owner != owner) {
571 last_checked = d;
572 last_owner = owner;
573 total_pos = 0.0f;
574 total_neg = 0.0f;
575
577 positive_vals.clear();
578 neg_vals.clear();
579 for(uint32_t i = uint32_t(last_value.size()); i-- > 0; ) {
580 dcon::nation_id in{ dcon::nation_id::value_base_t(i) };
581 if(last_value[i] > 0.0f) {
582 positive_vals.push_back(nation_and_value{ last_value[i],in });
583 total_pos += last_value[i];
584 } else if(last_value[i] < 0.0f) {
585 neg_vals.push_back(nation_and_value{ last_value[i],in });
586 total_neg += last_value[i];
587 }
588 }
589
590 std::sort(positive_vals.begin(), positive_vals.end(), [](nation_and_value const& a, nation_and_value const& b) {
591 return a.v > b.v;
592 });
593 std::sort(neg_vals.begin(), neg_vals.end(), [](nation_and_value const& a, nation_and_value const& b) {
594 return a.v < b.v;
595 });
596 }
597
599 text::add_line(state, contents, "monthly_immigration_lab");
600 float total_accounted_for = 0.0f;
601 for(uint32_t i = 0; i < positive_vals.size() && i < 10; ++i) {
602 total_accounted_for += positive_vals[i].v;
603 auto box = text::open_layout_box(contents);
604
605 text::add_to_layout_box(state, contents, box, int64_t(positive_vals[i].v), text::text_color::green);
606 text::add_space_to_layout_box(state, contents, box);
607 text::add_to_layout_box(state, contents, box, text::embedded_flag{ state.world.nation_get_identity_from_identity_holder(positive_vals[i].n) });
608 text::add_space_to_layout_box(state, contents, box);
609 text::add_to_layout_box(state, contents, box, text::get_name(state, positive_vals[i].n));
610
611 text::close_layout_box(contents, box);
612 }
613 if(total_pos - total_accounted_for >= 1.0f) {
614 auto box = text::open_layout_box(contents);
615 text::add_to_layout_box(state, contents, box, int64_t(total_pos - total_accounted_for), text::text_color::green);
616 text::add_space_to_layout_box(state, contents, box);
617 text::localised_format_box(state, contents, box, "pop_other_cult");
618 text::close_layout_box(contents, box);
619 }
620
622 text::add_line(state, contents, "monthly_emigration_lab");
623 total_accounted_for = 0.0f;
624 for(uint32_t i = 0; i < neg_vals.size() && i < 10; ++i) {
625 total_accounted_for += neg_vals[i].v;
626 auto box = text::open_layout_box(contents);
627
628 text::add_to_layout_box(state, contents, box, int64_t(-neg_vals[i].v), text::text_color::red);
629 text::add_space_to_layout_box(state, contents, box);
630 text::add_to_layout_box(state, contents, box, text::embedded_flag{ state.world.nation_get_identity_from_identity_holder(neg_vals[i].n) });
631 text::add_space_to_layout_box(state, contents, box);
632 text::add_to_layout_box(state, contents, box, text::get_name(state, neg_vals[i].n));
633
634 text::close_layout_box(contents, box);
635 }
636 if(total_neg - total_accounted_for <= -1.0f) {
637 auto box = text::open_layout_box(contents);
638 text::add_to_layout_box(state, contents, box, int64_t(-(total_neg - total_accounted_for)), text::text_color::red);
639 text::add_space_to_layout_box(state, contents, box);
640 text::localised_format_box(state, contents, box, "pop_other_cult");
641 text::close_layout_box(contents, box);
642 }
643 } else {
644
645 }
646}
647
648void civilsation_level_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { //Done
649 auto fat = dcon::fatten(state.world, prov);
650 country_name_box(state, contents, prov);
651
652 if(prov.value < state.province_definitions.first_sea_province.value) {
653 auto box = text::open_layout_box(contents);
654
655 switch(nations::get_status(state, fat.get_nation_from_province_ownership().id)) {
657 {
658 text::localised_format_box(state, contents, box, std::string_view("diplomacy_greatnation_status"));
659 break;
660 }
662 {
663 text::localised_format_box(state, contents, box, std::string_view("diplomacy_colonialnation_status"));
664 break;
665 }
667 {
668 text::localised_format_box(state, contents, box, std::string_view("diplomacy_civilizednation_status"));
669 // Civil
670 break;
671 }
673 {
674 text::localised_format_box(state, contents, box, std::string_view("diplomacy_almost_western_nation_status"));
676 auto civpro = state.world.nation_get_modifier_values(fat.get_nation_from_province_ownership().id, sys::national_mod_offsets::civilization_progress_modifier);
677 text::add_to_layout_box(state, contents, box, text::produce_simple_string(state, std::string_view("modifier_civilization_progress")) + ": ");
679 // ???
680 break;
681 }
683 {
684 text::localised_format_box(state, contents, box, std::string_view("diplomacy_uncivilizednation_status"));
686 auto civpro = state.world.nation_get_modifier_values(fat.get_nation_from_province_ownership().id, sys::national_mod_offsets::civilization_progress_modifier);
687 text::add_to_layout_box(state, contents, box, text::produce_simple_string(state, std::string_view("modifier_civilization_progress")) + ": ");
689 // Nothing
690 break;
691 }
693 {
694 text::localised_format_box(state, contents, box, std::string_view("diplomacy_primitivenation_status"));
696 auto civpro = state.world.nation_get_modifier_values(fat.get_nation_from_province_ownership().id, sys::national_mod_offsets::civilization_progress_modifier);
697 text::add_to_layout_box(state, contents, box, text::produce_simple_string(state, std::string_view("modifier_civilization_progress")) + ": ");
699 // Nothing
700 break;
701 }
702 default:
703 break;
704 };
705
706 text::close_layout_box(contents, box);
707 }
708}
709
710void relation_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { //Done
711 auto fat = dcon::fatten(state.world, prov);
712 country_name_box(state, contents, prov);
713
714 if(prov.value < state.province_definitions.first_sea_province.value) {
715 auto box = text::open_layout_box(contents);
716
717 if(dcon::fatten(state.world, state.map_state.selected_province).is_valid()
718 && dcon::fatten(state.world, state.map_state.selected_province).get_nation_from_province_ownership() != fat.get_nation_from_province_ownership()) {
720 auto rel = state.world.get_diplomatic_relation_by_diplomatic_pair(fat.get_nation_from_province_ownership().id, dcon::fatten(state.world, state.map_state.selected_province).get_nation_from_province_ownership());
721 auto fat_rel = dcon::fatten(state.world, rel);
722 text::add_to_substitution_map(sub, text::variable_type::country1, dcon::fatten(state.world, state.map_state.selected_province).get_nation_from_province_ownership().id);
723 text::add_to_substitution_map(sub, text::variable_type::country2, fat.get_nation_from_province_ownership().id);
724 text::add_to_substitution_map(sub, text::variable_type::relation, int32_t(fat_rel.get_value()));
725 text::localised_format_box(state, contents, box, std::string_view("relation_between"), sub);
726
727 } else if(!dcon::fatten(state.world, state.map_state.selected_province).is_valid()
728 && dcon::fatten(state.world, state.local_player_nation) != fat.get_nation_from_province_ownership()) {
730 auto rel = state.world.get_diplomatic_relation_by_diplomatic_pair(fat.get_nation_from_province_ownership().id, state.local_player_nation);
731 auto fat_rel = dcon::fatten(state.world, rel);
733 text::add_to_substitution_map(sub, text::variable_type::country2, fat.get_nation_from_province_ownership().id);
734 text::add_to_substitution_map(sub, text::variable_type::relation, int32_t(fat_rel.get_value()));
735 text::localised_format_box(state, contents, box, std::string_view("relation_between"), sub);
736 }
737
738 text::close_layout_box(contents, box);
739 }
740}
741
742void crisis_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
743 auto fat = dcon::fatten(state.world, prov);
744 country_name_box(state, contents, prov);
745
746 if(prov.value < state.province_definitions.first_sea_province.value) {
747 auto box = text::open_layout_box(contents);
748 text::localised_single_sub_box(state, contents, box, std::string_view("flashpoint_tension"), text::variable_type::value, std::to_string(int32_t(fat.get_state_membership().get_flashpoint_tension())));
749 text::close_layout_box(contents, box);
750 }
751}
752
753void naval_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
754 auto fat = dcon::fatten(state.world, prov);
755 country_name_box(state, contents, prov);
756
757 if(prov.value < state.province_definitions.first_sea_province.value
758 && fat.get_nation_from_province_ownership().id.value == state.local_player_nation.value
759 && fat.get_is_coast()) {
760 auto box = text::open_layout_box(contents);
761 if(fat.get_building_level(uint8_t(economy::province_building_type::naval_base)) == 0) {
762 dcon::province_id navalprov{};
763 for(auto p : fat.get_state_from_abstract_state_membership().get_abstract_state_membership()) {
764 if(dcon::fatten(state.world, p).get_province().get_building_level(uint8_t(economy::province_building_type::naval_base)) != 0) {
765 navalprov = p.get_province().id;
766 break;
767 }
768 }
769 if(dcon::fatten(state.world, navalprov).is_valid()) {
770 text::localised_single_sub_box(state, contents, box, std::string_view("mapmode_naval_tooltip_in_other"), text::variable_type::prov, navalprov);
771 } else {
773 text::localised_format_box(state, contents, box, std::string_view("mapmode_naval_tooltip_under_con"));
774 } else {
775 text::localised_format_box(state, contents, box, std::string_view("mapmode_naval_tooltip_no_base"));
776 }
777 }
778 } else {
779 text::localised_single_sub_box(state, contents, box, std::string_view("mapmode_naval_tooltip_level"), text::variable_type::lvl, fat.get_building_level(uint8_t(economy::province_building_type::naval_base)));
784 text::localised_format_box(state, contents, box, std::string_view("mapmode_naval_tooltip_cap"), sub);
785 }
786
787 if(province::is_overseas(state, prov)) {
789 text::localised_format_box(state, contents, box, std::string_view("naval_base_overseas_limit"));
790 }
791
792 text::close_layout_box(contents, box);
793 }
794}
795
796void religion_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
797 auto fat = dcon::fatten(state.world, prov);
798 country_name_box(state, contents, prov);
799
800 if(prov.value < state.province_definitions.first_sea_province.value) {
801 auto box = text::open_layout_box(contents);
802
803 text::localised_single_sub_box(state, contents, box, std::string_view("mapmode_tooltip_religion_majorities"), text::variable_type::prov, prov);
804
805 std::vector<dcon::religion_fat_id> religions;
806 for(auto pop : fat.get_pop_location()) {
807 if(std::find(religions.begin(), religions.end(), pop.get_pop().get_religion()) == religions.end()) {
808 religions.push_back(pop.get_pop().get_religion());
809 }
810 }
811 std::sort(religions.begin(), religions.end(), [&](auto a, auto b) {return fat.get_demographics(demographics::to_key(state, a.id)) > fat.get_demographics(demographics::to_key(state, b.id)); });
812 //for(size_t i = religions.size(); i > 0; i--) {
813 for(size_t i = 0; i < religions.size(); i++) {
815 text::add_space_to_layout_box(state, contents, box);
816 text::add_to_layout_box(state, contents, box, religions[i].get_name(), text::text_color::yellow);
817 text::add_space_to_layout_box(state, contents, box);
818 text::add_to_layout_box(state, contents, box, std::string_view("("), text::text_color::white);
819 text::add_to_layout_box(state, contents, box, text::format_percentage(fat.get_demographics(demographics::to_key(state, religions[i].id)) / fat.get_demographics(demographics::total)), text::text_color::white);
820 text::add_to_layout_box(state, contents, box, std::string_view(")"), text::text_color::white);
821 }
822
823 text::close_layout_box(contents, box);
824 }
825}
826
827void issues_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
828 auto fat = dcon::fatten(state.world, prov);
829 country_name_box(state, contents, prov);
830
831 if(prov.value < state.province_definitions.first_sea_province.value) {
832 auto box = text::open_layout_box(contents);
833
834 text::localised_single_sub_box(state, contents, box, std::string_view("mapmode_tooltip_dominant_issues"), text::variable_type::prov, prov);
835
836 std::vector<dcon::issue_option_fat_id> issues;
837 state.world.for_each_issue_option([&](dcon::issue_option_id id) {
838 if(fat.get_demographics(demographics::to_key(state, id)) > 0) {
839 issues.push_back(dcon::fatten(state.world, id));
840 }
841 });
842 std::sort(issues.begin(), issues.end(), [&](auto a, auto b) {return fat.get_demographics(demographics::to_key(state, a)) > fat.get_demographics(demographics::to_key(state, b)); });
843 for(size_t i = 0; i < std::min(static_cast<size_t>(5), issues.size()); i++) {
845 text::add_space_to_layout_box(state, contents, box);
846 text::add_to_layout_box(state, contents, box, issues[i].get_name(), text::text_color::yellow);
847 text::add_space_to_layout_box(state, contents, box);
848 text::add_to_layout_box(state, contents, box, std::string_view("("), text::text_color::white);
849 text::add_to_layout_box(state, contents, box, text::format_percentage(fat.get_demographics(demographics::to_key(state, issues[i].id)) / fat.get_demographics(demographics::total)), text::text_color::white);
850 text::add_to_layout_box(state, contents, box, std::string_view(")"), text::text_color::white);
851 }
852
853 text::close_layout_box(contents, box);
854 }
855}
856
857void income_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
858 auto fat = dcon::fatten(state.world, prov);
859 country_name_box(state, contents, prov);
860
861 if(prov.value < state.province_definitions.first_sea_province.value) {
862 auto box = text::open_layout_box(contents);
863 float savings = 0.f;
864 for(auto pop : fat.get_pop_location()) {
865 savings += pop.get_pop().get_savings();
866 }
867 text::localised_single_sub_box(state, contents, box, std::string_view("mapmode_tooltip_total_income"), text::variable_type::prov, prov);
869 text::close_layout_box(contents, box);
870 }
871}
872
873void ideology_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
874 auto fat = dcon::fatten(state.world, prov);
875 country_name_box(state, contents, prov);
876
877 if(prov.value < state.province_definitions.first_sea_province.value) {
878 auto box = text::open_layout_box(contents);
879
880 text::localised_single_sub_box(state, contents, box, std::string_view("mapmode_tooltip_dominant_ideology"), text::variable_type::prov, prov);
881
882 std::vector<dcon::ideology_fat_id> ideologies;
883 float total_pops = state.world.province_get_demographics(prov, demographics::total);
884 state.world.for_each_ideology([&](dcon::ideology_id id) {
885 if(fat.get_demographics(demographics::to_key(state, id)) > 0) {
886 ideologies.push_back(dcon::fatten(state.world, id));
887 }
888 });
889 std::sort(ideologies.begin(), ideologies.end(), [&](auto a, auto b) {return fat.get_demographics(demographics::to_key(state, a.id)) > fat.get_demographics(demographics::to_key(state, b.id)); });
890 for(size_t i = 0; i < ideologies.size(); i++) {
892 text::add_space_to_layout_box(state, contents, box);
893 text::add_to_layout_box(state, contents, box, ideologies[i].get_name(), text::text_color::yellow);
894 text::add_space_to_layout_box(state, contents, box);
895 text::add_to_layout_box(state, contents, box, std::string_view("("), text::text_color::white);
896 text::add_to_layout_box(state, contents, box, text::format_percentage(fat.get_demographics(demographics::to_key(state, ideologies[i].id)) / fat.get_demographics(demographics::total)), text::text_color::white);
897 text::add_to_layout_box(state, contents, box, std::string_view(")"), text::text_color::white);
898 }
899
900 text::close_layout_box(contents, box);
901 }
902}
903
904void con_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
905 auto fat = dcon::fatten(state.world, prov);
906 country_name_box(state, contents, prov);
907
908 if(prov.value < state.province_definitions.first_sea_province.value) {
909 float average_con = (fat.get_demographics(demographics::total) == 0.f ? 0.f : fat.get_demographics(demographics::consciousness) / fat.get_demographics(demographics::total));
910 text::add_line(state, contents, "mapmode_tooltip_con_average", text::variable_type::val, text::fp_one_place{ average_con });
911 ui::active_modifiers_description(state, contents, prov, 0, sys::provincial_mod_offsets::pop_consciousness_modifier, true);
912 ui::active_modifiers_description(state, contents, state.world.province_control_get_nation(state.world.province_get_province_control_as_province(prov)), 0, sys::national_mod_offsets::core_pop_consciousness_modifier, true);
913 ui::active_modifiers_description(state, contents, state.world.province_control_get_nation(state.world.province_get_province_control_as_province(prov)), 0, sys::national_mod_offsets::global_pop_consciousness_modifier, true);
914 ui::active_modifiers_description(state, contents, state.world.province_control_get_nation(state.world.province_get_province_control_as_province(prov)), 0, sys::national_mod_offsets::non_accepted_pop_consciousness_modifier, true);
915 }
916}
917
918void employment_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
919 auto fat = dcon::fatten(state.world, prov);
920 country_name_box(state, contents, prov);
921
922 if(prov.value < state.province_definitions.first_sea_province.value) {
923 auto box = text::open_layout_box(contents);
924
925 float employment_rate = fat.get_demographics(demographics::employable) == 0.f ? 0.f : (fat.get_demographics(demographics::employed) / fat.get_demographics(demographics::employable));
926
927 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_total_employment"));
929
930 text::close_layout_box(contents, box);
931 }
932}
933
934void literacy_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
935 auto fat = dcon::fatten(state.world, prov);
936 country_name_box(state, contents, prov);
937
938 if(prov.value < state.province_definitions.first_sea_province.value) {
939 auto box = text::open_layout_box(contents);
940
941 float literacy_rate = fat.get_demographics(demographics::total) == 0.f ? 0.f : (fat.get_demographics(demographics::literacy) / fat.get_demographics(demographics::total));
942
943 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_literacy_rate"));
945
946 text::close_layout_box(contents, box);
947 }
948}
949
950void factory_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
951 auto fat = dcon::fatten(state.world, prov);
952 country_name_box(state, contents, prov);
953
954 if(prov.value < state.province_definitions.first_sea_province.value && fat.get_nation_from_province_ownership()) {
955 auto box = text::open_layout_box(contents);
956
957 auto region = fat.get_state_membership();
958
959 text::localised_single_sub_box(state, contents, box, std::string_view("mapmode_tooltip_factory_count"), text::variable_type::state, text::get_province_state_name(state, prov));
960
961 std::vector<dcon::factory_fat_id> factories;
962 for(auto m : fat.get_state_from_abstract_state_membership().get_abstract_state_membership()) {
963 auto p = m.get_province();
964 if(p.get_nation_from_province_ownership() == fat.get_nation_from_province_ownership()) {
965 for(auto f : p.get_factory_location()) {
966 factories.push_back(f.get_factory());
967 }
968 }
969 }
970 std::sort(factories.begin(), factories.end(), [&](auto a, auto b) {return a.get_level() > b.get_level(); });
971
973 for(size_t i = 0; i < factories.size(); i++) {
975 text::add_space_to_layout_box(state, contents, box);
976 text::add_to_layout_box(state, contents, box, factories[i].get_building_type().get_name(), text::text_color::yellow);
977 text::add_space_to_layout_box(state, contents, box);
978 text::add_to_layout_box(state, contents, box, std::string_view("("), text::text_color::white);
979 text::add_to_layout_box(state, contents, box, factories[i].get_level(),text::text_color::white);
980 text::add_to_layout_box(state, contents, box, std::string_view(")"), text::text_color::white);
981 }
982
983 text::close_layout_box(contents, box);
984 }
985}
986
987void fort_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
988 auto fat = dcon::fatten(state.world, prov);
989 country_name_box(state, contents, prov);
990
991
992 if(prov.value < state.province_definitions.first_sea_province.value) {
993 if(fat.get_building_level(uint8_t(economy::province_building_type::fort)) > 0) {
994 auto box = text::open_layout_box(contents);
995 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_fort_level"));
997 text::close_layout_box(contents, box);
998 }
1000 auto box3 = text::open_layout_box(contents);
1001 text::localised_format_box(state, contents, box3, std::string_view("mapmode_tooltip_fort_being_built"));
1002 text::close_layout_box(contents, box3);
1003 }
1004 if(province::can_build_fort(state, fat.id, state.local_player_nation)) {
1005 auto box3 = text::open_layout_box(contents);
1006 text::localised_format_box(state, contents, box3, std::string_view("mapmode_tooltip_can_build_fort"));
1007 text::close_layout_box(contents, box3);
1008 }
1009 }
1010}
1011
1012void growth_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1013 auto fat = dcon::fatten(state.world, prov);
1014 country_name_box(state, contents, prov);
1015
1016 if(prov.value < state.province_definitions.first_sea_province.value) {
1017 auto box = text::open_layout_box(contents);
1018
1019 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_population_change"));
1021
1022 text::close_layout_box(contents, box);
1023 }
1024}
1025
1026void revolt_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1027 auto fat = dcon::fatten(state.world, prov);
1028 country_name_box(state, contents, prov);
1029
1030 if(prov.value < state.province_definitions.first_sea_province.value) {
1031 auto total_rebels = 0.f;
1032 std::vector<std::pair<dcon::rebel_faction_id, float>> rebel_factions;
1033 for(auto pop : fat.get_pop_location()) {
1034 if(pop.get_pop().get_pop_rebellion_membership().get_rebel_faction()) {
1035 auto fid = pop.get_pop().get_pop_rebellion_membership().get_rebel_faction().id;
1036 auto rebel_pop = pop.get_pop().get_size();
1037 auto f = std::find_if(rebel_factions.begin(), rebel_factions.end(), [fid](const auto& pair) {
1038 return pair.first == fid;
1039 });
1040 if(f != rebel_factions.end()) {
1041 f->second += rebel_pop;
1042 } else {
1043 rebel_factions.push_back(std::make_pair(fid, rebel_pop));
1044 }
1045 total_rebels += pop.get_pop().get_size();
1046 }
1047 }
1048 std::sort(rebel_factions.begin(), rebel_factions.end(), [&](auto a, auto b) {return a.second > b.second; });
1049
1050 auto box = text::open_layout_box(contents);
1051
1052 if(total_rebels <= 0.f) {
1053 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_rebels_none"));
1054 } else {
1055 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_rebels_amount"));
1056 text::add_to_layout_box(state, contents, box, text::prettify(int64_t(total_rebels)), text::text_color::yellow);
1057
1058 for(size_t i = 0; i < rebel_factions.size(); i++) {
1060 text::add_space_to_layout_box(state, contents, box);
1061 text::add_to_layout_box(state, contents, box, rebel::rebel_name(state, rebel_factions[i].first), text::text_color::yellow);
1062 text::add_space_to_layout_box(state, contents, box);
1063 text::add_to_layout_box(state, contents, box, std::string_view("("), text::text_color::white);
1064 text::add_to_layout_box(state, contents, box, text::prettify(int64_t(rebel_factions[i].second)), text::text_color::white);
1065 text::add_to_layout_box(state, contents, box, std::string_view(")"), text::text_color::white);
1066 }
1067 }
1068
1069 text::close_layout_box(contents, box);
1070 }
1071}
1072
1073void players_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1074 auto fat = dcon::fatten(state.world, prov);
1075 country_name_box(state, contents, prov);
1076 if(prov.value < state.province_definitions.first_sea_province.value) {
1077 auto n = state.world.province_get_nation_from_province_ownership(prov);
1078 if(n) {
1079 auto box = text::open_layout_box(contents);
1081 text::add_to_substitution_map(sub, text::variable_type::x, state.network_state.map_of_player_names[n.index()].to_string_view());
1082 if(n == state.local_player_nation) {
1083 if(state.network_mode == sys::network_mode_type::single_player) {
1084 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_34_you_sp"), sub);
1085 } else {
1086 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_34_you"), sub);
1087 }
1088 } else if(state.world.nation_get_is_player_controlled(n)) {
1089 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_34"), sub);
1090 }
1091 if(!state.world.nation_get_is_player_controlled(n)) {
1092 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_34_ai"), sub);
1093 }
1094 text::close_layout_box(contents, box);
1095 }
1096 }
1097}
1098void life_needs_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1099 auto fat = dcon::fatten(state.world, prov);
1100 country_name_box(state, contents, prov);
1101 if(prov.value < state.province_definitions.first_sea_province.value) {
1102 float value = 0.f;
1103 float total = 0.f;
1104 for(const auto pl : state.world.province_get_pop_location_as_province(prov)) {
1105 value += pop_demographics::get_life_needs(state, pl.get_pop()) * pl.get_pop().get_size();
1106 total += pl.get_pop().get_size();
1107 }
1108 if(total > 0.f) {
1109 float ratio = value / total;
1110 auto box = text::open_layout_box(contents);
1113 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_35"), sub);
1114 text::close_layout_box(contents, box);
1115 }
1116 }
1117}
1118void everyday_needs_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1119 auto fat = dcon::fatten(state.world, prov);
1120 country_name_box(state, contents, prov);
1121 if(prov.value < state.province_definitions.first_sea_province.value) {
1122 float value = 0.f;
1123 float total = 0.f;
1124 for(const auto pl : state.world.province_get_pop_location_as_province(prov)) {
1125 value += pop_demographics::get_everyday_needs(state, pl.get_pop()) * pl.get_pop().get_size();
1126 total += pl.get_pop().get_size();
1127 }
1128 if(total > 0.f) {
1129 float ratio = value / total;
1130 auto box = text::open_layout_box(contents);
1133 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_36"), sub);
1134 text::close_layout_box(contents, box);
1135 }
1136 }
1137}
1138void luxury_needs_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1139 auto fat = dcon::fatten(state.world, prov);
1140 country_name_box(state, contents, prov);
1141 if(prov.value < state.province_definitions.first_sea_province.value) {
1142 float value = 0.f;
1143 float total = 0.f;
1144 for(const auto pl : state.world.province_get_pop_location_as_province(prov)) {
1145 value += pop_demographics::get_luxury_needs(state, pl.get_pop()) * pl.get_pop().get_size();
1146 total += pl.get_pop().get_size();
1147 }
1148 if(total > 0.f) {
1149 float ratio = value / total;
1150 auto box = text::open_layout_box(contents);
1153 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_37"), sub);
1154 text::close_layout_box(contents, box);
1155 }
1156 }
1157}
1158void officers_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1159 auto fat = dcon::fatten(state.world, prov);
1160 country_name_box(state, contents, prov);
1161 if(prov.value < state.province_definitions.first_sea_province.value) {
1162 float value = state.world.province_get_demographics(prov, demographics::to_key(state, state.culture_definitions.officers));
1163 float total = state.world.province_get_demographics(prov, demographics::total);
1164 float ratio = value / std::max(1.f, total);
1165 auto box = text::open_layout_box(contents);
1170 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_38"), sub);
1171 text::close_layout_box(contents, box);
1172 }
1173}
1174void ctc_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1175 auto fat = dcon::fatten(state.world, prov);
1176 country_name_box(state, contents, prov);
1177 if(prov.value < state.province_definitions.first_sea_province.value) {
1178 float total_pw = state.world.province_get_demographics(prov, demographics::to_key(state, state.culture_definitions.primary_factory_worker));
1179 float total_sw = state.world.province_get_demographics(prov, demographics::to_key(state, state.culture_definitions.secondary_factory_worker));
1180 float ratio = total_pw / std::max(1.f, total_pw + total_sw);
1181 auto box = text::open_layout_box(contents);
1187 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_39"), sub);
1188 text::close_layout_box(contents, box);
1189 }
1190}
1191void life_rating_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1192 auto fat = dcon::fatten(state.world, prov);
1193 country_name_box(state, contents, prov);
1194 if(prov.value < state.province_definitions.first_sea_province.value) {
1195 auto box = text::open_layout_box(contents);
1197 text::add_to_substitution_map(sub, text::variable_type::x, text::pretty_integer{ int32_t(state.world.province_get_life_rating(prov)) });
1198 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_40"), sub);
1199 text::close_layout_box(contents, box);
1200 }
1201}
1202void crime_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1203 auto fat = dcon::fatten(state.world, prov);
1204 country_name_box(state, contents, prov);
1205 if(prov.value < state.province_definitions.first_sea_province.value && state.world.province_get_crime(prov)) {
1206 auto box = text::open_layout_box(contents);
1208 text::add_to_substitution_map(sub, text::variable_type::x, state.culture_definitions.crimes[state.world.province_get_crime(prov)].name);
1209 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_41"), sub);
1210 text::close_layout_box(contents, box);
1211 ui::modifier_description(state, contents, state.culture_definitions.crimes[state.world.province_get_crime(prov)].modifier);
1212 }
1213}
1214void rally_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1215 auto fat = dcon::fatten(state.world, prov);
1216 country_name_box(state, contents, prov);
1217 if(prov.value < state.province_definitions.first_sea_province.value) {
1218 text::add_line_with_condition(state, contents, "mapmode_tooltip_42_1", state.world.province_get_land_rally_point(prov));
1219 text::add_line_with_condition(state, contents, "mapmode_tooltip_42_2", state.world.province_get_naval_rally_point(prov));
1220 }
1221}
1222void workforce_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1223 auto fat = dcon::fatten(state.world, prov);
1224 country_name_box(state, contents, prov);
1225 if(prov.value < state.province_definitions.first_sea_province.value) {
1226 {
1227 auto box = text::open_layout_box(contents);
1228 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_43"));
1229 text::close_layout_box(contents, box);
1230 }
1231 float total = state.world.province_get_demographics(prov, demographics::total);
1232 for(const auto pt : state.world.in_pop_type) {
1233 float value = state.world.province_get_demographics(prov, demographics::to_key(state, pt));
1234 if(value > 0.f) {
1235 auto box = text::open_layout_box(contents);
1236 text::add_to_layout_box(state, contents, box, pt.get_name(), text::text_color::white);
1237 text::add_to_layout_box(state, contents, box, std::string_view(":"), text::text_color::white);
1238 text::add_space_to_layout_box(state, contents, box);
1240 text::add_space_to_layout_box(state, contents, box);
1241 text::add_to_layout_box(state, contents, box, std::string_view("("), text::text_color::yellow);
1243 text::add_to_layout_box(state, contents, box, std::string_view(")"), text::text_color::yellow);
1244 text::close_layout_box(contents, box);
1245 }
1246 }
1247 }
1248}
1249void mobilization_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1250 auto fat = dcon::fatten(state.world, prov);
1251 country_name_box(state, contents, prov);
1252 if(prov.value < state.province_definitions.first_sea_province.value) {
1255 auto box = text::open_layout_box(contents);
1259 if(max == 0) {
1260 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_44_2"), sub);
1261 } else {
1262 text::localised_format_box(state, contents, box, std::string_view("mapmode_tooltip_44"), sub);
1263 }
1264 text::close_layout_box(contents, box);
1265 }
1266}
1267
1268void picking_map_tt_box(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) { // Done
1269 country_name_box(state, contents, prov);
1270 if(auto n = state.world.province_get_nation_from_province_ownership(prov); n) {
1271 auto fat_id = dcon::fatten(state.world, n);
1272 auto box = text::open_layout_box(contents);
1275 auto total = fat_id.get_demographics(demographics::total);
1276 if(total > 0.f) {
1277 {
1280 text::localised_format_box(state, contents, box, std::string_view("alice_pnt_pops"), sub);
1282 }
1283 {
1284 auto value = fat_id.get_demographics(demographics::rich_total);
1288 text::localised_format_box(state, contents, box, std::string_view("alice_pnt_rpops"), sub);
1290 }
1291 {
1292 auto value = fat_id.get_demographics(demographics::middle_total);
1296 text::localised_format_box(state, contents, box, std::string_view("alice_pnt_mpops"), sub);
1298 }
1299 {
1300 auto value = fat_id.get_demographics(demographics::poor_total);
1304 text::localised_format_box(state, contents, box, std::string_view("alice_pnt_ppops"), sub);
1306 }
1307 }
1308 if(fat_id.get_primary_culture()) {
1310 text::add_to_substitution_map(sub, text::variable_type::x, fat_id.get_primary_culture().get_name());
1311 text::localised_format_box(state, contents, box, std::string_view("alice_pnt_culture"), sub);
1313 }
1314 if(fat_id.get_religion()) {
1316 text::add_to_substitution_map(sub, text::variable_type::x, fat_id.get_religion().get_name());
1317 text::localised_format_box(state, contents, box, std::string_view("alice_pnt_religion"), sub);
1319 }
1320 if(fat_id.get_dominant_religion()) {
1322 text::add_to_substitution_map(sub, text::variable_type::x, fat_id.get_dominant_religion().get_name());
1323 text::localised_format_box(state, contents, box, std::string_view("alice_pnt_dominant_religion"), sub);
1325 }
1326 if(fat_id.get_dominant_ideology()) {
1328 text::add_to_substitution_map(sub, text::variable_type::x, fat_id.get_dominant_ideology().get_name());
1329 text::localised_format_box(state, contents, box, std::string_view("alice_pnt_dominant_ideology"), sub);
1331 }
1333 text::close_layout_box(contents, box);
1334 }
1335}
1336
1337void populate_map_tooltip(sys::state& state, text::columnar_layout& contents, dcon::province_id prov) {
1338 if(state.current_scene.overwrite_map_tooltip) {
1339 picking_map_tt_box(state, contents, prov);
1340 return;
1341 }
1342
1343 switch(state.map_state.active_map_mode) {
1345 terrain_map_tt_box(state, contents, prov);
1346 break;
1348 political_map_tt_box(state, contents, prov);
1349 break;
1351 political_map_tt_box(state, contents, prov);
1352 break;
1354 revolt_map_tt_box(state, contents, prov);
1355 break;
1357 diplomatic_map_tt_box(state, contents, prov);
1358 break;
1360 region_map_tt_box(state, contents, prov);
1361 break;
1363 infrastructure_map_tt_box(state, contents, prov);
1364 break;
1366 colonial_map_tt_box(state, contents, prov);
1367 break;
1369 admin_map_tt_box(state, contents, prov);
1370 break;
1372 recruitment_map_tt_box(state, contents, prov);
1373 break;
1375 nationalfocus_map_tt_box(state, contents, prov);
1376 break;
1378 rgooutput_map_tt_box(state, contents, prov);
1379 break;
1381 population_map_tt_box(state, contents, prov);
1382 break;
1384 nationality_map_tt_box(state, contents, prov);
1385 break;
1387 sphere_map_tt_box(state, contents, prov);
1388 break;
1390 supply_map_tt_box(state, contents, prov);
1391 break;
1393 party_loyalty_map_tt_box(state, contents, prov);
1394 break;
1396 rank_map_tt_box(state, contents, prov);
1397 break;
1399 migration_map_tt_box(state, contents, prov);
1400 break;
1402 civilsation_level_map_tt_box(state, contents, prov);
1403 break;
1405 relation_map_tt_box(state, contents, prov);
1406 break;
1408 crisis_map_tt_box(state, contents, prov);
1409 break;
1411 naval_map_tt_box(state, contents, prov);
1412 break;
1414 religion_map_tt_box(state, contents, prov);
1415 break;
1417 issues_map_tt_box(state, contents, prov);
1418 break;
1420 income_map_tt_box(state, contents, prov);
1421 break;
1423 ideology_map_tt_box(state, contents, prov);
1424 break;
1426 con_map_tt_box(state, contents, prov);
1427 break;
1429 employment_map_tt_box(state, contents, prov);
1430 break;
1432 literacy_map_tt_box(state, contents, prov);
1433 break;
1435 factory_map_tt_box(state, contents, prov);
1436 break;
1438 fort_map_tt_box(state, contents, prov);
1439 break;
1441 growth_map_tt_box(state, contents, prov);
1442 break;
1444 militancy_map_tt_box(state, contents, prov);
1445 break;
1446 //even newer mapmodes
1448 players_map_tt_box(state, contents, prov);
1449 break;
1451 life_needs_map_tt_box(state, contents, prov);
1452 break;
1454 everyday_needs_map_tt_box(state, contents, prov);
1455 break;
1457 luxury_needs_map_tt_box(state, contents, prov);
1458 break;
1460 life_rating_map_tt_box(state, contents, prov);
1461 break;
1463 ctc_map_tt_box(state, contents, prov);
1464 break;
1466 mobilization_map_tt_box(state, contents, prov);
1467 break;
1469 officers_map_tt_box(state, contents, prov);
1470 break;
1472 crime_map_tt_box(state, contents, prov);
1473 break;
1475 rally_map_tt_box(state, contents, prov);
1476 break;
1478 workforce_map_tt_box(state, contents, prov);
1479 break;
1480 default:
1481 break;
1482 };
1483}
1484
1485}
dcon::text_key get_name() noexcept
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
void estimate_directed_immigration(sys::state &state, dcon::nation_id n, std::vector< float > &national_amounts)
constexpr dcon::demographics_key middle_total(21)
constexpr dcon::demographics_key total(0)
dcon::demographics_key to_key(sys::state const &state, dcon::pop_type_id v)
constexpr dcon::demographics_key employable(1)
constexpr dcon::demographics_key consciousness(3)
constexpr dcon::demographics_key rich_total(22)
constexpr dcon::demographics_key poor_total(20)
constexpr dcon::demographics_key employed(2)
float get_monthly_pop_increase(sys::state &state, dcon::pop_id ids)
constexpr dcon::demographics_key literacy(5)
int32_t regiments_under_construction_in_province(sys::state &state, dcon::province_id p)
Definition: military.cpp:810
int32_t mobilized_regiments_created_from_province(sys::state &state, dcon::province_id p)
Definition: military.cpp:657
uint32_t naval_supply_from_naval_base(sys::state &state, dcon::province_id prov, dcon::nation_id nation)
Definition: military.cpp:1078
int32_t regiments_created_from_province(sys::state &state, dcon::province_id p)
Definition: military.cpp:647
int32_t mobilized_regiments_possible_from_province(sys::state &state, dcon::province_id p)
Definition: military.cpp:959
bool are_at_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
Definition: military.cpp:475
int32_t supply_limit_in_province(sys::state &state, dcon::nation_id n, dcon::province_id p)
Definition: military.cpp:618
int32_t regiments_max_possible_from_province(sys::state &state, dcon::province_id p)
Definition: military.cpp:709
int32_t naval_supply_points(sys::state &state, dcon::nation_id n)
Definition: military.cpp:1071
constexpr uint8_t level_mask
Definition: nations.hpp:163
int32_t get_level(sys::state &state, dcon::nation_id gp, dcon::nation_id target)
Definition: nations.cpp:23
status get_status(sys::state &state, dcon::nation_id n)
Definition: nations.cpp:580
std::string int_to_tag(uint32_t v)
Definition: nations.hpp:10
void get_active_political_parties(sys::state &state, dcon::nation_id n, std::vector< dcon::political_party_id > &parties)
Definition: nations.cpp:892
float get_luxury_needs(sys::state const &state, dcon::pop_id p)
float get_life_needs(sys::state const &state, dcon::pop_id p)
float get_everyday_needs(sys::state const &state, dcon::pop_id p)
constexpr uint8_t impassible_bit
Definition: constants.hpp:595
constexpr uint8_t coastal_bit
Definition: constants.hpp:594
float direct_distance(sys::state &state, dcon::province_id a, dcon::province_id b)
Definition: province.cpp:1555
float sorting_distance(sys::state &state, dcon::province_id a, dcon::province_id b)
Definition: province.cpp:1562
bool has_an_owner(sys::state &state, dcon::province_id id)
Definition: province.cpp:452
bool has_naval_base_being_built(sys::state &state, dcon::province_id id)
Definition: province.cpp:384
bool is_overseas(sys::state const &state, dcon::province_id ids)
Definition: province.cpp:18
bool can_build_fort(sys::state &state, dcon::province_id id, dcon::nation_id n)
Definition: province.cpp:370
bool can_start_colony(sys::state &state, dcon::nation_id n, dcon::state_definition_id d)
Definition: province.cpp:1097
bool has_fort_being_built(sys::state &state, dcon::province_id id)
Definition: province.cpp:363
float revolt_risk(sys::state &state, dcon::province_id id)
Definition: province.cpp:561
float state_admin_efficiency(sys::state &state, dcon::state_instance_id id)
Definition: province.cpp:503
std::string rebel_name(sys::state &state, dcon::rebel_faction_id reb)
Definition: rebels.cpp:1274
void add_line_break_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
Definition: text.cpp:1147
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
Definition: text.cpp:1165
std::string resolve_string_substitution(sys::state &state, dcon::text_key source_text, substitution_map const &mp)
Definition: text.cpp:2113
layout_box open_layout_box(layout_base &dest, int32_t indent)
Definition: text.cpp:1799
void add_unparsed_text_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view sv, substitution_map const &mp)
Definition: text.cpp:1601
void localised_single_sub_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, variable_type subkey, substitution value)
Definition: text.cpp:1888
void localised_format_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, text::substitution_map const &sub)
Definition: text.cpp:1880
std::string prettify(int64_t num)
Definition: text.cpp:762
std::string format_float(float num, size_t digits)
Definition: text.cpp:981
void add_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
Definition: text.cpp:1899
void add_line_with_condition(sys::state &state, layout_base &dest, std::string_view key, bool condition_met, int32_t indent)
Definition: text.cpp:1955
void add_line_break_to_layout(sys::state &state, columnar_layout &dest)
Definition: text.cpp:1152
void add_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
Definition: text.cpp:1068
void add_divider_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
Definition: text.cpp:2098
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
Definition: text.hpp:794
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
Definition: text.cpp:617
dcon::text_key get_name(sys::state &state, dcon::nation_id id)
Definition: text.cpp:880
std::string format_percentage(float num, size_t digits)
Definition: text.cpp:977
std::string get_influence_level_name(sys::state const &state, uint8_t v)
Definition: text.cpp:958
void add_space_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
Definition: text.cpp:1788
std::string get_province_state_name(sys::state &state, dcon::province_id prov_id)
Definition: text.cpp:864
std::string prettify_currency(float num)
Definition: text.cpp:702
void close_layout_box(columnar_layout &dest, layout_box &box)
Definition: text.cpp:1807
void terrain_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void life_needs_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void colonial_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void workforce_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void modifier_description(sys::state &state, text::layout_base &layout, dcon::modifier_id mid, int32_t indentation=0)
void recruitment_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void picking_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void country_name_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
Definition: map_tooltip.cpp:43
void populate_map_tooltip(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void income_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void factory_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void diplomatic_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void employment_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void party_loyalty_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void rally_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void fort_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void ideology_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void life_rating_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void crime_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
unitamounts calc_amounts_from_army(sys::state &state, dcon::army_fat_id army)
Definition: unit_tooltip.cpp:7
void officers_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void political_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void admin_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void population_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void literacy_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void relation_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void naval_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void mobilization_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void con_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void nationalfocus_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void civilsation_level_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void issues_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void supply_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void infrastructure_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void militancy_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void revolt_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void ctc_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void nationality_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void region_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void growth_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void luxury_needs_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void rank_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void crisis_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void sphere_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void rgooutput_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void religion_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void migration_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void players_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
void active_modifiers_description(sys::state &state, text::layout_base &layout, dcon::nation_id n, int32_t identation, dcon::national_modifier_value nmid, bool header)
float selected_relative_attrition_amount(sys::state &state, dcon::nation_id n, std::vector< dcon::army_id > &list, dcon::province_id prov)
Definition: map_tooltip.cpp:8
void everyday_needs_map_tt_box(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
uint uint32_t
uchar uint8_t