Project Alice
Loading...
Searching...
No Matches
gui_unit_panel_subwindow.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <vector>
5
6namespace ui {
7
8//======================================================================================================================================
9// REORGANISATION WINDOW
10//======================================================================================================================================
11
12template<class T>
14public:
15 void on_update(sys::state& state) noexcept override {
16 auto fat = dcon::fatten(state.world, retrieve<T>(state, parent));
17 progress = fat.get_org();
18 }
19
22 }
23
24 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
25 {
26 auto box = text::open_layout_box(contents, 0);
27 text::localised_format_box(state, contents, box, std::string_view("curr_comb_org"));
28 auto fat = dcon::fatten(state.world, retrieve<T>(state, parent));
29 auto color = fat.get_org() >= 0.9f ? text::text_color::green
30 : fat.get_org() < 0.5f ? text::text_color::red
32 text::add_to_layout_box(state, contents, box, text::fp_percentage{ fat.get_org() }, color);
33 text::close_layout_box(contents, box);
34 }
35 if constexpr(std::is_same_v<T, dcon::regiment_id>) {
36 ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::land_organisation, true);
37 } else {
38 ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::naval_organisation, true);
39 }
40 }
41};
42
43template<class T>
45public:
46 void on_update(sys::state& state) noexcept override {
47 auto fat = dcon::fatten(state.world, retrieve<T>(state, parent));
48 progress = fat.get_strength();
49 }
50
53 }
54
55 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
56 {
57 auto box = text::open_layout_box(contents, 0);
58 text::localised_format_box(state, contents, box, std::string_view("curr_comb_str"));
59 auto fat = dcon::fatten(state.world, retrieve<T>(state, parent));
60 auto color = fat.get_strength() >= 0.9f ? text::text_color::green
61 : fat.get_strength() < 0.5f ? text::text_color::red
63 text::add_to_layout_box(state, contents, box, text::fp_percentage{ fat.get_strength() }, color);
64 text::close_layout_box(contents, box);
65 }
66 auto fat_id = dcon::fatten(state.world, retrieve<T>(state, parent));
67 auto o_sc_mod = std::max(0.01f, state.world.nation_get_modifier_values(state.local_player_nation, sys::national_mod_offsets::supply_consumption) + 1.0f);
68 auto& supply_cost = state.military_definitions.unit_base_definitions[fat_id.get_type()].supply_cost;
69 float total_cost = 0.f;
70 for(uint32_t i = 0; i < economy::commodity_set::set_size; ++i) {
71 if(supply_cost.commodity_type[i]) {
72 float cost = state.world.commodity_get_cost(supply_cost.commodity_type[i]);
73 float amount = supply_cost.commodity_amounts[i] * state.world.nation_get_unit_stats(state.local_player_nation, fat_id.get_type()).supply_consumption * o_sc_mod;
75 text::add_to_substitution_map(m, text::variable_type::name, state.world.commodity_get_name(supply_cost.commodity_type[i]));
79 auto box = text::open_layout_box(contents, 0);
80 text::localised_format_box(state, contents, box, "alice_spending_commodity", m);
81 text::close_layout_box(contents, box);
82 total_cost += cost * amount;
83 } else {
84 break;
85 }
86 }
89 auto box = text::open_layout_box(contents, 0);
90 text::localised_format_box(state, contents, box, "alice_spending_unit_1", m);
91 text::close_layout_box(contents, box);
92 }
93};
94
96public:
97 void on_update(sys::state& state) noexcept override {
98 auto reg_id = retrieve<dcon::regiment_id>(state, parent);
99 auto base_pop = state.world.regiment_get_pop_from_regiment_source(reg_id);
100 if(!base_pop) {
101 frame = state.world.pop_type_get_sprite(state.culture_definitions.soldiers) - 1;
102 color = sys::pack_color(255, 75, 75);
103 } else {
104 frame = state.world.pop_type_get_sprite(state.world.pop_get_poptype(base_pop)) - 1;
105 if(state.world.pop_get_size(base_pop) < state.defines.pop_min_size_for_regiment) {
106 color = sys::pack_color(220, 75, 75);
107 } else if(state.world.pop_get_size(base_pop) < state.defines.pop_size_per_regiment) {
108 color = sys::pack_color(200, 200, 0);
109 } else {
110 color = sys::pack_color(255, 255, 255);
111 }
112 }
113 }
114
117 }
118
119 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
120 auto reg_id = retrieve<dcon::regiment_id>(state, parent);
121 auto base_pop = state.world.regiment_get_pop_from_regiment_source(reg_id);
122
123 if(!base_pop) {
124 text::add_line(state, contents, "reinforce_rate_none");
125 } else {
126 // Added culture name to the tooltip
127 text::add_line(state, contents, "x_from_y", text::variable_type::x, state.world.pop_get_poptype(base_pop).get_name(), text::variable_type::y, state.world.pop_get_province_from_pop_location(base_pop), text::variable_type::culture, state.world.pop_get_culture(base_pop).get_name());
129
130 auto reg_range = state.world.pop_get_regiment_source(base_pop);
131 text::add_line(state, contents, "pop_size_unitview",
132 text::variable_type::val, text::pretty_integer{ int64_t(state.world.pop_get_size(base_pop)) },
134 text::variable_type::current, int64_t(reg_range.end() - reg_range.begin())
135 );
136
137 auto a = state.world.regiment_get_army_from_army_membership(reg_id);
138 auto reinf = state.defines.pop_size_per_regiment * military::reinforce_amount(state, a);
139 if(reinf >= 2.0f) {
140 text::add_line(state, contents, "reinforce_rate", text::variable_type::x, int64_t(reinf));
141 } else {
142 text::add_line(state, contents, "reinforce_rate_none");
143 }
144 }
145 }
146};
147
148template<class T>
150public:
151 void on_update(sys::state& state) noexcept override {
152 if(parent) {
153 Cyto::Any payload = T{};
154 parent->impl_get(state, payload);
155 T content = any_cast<T>(payload);
156 dcon::unit_type_id utid = dcon::fatten(state.world, content).get_type();
157 if(utid)
158 frame = state.military_definitions.unit_base_definitions[utid].icon - 1;
159 }
160 }
161};
162
164 close = 0,
165 balance = 1,
166};
167
168template<class T>
170public:
171 void button_action(sys::state& state) noexcept override {
172 auto content = retrieve<T>(state, parent);
173 if(content)
175
176 }
177 void button_shift_action(sys::state& state) noexcept override {
178 auto content = retrieve<T>(state, parent);
179 if constexpr(std::is_same_v<T, dcon::regiment_id>) {
180 auto army = state.world.regiment_get_army_from_army_membership(content);
181 auto type = state.world.regiment_get_type(content);
182 for(auto r : state.world.army_get_army_membership(army)) {
183 if(r.get_regiment().get_type() == type) {
184 send(state, parent, element_selection_wrapper<T>{r.get_regiment().id});
185 }
186 }
187 } else {
188 auto n = state.world.ship_get_navy_from_navy_membership(content);
189 auto type = state.world.ship_get_type(content);
190 for(auto r : state.world.navy_get_navy_membership(n)) {
191 if(r.get_ship().get_type() == type) {
192 send(state, parent, element_selection_wrapper<T>{r.get_ship().id});
193 }
194 }
195 }
196 }
197};
198
199template<class T>
201public:
202 void on_update(sys::state& state) noexcept override {
203 if(parent) {
204 Cyto::Any payload = T{};
205 parent->impl_get(state, payload);
206 T content = any_cast<T>(payload);
207 dcon::unit_type_id utid = dcon::fatten(state.world, content).get_type();
208 if(utid)
209 set_text(state, text::produce_simple_string(state, state.military_definitions.unit_base_definitions[utid].name));
210 else
211 set_text(state, "");
212 }
213 }
214};
215
217public:
218 void on_update(sys::state& state) noexcept override {
219 if(parent) {
220 Cyto::Any payload = dcon::regiment_id{};
221 parent->impl_get(state, payload);
222 dcon::regiment_id content = any_cast<dcon::regiment_id>(payload);
223 if(content)
224 set_text(state, text::format_wholenum(int32_t(state.world.regiment_get_strength(content) * state.defines.pop_size_per_regiment)));
225 else
226 set_text(state, "");
227 }
228 }
229};
231public:
232 void on_update(sys::state& state) noexcept override {
233 if(parent) {
234 Cyto::Any payload = dcon::ship_id{};
235 parent->impl_get(state, payload);
236 dcon::ship_id content = any_cast<dcon::ship_id>(payload);
237 if(content)
238 set_text(state, text::format_percentage(state.world.ship_get_strength(content), 0));
239 else
240 set_text(state, "");
241 }
242 }
243};
244
245template<class T>
247public:
248 void on_update(sys::state& state) noexcept override {
249 if(parent) {
250 Cyto::Any payload = T{};
251 parent->impl_get(state, payload);
252 T content = any_cast<T>(payload);
253 std::string str{ state.to_string_view(dcon::fatten(state.world, content).get_name()) };
254 set_text(state, str);
255 }
256 }
257};
258
259template<class T>
262
263public:
264 void on_create(sys::state& state) noexcept override {
265 listrow::base_data.position.y += 128; // Nudge
268 }
269
270 std::unique_ptr<element_base> make_child(sys::state& state, std::string_view name, dcon::gui_def_id id) noexcept override {
271 if(name == "band_reorg_regiment") {
272 return make_element_by_type<reorg_unit_transfer_button<T>>(state, id);
273
274 } else if(name == "band_reorg_naval") {
275 return make_element_by_type<reorg_unit_transfer_button<T>>(state, id);
276
277 } else if(name == "unit_icon") {
278 return make_element_by_type<subunit_details_type_icon<T>>(state, id);
279 } else if(name == "subunit_name") {
280 return make_element_by_type<subunit_details_name<T>>(state, id);
281 } else if(name == "subunit_type") {
282 return make_element_by_type<subunit_details_type_text<T>>(state, id);
283 } else if(name == "subunit_strength") {
284 return make_element_by_type<subunit_details_regiment_amount>(state, id);
285 } else if(name == "subunit_strength_naval") {
286 return make_element_by_type<subunit_details_ship_amount>(state, id);
287 } else if(name == "connected_pop") {
288 if constexpr(std::is_same_v<T, dcon::regiment_id>) {
289 return make_element_by_type<regiment_pop_icon>(state, id);
290 } else {
291 return make_element_by_type<invisible_element>(state, id);
292 }
293 } else if(name == "rebel_faction") {
294 return make_element_by_type<invisible_element>(state, id);
295 } else if(name == "org_bar") {
296 return make_element_by_type<subunit_organisation_progress_bar<T>>(state, id);
297 } else if(name == "str_bar") {
298 return make_element_by_type<subunit_strength_progress_bar<T>>(state, id);
299 } else if(name == "transferbutton") {
300 return make_element_by_type<reorg_unit_transfer_button<T>>(state, id);
301 } else {
302 return nullptr;
303 }
304 }
305};
306
307template<class T, class T2>
308class reorg_unit_listbox_left : public listbox_element_base<reorg_unit_listbox_row<T2>, T2> {
310protected:
311 std::string_view get_row_element_name() override {
312 return "reorg_entry";
313 }
314
315public:
316 void on_update(sys::state& state) noexcept override {
318 auto content = retrieve<T>(state, listbox_left::parent);
319
320 Cyto::Any vpayload = std::vector<T2>{};
322 std::vector<T2> selectedunits = any_cast<std::vector<T2>>(vpayload);
323
324 auto fat = dcon::fatten(state.world, content);
325
327
328 if constexpr(std::is_same_v<T, dcon::army_id>) {
329 for(auto regi : fat.get_army_membership()) {
330 if(auto result = std::find(begin(selectedunits), end(selectedunits), regi.get_regiment().id); result == std::end(selectedunits)) {
331 listbox_left::row_contents.push_back(regi.get_regiment().id);
332 }
333 }
334 std::sort(listbox_left::row_contents.begin(), listbox_left::row_contents.end(), [&](dcon::regiment_id a, dcon::regiment_id b) {
335 auto av = state.world.regiment_get_type(a).index();
336 auto bv = state.world.regiment_get_type(b).index();
337 if(av != bv)
338 return av > bv;
339 else
340 return a.index() < b.index();
341 });
342 } else {
343 for(auto regi : fat.get_navy_membership()) {
344 if(auto result = std::find(begin(selectedunits), end(selectedunits), regi.get_ship().id); result == std::end(selectedunits)) {
345 listbox_left::row_contents.push_back(regi.get_ship().id);
346 }
347 }
348 std::sort(listbox_left::row_contents.begin(), listbox_left::row_contents.end(), [&](dcon::ship_id a, dcon::ship_id b) {
349 auto av = state.world.ship_get_type(a).index();
350 auto bv = state.world.ship_get_type(b).index();
351 if(av != bv)
352 return av > bv;
353 else
354 return a.index() < b.index();
355 });
356 }
357
359 }
360 }
361};
362
363template<class T, class T2>
364class reorg_unit_listbox_right : public listbox_element_base<reorg_unit_listbox_row<T2>, T2> {
366protected:
367 std::string_view get_row_element_name() override {
368 return "reorg_entry_right";
369 }
370
371public:
372 void on_update(sys::state& state) noexcept override {
374 auto content = retrieve<T>(state, listbox_right::parent);
375
376 Cyto::Any vpayload = std::vector<T2>{};
378 std::vector<T2> selectedunits = any_cast<std::vector<T2>>(vpayload);
379
380 auto fat = dcon::fatten(state.world, content);
381
383
384 if constexpr(std::is_same_v<T, dcon::army_id>) {
385 for(auto regi : fat.get_army_membership()) {
386 if(auto result = std::find(begin(selectedunits), end(selectedunits), regi.get_regiment().id); result != std::end(selectedunits)) {
387 listbox_right::row_contents.push_back(regi.get_regiment().id);
388 }
389 }
390 std::sort(listbox_right::row_contents.begin(), listbox_right::row_contents.end(), [&](dcon::regiment_id a, dcon::regiment_id b) {
391 auto av = state.world.regiment_get_type(a).index();
392 auto bv = state.world.regiment_get_type(b).index();
393 if(av != bv)
394 return av > bv;
395 else
396 return a.index() < b.index();
397 });
398 } else {
399 for(auto regi : fat.get_navy_membership()) {
400 if(auto result = std::find(begin(selectedunits), end(selectedunits), regi.get_ship().id); result != std::end(selectedunits)) {
401 listbox_right::row_contents.push_back(regi.get_ship().id);
402 }
403 }
404 std::sort(listbox_right::row_contents.begin(), listbox_right::row_contents.end(), [&](dcon::ship_id a, dcon::ship_id b) {
405 auto av = state.world.ship_get_type(a).index();
406 auto bv = state.world.ship_get_type(b).index();
407 if(av != bv)
408 return av > bv;
409 else
410 return a.index() < b.index();
411 });
412 }
413
415 }
416 }
417};
418
419
421public:
422 void button_action(sys::state& state) noexcept override {
423 if(parent) {
425 parent->impl_get(state, payload);
426 }
427 }
428};
429
431public:
432 void button_action(sys::state& state) noexcept override {
433 if(parent) {
435 parent->impl_get(state, payload);
436 }
437 }
438};
439
440template<class T, class T2>
442private:
443 std::vector<T2> selectedsubunits;
444 T unitToReorg{};
445 simple_text_element_base* orginialunit_text = nullptr;
446
447public:
448 std::unique_ptr<element_base> make_child(sys::state& state, std::string_view name, dcon::gui_def_id id) noexcept override {
449 if(name == "reorg_bg") {
450 return make_element_by_type<opaque_element_base>(state, id);
451
452 } else if(name == "reorg_label") {
453 return make_element_by_type<simple_text_element_base>(state, id);
454
455 } else if(name == "unitname_1") {
456 auto ptr = make_element_by_type<simple_text_element_base>(state, id);
457 orginialunit_text = ptr.get();
458 return ptr;
459
460 } else if(name == "unitname_2") {
461 return make_element_by_type<simple_text_element_base>(state, id);
462
463 } else if(name == "cell_window_left" || name == "cell_window_right") {
464 return make_element_by_type<invisible_element>(state, id);
465
466 } else if(name == "balancebutton") {
467 return make_element_by_type<unit_reorg_balance_button>(state, id);
468
469 } else if(name == "closebutton") {
470 return make_element_by_type<reorg_win_close_button>(state, id);
471
472 } else if(name == "left_list") {
473 if constexpr(std::is_same_v<T, dcon::army_id>) {
474 auto ptr = make_element_by_type<reorg_unit_listbox_left<T, T2>>(state, id);
475 //ptr->base_data.position.x += 255; // Nudge
476 //ptr->list_scrollbar->base_data.position.x += 256;
477 ptr->base_data.size.x += 256;
478 return ptr;
479 } else {
480 auto ptr = make_element_by_type<reorg_unit_listbox_left<T, T2>>(state, id);
481 //ptr->base_data.position.x += 255; // Nudge
482 //ptr->list_scrollbar->base_data.position.x += 256;
483 ptr->base_data.size.x += 256;
484 return ptr;
485 }
486
487 } else if(name == "right_list") {
488 if constexpr(std::is_same_v<T, dcon::army_id>) {
489 auto ptr = make_element_by_type<reorg_unit_listbox_right<T, T2>>(state, id);
490 //ptr->base_data.position.x += 255; // Nudge
491 //ptr->list_scrollbar->base_data.position.x += 256;
492 ptr->base_data.size.x += 256;
493 return ptr;
494 } else {
495 auto ptr = make_element_by_type<reorg_unit_listbox_right<T, T2>>(state, id);
496 //ptr->base_data.position.x += 255; // Nudge
497 //ptr->list_scrollbar->base_data.position.x += 256;
498 ptr->base_data.size.x += 256;
499 return ptr;
500 }
501
502 } else if(name == "external_scroll_slider_left" || name == "external_scroll_slider_right") {
503 return make_element_by_type<invisible_element>(state, id);
504
505 } else {
506 return nullptr;
507 }
508 }
509
510 void on_update(sys::state& state) noexcept override {
511 unitToReorg = retrieve<T>(state, parent);
512 auto fat = dcon::fatten(state.world, unitToReorg);
513 orginialunit_text->set_text(state, std::string(state.to_string_view(fat.get_name())));
514 }
515
516 void on_visible(sys::state& state) noexcept override {
517 selectedsubunits.clear();
518 }
519 void on_hide(sys::state& state) noexcept override {
520 selectedsubunits.clear();
521 }
522
523 message_result get(sys::state& state, Cyto::Any& payload) noexcept override {
524 if(payload.holds_type<element_selection_wrapper<T>>()) {
525 unitToReorg = any_cast<element_selection_wrapper<T>>(payload).data;
527 } else if(payload.holds_type<T>()) {
528 payload.emplace<T>(unitToReorg);
530 } else if(payload.holds_type<element_selection_wrapper<T2>>()) {
531 auto content = any_cast<element_selection_wrapper<T2>>(payload).data;
532 if(!selectedsubunits.empty()) {
533 if(auto result = std::find(selectedsubunits.begin(), selectedsubunits.end(), content); result != selectedsubunits.end()) {
534 selectedsubunits.erase(result);
535 } else {
536 selectedsubunits.push_back(content);
537 }
538 } else {
539 selectedsubunits.push_back(content);
540 }
543 } else if(payload.holds_type<std::vector<T2>>()) {
544 payload.emplace<std::vector<T2>>(selectedsubunits);
546 } else if(payload.holds_type<element_selection_wrapper<reorg_win_action>>()) {
547 auto content = any_cast<element_selection_wrapper<reorg_win_action>>(payload).data;
548 switch(content) {
550 if(selectedsubunits.size() <= command::num_packed_units && !selectedsubunits.empty()) {
551 if constexpr(std::is_same_v<T2, dcon::regiment_id>) {
552 std::array<dcon::regiment_id, command::num_packed_units> tosplit{};
553 for(size_t i = 0; i < selectedsubunits.size(); i++) {
554 tosplit[i] = selectedsubunits[i];
555 }
556 command::mark_regiments_to_split(state, state.local_player_nation, tosplit);
557 command::split_army(state, state.local_player_nation, unitToReorg);
558 } else {
559 std::array<dcon::ship_id, command::num_packed_units> tosplit{};
560 for(size_t i = 0; i < selectedsubunits.size(); i++) {
561 tosplit[i] = selectedsubunits[i];
562 }
563 command::mark_ships_to_split( state, state.local_player_nation, tosplit);
564 command::split_navy(state, state.local_player_nation, unitToReorg);
565 }
566 } else if(selectedsubunits.size() > command::num_packed_units){
567 if constexpr(std::is_same_v<T2, dcon::regiment_id>) {
568 std::array<dcon::regiment_id, command::num_packed_units> tosplit{};
569 //while(selectedsubunits.size() > command::num_packed_units) {
570 while(selectedsubunits.size() > 0) {
571 tosplit.fill(dcon::regiment_id{});
572 for(size_t i = 0; i < command::num_packed_units && i < selectedsubunits.size(); i++) {
573 tosplit[i] = selectedsubunits[i];
574 }
575 command::mark_regiments_to_split(state, state.local_player_nation, tosplit);
576 (selectedsubunits.size() > command::num_packed_units) ? selectedsubunits.erase(selectedsubunits.begin(), selectedsubunits.begin() + command::num_packed_units)
577 : selectedsubunits.erase(selectedsubunits.begin(), selectedsubunits.end());
578 }
579 command::split_army(state, state.local_player_nation, unitToReorg);
580 } else {
581 std::array<dcon::ship_id, command::num_packed_units> tosplit{};
582 //while(selectedsubunits.size() > command::num_packed_units) {
583 while(selectedsubunits.size() > 0) {
584 tosplit.fill(dcon::ship_id{});
585 for(size_t i = 0; i < command::num_packed_units && i < selectedsubunits.size(); i++) {
586 tosplit[i] = selectedsubunits[i];
587 }
588 command::mark_ships_to_split(state, state.local_player_nation, tosplit);
589 (selectedsubunits.size() > command::num_packed_units) ? selectedsubunits.erase(selectedsubunits.begin(), selectedsubunits.begin() + command::num_packed_units)
590 : selectedsubunits.erase(selectedsubunits.begin(), selectedsubunits.end());
591 }
592 command::split_navy(state, state.local_player_nation, unitToReorg);
593 }
594 }
595 if(selectedsubunits.empty()) { selectedsubunits.erase(selectedsubunits.begin(), selectedsubunits.end()); }
596 set_visible(state, false);
597 break;
599 // Disregard any of the units the player already selected, because its our way or the hi(fi)-way
600 selectedsubunits.erase(selectedsubunits.begin(), selectedsubunits.end());
601 if constexpr(std::is_same_v<T, dcon::army_id>) {
602 for(auto reg : dcon::fatten(state.world, unitToReorg).get_army_membership()) {
603 selectedsubunits.push_back(reg.get_regiment().id);
604 }
605 } else {
606 for(auto reg : dcon::fatten(state.world, unitToReorg).get_navy_membership()) {
607 selectedsubunits.push_back(reg.get_ship().id);
608 }
609 }
610 std::sort(selectedsubunits.begin(), selectedsubunits.end(), [&](auto a, auto b){return dcon::fatten(state.world,a).get_type().value > dcon::fatten(state.world,b).get_type().value;});
611 //for(size_t i = selectedsubunits.size(); i > 0; i--) {
612 for(size_t i = selectedsubunits.size(); i-->0;) {
613 if((i % 2) == 0) {
614 selectedsubunits.erase(selectedsubunits.begin() + i);
615 }
616 }
618 break;
619 default:
620 break;
621 }
623 }
625 }
626};
627
628} // namespace ui
dcon::text_key get_name() noexcept
void impl_on_update(sys::state &state) noexcept override
element_base * parent
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
message_result impl_get(sys::state &state, Cyto::Any &payload) noexcept
virtual void on_create(sys::state &state) noexcept
element_data base_data
void set_visible(sys::state &state, bool vis)
void on_update(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void on_update(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void on_create(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void button_shift_action(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_visible(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void on_update(sys::state &state) noexcept override
void on_hide(sys::state &state) noexcept override
void mark_ships_to_split(sys::state &state, dcon::nation_id source, std::array< dcon::ship_id, num_packed_units > const &list)
Definition: commands.cpp:4182
constexpr size_t num_packed_units
Definition: commands.hpp:405
void mark_regiments_to_split(sys::state &state, dcon::nation_id source, std::array< dcon::regiment_id, num_packed_units > const &list)
Definition: commands.cpp:4161
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
float reinforce_amount(sys::state &state, dcon::army_id a)
Definition: military.cpp:6928
int32_t regiments_possible_from_pop(sys::state &state, dcon::pop_id p)
Definition: military.cpp:675
uint32_t pack_color(float r, float g, float b)
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_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
Definition: text.cpp:1899
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
std::string format_wholenum(int32_t num)
Definition: text.cpp:1033
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
std::string format_percentage(float num, size_t digits)
Definition: text.cpp:977
void close_layout_box(columnar_layout &dest, layout_box &box)
Definition: text.cpp:1807
tooltip_behavior
void send(sys::state &state, element_base *parent, T value)
message_result
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)
uint uint32_t
uchar uint8_t
static constexpr uint32_t set_size