Project Alice
Loading...
Searching...
No Matches
gui_leader_tooltip.cpp
Go to the documentation of this file.
2
3namespace ui {
4void display_leader_attributes(sys::state& state, dcon::leader_id lid, text::layout_base& contents, int32_t indent) {
5 auto leader_per = state.world.leader_get_personality(lid);
6 auto leader_bak = state.world.leader_get_background(lid);
7 auto attack = state.world.leader_trait_get_attack(leader_per) + state.world.leader_trait_get_attack(leader_bak);
8 auto organisation = state.world.leader_trait_get_organisation(leader_per) + state.world.leader_trait_get_organisation(leader_bak);
9 auto morale = state.world.leader_trait_get_morale(leader_per) + state.world.leader_trait_get_morale(leader_bak);
10 auto defense = state.world.leader_trait_get_defense(leader_per) + state.world.leader_trait_get_defense(leader_bak);
11 auto reconnaissance = state.world.leader_trait_get_reconnaissance(leader_per) + state.world.leader_trait_get_reconnaissance(leader_bak);
12 auto speed = state.world.leader_trait_get_speed(leader_per) + state.world.leader_trait_get_speed(leader_bak);
13 auto experience = state.world.leader_trait_get_experience(leader_per) + state.world.leader_trait_get_experience(leader_bak);
14 auto reliability = state.world.leader_trait_get_reliability(leader_per) + state.world.leader_trait_get_reliability(leader_bak);
15
16 if(attack != 0) {
17 auto box = text::open_layout_box(contents, indent);
18 text::localised_format_box(state, contents, box, "trait_attack");
20 if(attack > 0) {
21 text::add_to_layout_box(state, contents, box, std::string_view("+"), text::text_color::green);
23 } else {
25 }
26 text::close_layout_box(contents, box);
27 }
28 if(defense != 0) {
29 auto box = text::open_layout_box(contents, indent);
30 text::localised_format_box(state, contents, box, "trait_defend");
32 if(defense > 0) {
33 text::add_to_layout_box(state, contents, box, std::string_view("+"), text::text_color::green);
35 } else {
37 }
38 text::close_layout_box(contents, box);
39 }
40 if(morale != 0) {
41 auto box = text::open_layout_box(contents, indent);
42 text::localised_format_box(state, contents, box, "trait_morale");
44 if(morale > 0) {
45 text::add_to_layout_box(state, contents, box, std::string_view("+"), text::text_color::green);
47 } else {
49 }
50 text::close_layout_box(contents, box);
51 }
52 if(organisation != 0) {
53 auto box = text::open_layout_box(contents, indent);
54 text::localised_format_box(state, contents, box, "trait_organisation");
56 if(organisation > 0) {
57 text::add_to_layout_box(state, contents, box, std::string_view("+"), text::text_color::green);
59 } else {
61 }
62 text::close_layout_box(contents, box);
63 }
64 if(reconnaissance != 0) {
65 auto box = text::open_layout_box(contents, indent);
66 text::localised_format_box(state, contents, box, "trait_reconaissance");
68 if(reconnaissance > 0) {
69 text::add_to_layout_box(state, contents, box, std::string_view("+"), text::text_color::green);
71 } else {
73 }
74 text::close_layout_box(contents, box);
75 }
76 if(speed != 0) {
77 auto box = text::open_layout_box(contents, indent);
78 text::localised_format_box(state, contents, box, "trait_speed");
80 if(speed > 0) {
81 text::add_to_layout_box(state, contents, box, std::string_view("+"), text::text_color::green);
83 } else {
85 }
86 text::close_layout_box(contents, box);
87 }
88 if(experience != 0) {
89 auto box = text::open_layout_box(contents, indent);
90 text::localised_format_box(state, contents, box, "trait_experience");
92 if(experience > 0) {
93 text::add_to_layout_box(state, contents, box, std::string_view("+"), text::text_color::green);
95 } else {
97 }
98 text::close_layout_box(contents, box);
99 }
100 if(reliability != 0) {
101 auto box = text::open_layout_box(contents, indent);
102 text::localised_format_box(state, contents, box, "trait_reliability");
103 text::add_space_to_layout_box(state, contents, box);
104 if(reliability > 0) {
105 text::add_to_layout_box(state, contents, box, std::string_view("+"), text::text_color::green);
107 } else {
109 }
110 text::close_layout_box(contents, box);
111 }
112}
113
114void display_leader_full(sys::state& state, dcon::leader_id lid, text::layout_base& contents, int32_t indent) {
115 auto lname = state.world.leader_get_name(lid);
116 auto resolved = state.to_string_view(lname);
117
118 auto box = text::open_layout_box(contents, indent);
119 text::add_to_layout_box(state, contents, box, resolved);
120 text::close_layout_box(contents, box);
121
122 display_leader_attributes(state, lid, contents, indent + 15);
123}
124} // namespace ui
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
Definition: text.cpp:1165
layout_box open_layout_box(layout_base &dest, int32_t indent)
Definition: text.cpp:1799
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
void add_space_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
Definition: text.cpp:1788
void close_layout_box(columnar_layout &dest, layout_box &box)
Definition: text.cpp:1807
void display_leader_attributes(sys::state &state, dcon::leader_id lid, text::layout_base &contents, int32_t indent)
void display_leader_full(sys::state &state, dcon::leader_id lid, text::layout_base &contents, int32_t indent)