Project Alice
Loading...
Searching...
No Matches
game_scene.cpp
Go to the documentation of this file.
2#include "gui_unit_panel.hpp"
4#include "gui_land_combat.hpp"
5#include "gui_console.hpp"
6#include "gui_chat_window.hpp"
7#include "gui_event.hpp"
8#include "gui_map_icons.hpp"
9#include "simple_fs.hpp"
10
11namespace game_scene {
12
14 /*
15 if (state.ui_state.end_screen)
16 state.ui_state.end_screen->set_visible(state, false);
17 if(state.ui_state.nation_picker)
18 state.ui_state.nation_picker->set_visible(state, false);
19 if(state.ui_state.root)
20 state.ui_state.root->set_visible(state, false);
21 if(state.ui_state.select_states_legend)
22 state.ui_state.select_states_legend->set_visible(state, false);
23 if(state.ui_state.military_root)
24 state.ui_state.military_root->set_visible(state, false);
25
26 state.get_root_element()->set_visible(state, true);
27 */
28
29 switch(ui_scene) {
31 state.current_scene = state_wargoal_selector();
32
33 state.stored_map_mode = state.map_state.active_map_mode;
35 state.map_state.set_selected_province(dcon::province_id{});
36
37 return;
38
40 if(state.current_scene.id == scene_id::in_game_state_selector) {
41 state.state_selection.reset();
42 map_mode::set_map_mode(state, state.stored_map_mode);
43 }
44
45 state.current_scene = basic_game();
46
47 return;
48
50 state.current_scene = economy_viewer_scene();
51
52 return;
53
55 state.current_scene = battleplan_editor();
56
57 return;
58
60 state.current_scene = end_screen();
61
62 return;
63
65 state.current_scene = nation_picker();
66
67 return;
68
70 state.current_scene = battleplan_editor_add_army();
71
72 return;
73 case scene_id::count: // this should never happen
74 assert(false);
75 return;
76 }
77
78 state.game_state_updated.store(true, std::memory_order_release);
79}
80
82 dcon::nation_id nation,
83 dcon::province_id target,
84 sys::key_modifiers mod) { }
86void do_nothing_screen(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mod) { }
87
89 while(checked_element != nullptr) {
90 if(checked_element == state.ui_state.units_root.get())
91 return true;
92 if(checked_element == state.ui_state.unit_details_box.get())
93 return true;
94 checked_element = checked_element->parent;
95 }
96 return false;
97}
98
100 auto current_view = map::map_view::globe;
101 if(state.user_settings.map_is_globe == sys::projection_mode::flat) {
102 current_view = map::map_view::flat;
103 } else if(state.user_settings.map_is_globe == sys::projection_mode::globe_perpect) {
104 current_view = map::map_view::globe_perspect;
105 }
106
107 return current_view;
108}
109
111 return state.user_settings.effects_volume * state.user_settings.master_volume;
112}
113
116 dcon::nation_id nation,
117 dcon::province_id target,
119) {
120 bool fail = false;
121 bool army_play = false;
122 //as opposed to queueing
123 bool reset_orders = (uint8_t(mod) & uint8_t(sys::key_modifiers::modifiers_shift)) == 0;
124 float volume = get_effects_volume(state);
125
126 for(auto a : state.selected_armies) {
127 if(command::can_move_army(state, nation, a, target).empty()) {
128 fail = true;
129 } else {
130 command::move_army(state, nation, a, target, reset_orders);
131 army_play = true;
132 }
133 }
134 for(auto a : state.selected_navies) {
135 if(command::can_move_navy(state, nation, a, target).empty()) {
136 fail = true;
137 } else {
138 command::move_navy(state, nation, a, target, reset_orders);
139 }
140 }
141
142 if(!fail) {
143 if(army_play) {
145 } else {
147 }
148 } else {
150 }
151}
152
155 dcon::nation_id nation,
156 dcon::province_id target,
158) {
159 auto owner = state.world.province_get_nation_from_province_ownership(target);
160 if(owner) {
161 state.open_diplomacy(owner);
162 } else {
163 state.open_diplomacy(nation);
164 }
165}
166
168 auto owner = state.world.province_get_nation_from_province_ownership(state.map_state.selected_province);
169 if(owner) {
170 // On single player we simply set the local player nation
171 // on multiplayer we wait until we get a confirmation that we are
172 // allowed to pick the specified nation as no two players can get on
173 // a nation, at the moment
174 // TODO: Allow Co-op
175 if(state.network_mode == sys::network_mode_type::single_player) {
176 state.world.nation_set_is_player_controlled(state.local_player_nation, false);
177 state.local_player_nation = owner;
178 state.world.nation_set_is_player_controlled(state.local_player_nation, true);
179 if(state.ui_state.nation_picker) {
180 state.ui_state.nation_picker->impl_on_update(state);
181 }
182 } else if(command::can_notify_player_picks_nation(state, state.local_player_nation, owner)) {
183 command::notify_player_picks_nation(state, state.local_player_nation, owner);
184 }
185 }
186}
187
189 auto prov = state.map_state.selected_province;
190 auto sdef = state.world.province_get_state_from_abstract_state_membership(prov);
191 state.state_select(sdef);
192}
193
195 if(state.ui_state.province_window) {
196 static_cast<ui::province_view_window*>(state.ui_state.province_window)->set_active_province(state, state.map_state.selected_province);
197 }
198}
199
200void start_dragging(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mod) {
201 state.x_drag_start = x;
202 state.y_drag_start = y;
203 state.drag_selecting = true;
205}
206
207void stop_dragging(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mod) {
208 state.is_dragging = false;
209 if(state.ui_state.drag_target) {
210 state.on_drag_finished(x, y, mod);
211 }
212}
213
215 state.map_state.render(state, state.x_size, state.y_size);
216}
217
219 state.ui_state.under_mouse->impl_on_rbutton_down(
220 state,
221 state.ui_state.relative_mouse_location.x,
222 state.ui_state.relative_mouse_location.y,
223 mod
224 );
225}
227 state.ui_state.under_mouse->impl_on_lbutton_down(
228 state,
229 state.ui_state.relative_mouse_location.x,
230 state.ui_state.relative_mouse_location.y,
231 mod
232 );
233 state.ui_state.left_mouse_hold_target = state.ui_state.under_mouse;
234}
235
236void on_rbutton_down_map(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mod) {
237 state.map_state.on_rbutton_down(state, x, y, state.x_size, state.y_size, mod);
238}
239
240void on_lbutton_down_map(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mod) {
241 state.map_state.on_lbutton_down(state, x, y, state.x_size, state.y_size, mod);
242}
243
244void on_lbutton_up_map(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mod) {
245 state.map_state.on_lbutton_up(state, x, y, state.x_size, state.y_size, mod);
246}
247
249 auto current_view = get_view(state);
250 auto mouse_pos = glm::vec2(x, y);
251 auto screen_size = glm::vec2(state.x_size, state.y_size);
252 glm::vec2 map_pos;
253 if(!state.map_state.screen_to_map(mouse_pos, screen_size, current_view, map_pos)) {
254 return;
255 }
256 map_pos *= glm::vec2(float(state.map_state.map_data.size_x), float(state.map_state.map_data.size_y));
257 auto idx = int32_t(state.map_state.map_data.size_y - map_pos.y) * int32_t(state.map_state.map_data.size_x) + int32_t(map_pos.x);
258
259 if(0 <= idx && size_t(idx) < state.map_state.map_data.province_id_map.size()) {
261 auto id = province::from_map_id(state.map_state.map_data.province_id_map[idx]);
262
263 if(state.selected_armies.size() > 0 || state.selected_navies.size() > 0) {
264 state.current_scene.rbutton_selected_units(state, state.local_player_nation, id, mod);
265 } else {
266 state.current_scene.rbutton_province(state, state.local_player_nation, id, mod);
267 }
268 }
269
270 on_rbutton_down_map(state, x, y, mod);
271}
272
274 on_lbutton_down_map(state, x, y, mod);
275 state.current_scene.on_drag_start(state, x, y, mod);
276}
277
278void on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mod) {
279 // Lose focus on text
280 state.ui_state.edit_target = nullptr;
281
282 if(state.iui_state.over_ui) {
283 return;
284 }
285
286 bool under_mouse_belongs_on_map = belongs_on_map(state, state.ui_state.under_mouse);
287
288 //if we clicked on UI element, handle it
289 if(state.ui_state.under_mouse != nullptr && !under_mouse_belongs_on_map) {
290 ui_rbutton(state, mod);
291 return;
292 }
293 // otherwise, we clicked on the map and need to handle map clicking logic;
295}
296
297void on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mod) {
298 // Lose focus on text
299 state.ui_state.edit_target = nullptr;
300
301 if(state.iui_state.over_ui) {
302 return;
303 }
304
305 if(state.ui_state.under_mouse != nullptr) {
306 ui_lbutton(state, mod);
307 return;
308 }
309
311}
312
314 auto rel_x = state.ui_state.relative_mouse_location.x;
315 auto rel_y = state.ui_state.relative_mouse_location.y;
316
317 bool mouse_over_target = state.ui_state.under_mouse == state.ui_state.left_mouse_hold_target;
318
319 if(!state.current_scene.allow_drag_selection) {
320 if(mouse_over_target) {
321 state.ui_state.under_mouse->impl_on_lbutton_up(state, rel_x, rel_y, mod, true);
322 } else {
323 state.ui_state.left_mouse_hold_target->impl_on_lbutton_up(state, rel_x, rel_y, mod, false);
324 }
325 } else {
326 if(mouse_over_target) {
327 state.ui_state.left_mouse_hold_target = nullptr;
328 state.ui_state.under_mouse->impl_on_lbutton_up(state, rel_x, rel_y, mod, true);
329 } else if(!mouse_over_target && !state.drag_selecting) {
330 state.ui_state.left_mouse_hold_target->impl_on_lbutton_up(state, rel_x, rel_y, mod, false);
331 ui::element_base* temp_hold_target = state.ui_state.left_mouse_hold_target;
332 state.ui_state.left_mouse_hold_target = nullptr;
333 if(state.ui_state.scrollbar_continuous_movement) {
335 temp_hold_target->impl_set(state, payload);
336 state.ui_state.scrollbar_continuous_movement = false;
337 }
338 }
339 }
340}
341
343 state.selected_armies.clear();
344 state.selected_navies.clear();
345}
346
347bool province_mid_point_is_in_selection(sys::state& state, int32_t x, int32_t y, dcon::province_id province) {
348 auto mid_point = state.world.province_get_mid_point(province);
349 auto map_pos = state.map_state.normalize_map_coord(mid_point);
350 auto screen_size = glm::vec2{ float(state.x_size), float(state.y_size) };
351 glm::vec2 screen_pos;
352 if(state.map_state.map_to_screen(state, map_pos, screen_size, screen_pos)) {
353 if(state.x_drag_start <= int32_t(screen_pos.x) && int32_t(screen_pos.x) <= x
354 && state.y_drag_start <= int32_t(screen_pos.y) && int32_t(screen_pos.y) <= y) {
355 return true;
356 }
357 }
358 return false;
359}
360
361bool province_port_is_in_selection(sys::state& state, int32_t x, int32_t y, dcon::province_id province) {
362 auto port_to = state.world.province_get_port_to(province);
363 auto adj = state.world.get_province_adjacency_by_province_pair(province, port_to);
364 if(adj) {
365 auto id = adj.index();
366 auto& border = state.map_state.map_data.borders[id];
367 auto& vertex = state.map_state.map_data.border_vertices[border.start_index + border.count / 2];
368
369 auto map_x = vertex.position.x;
370 auto map_y = vertex.position.y;
371
372 glm::vec2 map_pos(map_x, 1.0f - map_y);
373 auto screen_size = glm::vec2{ float(state.x_size), float(state.y_size) };
374 glm::vec2 screen_pos;
375 if(state.map_state.map_to_screen(state, map_pos, screen_size, screen_pos)) {
376 if(state.x_drag_start <= int32_t(screen_pos.x)
377 && int32_t(screen_pos.x) <= x
378 && state.y_drag_start <= int32_t(screen_pos.y)
379 && int32_t(screen_pos.y) <= y
380 ) {
381 return true;
382 }
383 }
384 }
385 return false;
386}
387
388bool army_is_in_selection(sys::state& state, int32_t x, int32_t y, dcon::army_id a) {
389 auto province = state.world.army_get_location_from_army_location(a);
391}
392
393bool navy_is_in_selection(sys::state& state, int32_t x, int32_t y, dcon::navy_id n) {
394 auto loc = state.world.navy_get_location_from_navy_location(n);
395 if(loc.index() >= state.province_definitions.first_sea_province.index()) {
397 return true;
398 }
399 } else {
400 if(province_port_is_in_selection(state, x, y, loc)) {
401 return true;
402 }
403 }
404 return false;
405}
406
407void select_units(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mod) {
408 if((int32_t(sys::key_modifiers::modifiers_shift) & int32_t(mod)) == 0) {
410 }
411 if((int32_t(sys::key_modifiers::modifiers_ctrl) & int32_t(mod)) == 0) {
412 for(auto a : state.world.nation_get_army_control(state.local_player_nation)) {
413 if(!a.get_army().get_navy_from_army_transport() && !a.get_army().get_battle_from_army_battle_participation() && !a.get_army().get_is_retreating()) {
414 if(army_is_in_selection(state, x, y, a.get_army())) {
415 state.select(a.get_army());
416 }
417 }
418 }
419 }
420 for(auto a : state.world.nation_get_navy_control(state.local_player_nation)) {
421 if(!a.get_navy().get_battle_from_navy_battle_participation() && !a.get_navy().get_is_retreating()) {
422 if(navy_is_in_selection(state, x, y, a.get_navy())) {
423 state.select(a.get_navy());
424 }
425 }
426 }
427 if(!state.selected_armies.empty() && !state.selected_navies.empty()) {
428 state.selected_navies.clear();
429 }
430 // Hide province upon selecting multiple armies / navies :)
431 if(!state.selected_armies.empty() || !state.selected_navies.empty()) {
432 if(state.ui_state.province_window) {
433 state.ui_state.province_window->set_visible(state, false);
434 state.map_state.set_selected_province(dcon::province_id{}); //ensure we deselect from map too
435 }
436 // Play selection sound effect
437 if(!state.selected_armies.empty()) {
439 } else {
441 }
442 }
443 state.game_state_updated.store(true, std::memory_order_release);
444}
445
446void handle_drag_stop(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mod) {
447 bool insignificant_movement =
448 std::abs(x - state.x_drag_start) <= int32_t(std::ceil(state.x_size * 0.0025))
449 && std::abs(y - state.y_drag_start) <= int32_t(std::ceil(state.x_size * 0.0025));
450
451 state.ui_state.scrollbar_timer = 0;
452 if(state.ui_state.under_mouse != nullptr || !state.drag_selecting) {
453 state.drag_selecting = false;
455 } else if(insignificant_movement) {
456 // we assume that user wanted to click
457 state.drag_selecting = false;
461 state.game_state_updated.store(true, std::memory_order_release);
462 } else {
463 // stop dragging and select units
464 state.drag_selecting = false;
466 if(x < state.x_drag_start)
467 std::swap(x, state.x_drag_start);
468 if(y < state.y_drag_start)
469 std::swap(y, state.y_drag_start);
470
471 state.current_scene.drag_selection(state, x, y, mod);
472 }
473}
474
475void on_lbutton_up(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mod) {
476 stop_dragging(state, x, y, mod);
477 if(state.user_settings.left_mouse_click_hold_and_release && state.ui_state.left_mouse_hold_target) {
479 }
480
481 on_lbutton_up_map(state, x, y, mod);
482
483 if(!state.ui_state.under_mouse && !state.iui_state.over_ui) {
484 state.current_scene.lbutton_up(state);
485 }
486
487 // if we were holding some "button" and this scene doesn't allow drag selection, then we can safely return
488 if(state.user_settings.left_mouse_click_hold_and_release
489 && state.ui_state.left_mouse_hold_target
490 && !state.current_scene.allow_drag_selection
491 ) {
492 return;
493 }
494
495 state.ui_state.scrollbar_timer = 0;
496 handle_drag_stop(state, x, y, mod);
497}
498
500 //Emulating autohotkey
501 if(!state.ui_state.edit_target && state.user_settings.wasd_for_map_movement) {
502 if(keycode == sys::virtual_key::W)
504 else if(keycode == sys::virtual_key::A)
506 else if(keycode == sys::virtual_key::S)
508 else if(keycode == sys::virtual_key::D)
510 }
511 return keycode;
512}
513
515 return keycode;
516}
517
519 if(keycode == sys::virtual_key::MINUS)
521 else if(keycode == sys::virtual_key::PLUS)
523
524 return state.current_scene.keycode_mapping(state, keycode, mod);
525}
526
527
529 if(state.ui_state.nation_picker->impl_on_key_down(state, keycode, mod) != ui::message_result::consumed) {
530 if(keycode == sys::virtual_key::ESCAPE) {
532 } else if(keycode == sys::virtual_key::TAB) {
534 }
535 state.map_state.on_key_down(keycode, mod);
536 }
537}
538
540 if(state.ui_state.select_states_legend->impl_on_key_down(state, keycode, mod) != ui::message_result::consumed) {
541 state.map_state.on_key_down(keycode, mod);
542 if(keycode == sys::virtual_key::ESCAPE) {
543 state.state_selection->on_cancel(state);
545 state.ui_state.root->impl_on_update(state);
546 }
547 }
548}
549
551 auto selected_group = state.selected_army_group;
552 auto selected_province = state.map_state.selected_province;
553
554 switch(state.selected_army_group_order) {
556 return;
558 state.toggle_designated_port(selected_group, selected_province);
559 return;
561 state.toggle_enforce_control_position(selected_group, selected_province);
562 return;
564 state.toggle_defensive_position(selected_group, selected_province);
565 return;
566 default:
567 break;
568 }
569}
570
572 auto selected_group = state.selected_army_group;
573 auto selected_province = state.map_state.selected_province;
574
575 if(state.ui_state.root->impl_on_key_down(state, keycode, mod) != ui::message_result::consumed) {
576 if(keycode == sys::virtual_key::ESCAPE) {
577 if(state.selected_army_group_order != sys::army_group_order::none) {
578 state.selected_army_group_order = sys::army_group_order::none;
579 } else {
580 if(!selected_group) {
582 } else {
583 state.deselect_army_group();
584 }
585 }
586 }
587 } if(state.map_state.selected_province) {
588 if(keycode == sys::virtual_key::Z) {
589 //create HQ
590 if(!selected_group) {
591 state.new_army_group(state.map_state.selected_province);
592 }
593 } else if(selected_group) {
594 if(keycode == sys::virtual_key::X) {
595 state.toggle_designated_port(selected_group, selected_province);
596 } else if(keycode == sys::virtual_key::V) {
597 state.toggle_defensive_position(selected_group, selected_province);
598 } else if(keycode == sys::virtual_key::N) {
600 }
601 }
602 }
603}
604
606 if(state.ui_state.select_states_legend->impl_on_key_down(state, keycode, mod) != ui::message_result::consumed) {
607 state.map_state.on_key_down(keycode, mod);
608 if(keycode == sys::virtual_key::ESCAPE) {
609 state.iui_state.over_ui = false;
611 state.ui_state.root->impl_on_update(state);
612 }
613 }
614}
615
617 if(state.ui_state.console_window->is_visible()) {
619 } else if(!state.selected_armies.empty() || !state.selected_navies.empty()) {
621 state.game_state_updated.store(true, std::memory_order::release);
622 } else {
624 }
625}
626
627void center_on_capital(sys::state& state, dcon::nation_id nation) {
628 if(auto cap = state.world.nation_get_capital(nation); cap) {
629 if(state.map_state.get_zoom() < map::zoom_very_close)
630 state.map_state.zoom = map::zoom_very_close;
631 state.map_state.center_map_on_province(state, cap);
632 }
633}
634
636 if(state.ui_state.root->impl_on_key_down(state, keycode, mod) != ui::message_result::consumed) {
637 uint32_t ctrl_group = 0;
638 if(keycode == sys::virtual_key::ESCAPE) {
639 handle_escape_basic(state, keycode, mod);
640 } else if(keycode == sys::virtual_key::TILDA || keycode == sys::virtual_key::BACK_SLASH) {
642 } else if(keycode == sys::virtual_key::HOME) {
643 center_on_capital(state, state.local_player_nation);
644 } else if(keycode == sys::virtual_key::TAB) {
646 } else if(keycode == sys::virtual_key::Z && state.ui_state.ctrl_held_down) {
648 } else if(keycode == sys::virtual_key::N && state.ui_state.ctrl_held_down) {
650 } else if(keycode == sys::virtual_key::NUMPAD1 || keycode == sys::virtual_key::NUM_1) {
651 ctrl_group = 1;
652 } else if(keycode == sys::virtual_key::NUMPAD2 || keycode == sys::virtual_key::NUM_2) {
653 ctrl_group = 2;
654 } else if(keycode == sys::virtual_key::NUMPAD3 || keycode == sys::virtual_key::NUM_3) {
655 ctrl_group = 3;
656 } else if(keycode == sys::virtual_key::NUMPAD4 || keycode == sys::virtual_key::NUM_4) {
657 ctrl_group = 4;
658 } else if(keycode == sys::virtual_key::NUMPAD5 || keycode == sys::virtual_key::NUM_5) {
659 ctrl_group = 5;
660 } else if(keycode == sys::virtual_key::NUMPAD6 || keycode == sys::virtual_key::NUM_6) {
661 ctrl_group = 6;
662 } else if(keycode == sys::virtual_key::NUMPAD7 || keycode == sys::virtual_key::NUM_7) {
663 ctrl_group = 7;
664 } else if(keycode == sys::virtual_key::NUMPAD8 || keycode == sys::virtual_key::NUM_8) {
665 ctrl_group = 8;
666 } else if(keycode == sys::virtual_key::NUMPAD9 || keycode == sys::virtual_key::NUM_9) {
667 ctrl_group = 9;
668 }
669 if(ctrl_group != 0) {
671 for(const auto a : state.selected_armies) {
672 auto& v = state.ctrl_armies[ctrl_group];
673 auto it = std::find(v.begin(), v.end(), a);
674 if(it != v.end()) {
675 *it = v.back();
676 v.pop_back();
677 } else {
678 v.push_back(a);
679 }
680 }
681 for(const auto n : state.selected_navies) {
682 auto& v = state.ctrl_navies[ctrl_group];
683 auto it = std::find(v.begin(), v.end(), n);
684 if(it != v.end()) {
685 *it = v.back();
686 v.pop_back();
687 } else {
688 v.push_back(n);
689 }
690 }
691 state.game_state_updated.store(true, std::memory_order_release);
692 } else { //shift to append
693 for(const auto a : state.ctrl_armies[ctrl_group]) {
694 state.select(a);
695 }
696 for(const auto n : state.ctrl_navies[ctrl_group]) {
697 state.select(n);
698 }
699 state.game_state_updated.store(true, std::memory_order_release);
700 }
701 }
702
703 if(!state.ui_state.topbar_subwindow->is_visible()) {
704 state.map_state.on_key_down(keycode, mod);
705 }
706
707 if(keycode == sys::virtual_key::LEFT || keycode == sys::virtual_key::RIGHT || keycode == sys::virtual_key::UP || keycode == sys::virtual_key::DOWN) {
708 if(state.ui_state.mouse_sensitive_target) {
709 state.ui_state.mouse_sensitive_target->set_visible(state, false);
710 state.ui_state.mouse_sensitive_target = nullptr;
711 }
712 }
713 }
714}
715
717 return;
718}
719
720
722 keycode = replace_keycodes(state, keycode, mod);
723 if(state.ui_state.edit_target) {
724 state.ui_state.edit_target->impl_on_key_down(state, keycode, mod);
725 } else {
726 state.current_scene.handle_hotkeys(state, keycode, mod);
727 }
728}
729
730void console_log_other(sys::state& state, std::string_view message) {
731 auto msg = std::string(message);
732 msg = "{" + std::string(state.network_state.nickname.to_string_view()) + "} " + msg;
733#ifdef _WIN32
734 OutputDebugStringA(msg.c_str());
735 OutputDebugStringA("\n");
736#endif
737
739
740 msg += "\n";
741
743 folder,
744 NATIVE("console_log.txt"),
745 msg.c_str(),
746 uint32_t(msg.size())
747 );
748 /*if(state.ui_state.console_window) {
749 Cyto::Any payload = std::string(message);
750 state.ui_state.console_window->impl_get(state, payload);
751 if(true && !(state.ui_state.console_window->is_visible())) {
752 state.ui_state.root->move_child_to_front(state.ui_state.console_window);
753 state.ui_state.console_window->set_visible(state, true);
754 }
755 }*/
756}
757
758
760 if(state.ui_state.units_root) {
761 state.ui_state.units_root->impl_render(state, 0, 0);
762 }
763}
764
766 if(state.ui_state.unit_details_box && state.ui_state.unit_details_box->is_visible()) {
767 state.ui_state.unit_details_box->impl_render(state, state.ui_state.unit_details_box->base_data.position.x, state.ui_state.unit_details_box->base_data.position.y);
768 }
769}
770
773}
774
778}
779
781 if(state.ui_state.tl_chat_list) {
782 state.ui_state.root->move_child_to_front(state.ui_state.tl_chat_list);
783 }
784 if(state.map_state.get_zoom() > map::zoom_close) {
785 if(!state.ui_state.ctrl_held_down) {
786 if(state.ui_state.rgos_root
787 && (state.map_state.active_map_mode == map_mode::mode::rgo_output
788 || state.map_state.active_map_mode == map_mode::mode::infrastructure
789 || state.map_state.active_map_mode == map_mode::mode::naval)) {
790 state.ui_state.rgos_root->impl_render(state, 0, 0);
791 } else {
794 }
795 } else if(state.map_state.get_zoom() >= ui::big_counter_cutoff && state.ui_state.province_details_root) {
796 state.ui_state.province_details_root->impl_render(state, 0, 0);
797 }
798 }
799}
800
802 return mouse_probe;
803}
804
806 float scaled_mouse_x = state.mouse_x_position / state.user_settings.ui_scale;
807 float scaled_mouse_y = state.mouse_y_position / state.user_settings.ui_scale;
808 float pos_x = state.ui_state.unit_details_box->base_data.position.x;
809 float pos_y = state.ui_state.unit_details_box->base_data.position.y;
810
811 return state.ui_state.unit_details_box->impl_probe_mouse(
812 state,
813 int32_t(scaled_mouse_x - pos_x),
814 int32_t(scaled_mouse_y - pos_y),
816 );
817}
818
820 float scaled_mouse_x = state.mouse_x_position / state.user_settings.ui_scale;
821 float scaled_mouse_y = state.mouse_y_position / state.user_settings.ui_scale;
822
823 return state.ui_state.units_root->impl_probe_mouse(
824 state,
825 int32_t(scaled_mouse_x),
826 int32_t(scaled_mouse_y),
828 );
829}
830
832 if(state.ui_state.unit_details_box && state.ui_state.unit_details_box->is_visible()) {
833 mouse_probe = recalculate_mouse_probe_units_details(state, mouse_probe, tooltip_probe);
834 }
835 if(!mouse_probe.under_mouse) {
836 mouse_probe = recalculate_mouse_probe_units(state, mouse_probe, tooltip_probe);
837 }
838
839 return mouse_probe;
840}
841
842
844 if(!state.ui_state.units_root || state.ui_state.ctrl_held_down) {
845 return mouse_probe;
846 }
847 if(state.map_state.active_map_mode == map_mode::mode::rgo_output
848 || state.map_state.active_map_mode == map_mode::mode::infrastructure
849 || state.map_state.active_map_mode == map_mode::mode::naval) {
850 // RGO doesn't need clicks... yet
851 return mouse_probe;
852 }
853 return recalculate_mouse_probe_units_and_details(state, mouse_probe, tooltip_probe);
854}
855
857 if(!state.ui_state.military_root) {
858 return mouse_probe;
859 }
860
861 float scaled_mouse_x = state.mouse_x_position / state.user_settings.ui_scale;
862 float scaled_mouse_y = state.mouse_y_position / state.user_settings.ui_scale;
863
864 return state.ui_state.military_root->impl_probe_mouse(
865 state,
866 int32_t(scaled_mouse_x),
867 int32_t(scaled_mouse_y),
869 );
870}
871
873 float scaled_mouse_x = state.mouse_x_position / state.user_settings.ui_scale;
874 float scaled_mouse_y = state.mouse_y_position / state.user_settings.ui_scale;
875
876 if(state.ui_state.unit_details_box && state.ui_state.unit_details_box->is_visible()) {
877 float pos_x = state.ui_state.unit_details_box->base_data.position.x;
878 float pos_y = state.ui_state.unit_details_box->base_data.position.y;
879
880 tooltip_probe = state.ui_state.unit_details_box->impl_probe_mouse(state,
881 int32_t(scaled_mouse_x - pos_x),
882 int32_t(scaled_mouse_y - pos_y),
884 }
885 if(!tooltip_probe.under_mouse) {
886 tooltip_probe = state.ui_state.units_root->impl_probe_mouse(
887 state,
888 int32_t(scaled_mouse_x),
889 int32_t(scaled_mouse_y),
891 }
892
893 return tooltip_probe;
894}
895
897 if(!state.ui_state.units_root || state.ui_state.ctrl_held_down) {
898 return tooltip_probe;
899 }
900 if(state.map_state.active_map_mode == map_mode::mode::rgo_output
901 || state.map_state.active_map_mode == map_mode::mode::infrastructure
902 || state.map_state.active_map_mode == map_mode::mode::naval) {
903 // RGO doesn't need clicks... yet
904 return tooltip_probe;
905 }
906 if(tooltip_probe.under_mouse) {
907 return tooltip_probe;
908 }
909 return recalculate_tooltip_probe_units_and_details(state, mouse_probe, tooltip_probe);
910}
911
913 // Allow player to select single enemy army or enemy navy to view them
914 if(state.selected_armies.size() == 1) {
915 if(!state.world.army_is_valid(state.selected_armies[0])) {
916 state.selected_armies.clear();
917 }
918 } else if(state.selected_navies.size() == 1) {
919 if(!state.world.navy_is_valid(state.selected_navies[0])) {
920 state.selected_navies.clear();
921 }
922 } else {
923 for(auto i = state.selected_armies.size(); i-- > 0; ) {
924 if(!state.world.army_is_valid(state.selected_armies[i]) || state.world.army_get_controller_from_army_control(state.selected_armies[i]) != state.local_player_nation) {
925 state.selected_armies[i] = state.selected_armies.back();
926 state.selected_armies.pop_back();
927 }
928 }
929 for(auto i = state.selected_navies.size(); i-- > 0; ) {
930 if(!state.world.navy_is_valid(state.selected_navies[i]) || state.world.navy_get_controller_from_navy_control(state.selected_navies[i]) != state.local_player_nation) {
931 state.selected_navies[i] = state.selected_navies.back();
932 state.selected_navies.pop_back();
933 }
934 }
935 }
936}
937
939 if(state.ui_state.change_leader_window && state.ui_state.change_leader_window->is_visible()) {
940 ui::leader_selection_window* win = static_cast<ui::leader_selection_window*>(state.ui_state.change_leader_window);
941 if(state.ui_state.military_subwindow->is_visible() == false
942 && std::find(state.selected_armies.begin(), state.selected_armies.end(), win->a) == state.selected_armies.end()
943 && std::find(state.selected_navies.begin(), state.selected_navies.end(), win->v) == state.selected_navies.end()
944 ) {
945 state.ui_state.change_leader_window->set_visible(state, false);
946 }
947 }
949 // clear up control groups too
950 for(auto& v : state.ctrl_armies) {
951 for(auto i = v.size(); i-- > 0; ) {
952 if(!state.world.army_is_valid(v[i]) || state.world.army_get_controller_from_army_control(v[i]) != state.local_player_nation) {
953 v[i] = v.back();
954 v.pop_back();
955 }
956 }
957 }
958 for(auto& v : state.ctrl_navies) {
959 for(auto i = v.size(); i-- > 0; ) {
960 if(!state.world.navy_is_valid(v[i]) || state.world.navy_get_controller_from_navy_control(v[i]) != state.local_player_nation) {
961 v[i] = v.back();
962 v.pop_back();
963 }
964 }
965 }
966}
967
969 state.ui_state.army_group_window_land->set_visible(state, bool(state.selected_army_group));
970}
971
973 if(state.selected_armies.size() + state.selected_navies.size() > 1) {
974 state.ui_state.multi_unit_selection_window->set_visible(state, true);
975 state.ui_state.army_status_window->set_visible(state, false);
976 state.ui_state.navy_status_window->set_visible(state, false);
977 } else if(state.selected_armies.size() == 1) {
978 state.ui_state.multi_unit_selection_window->set_visible(state, false);
979 if(state.ui_state.army_status_window->is_visible() && state.ui_state.army_status_window->unit_id != state.selected_armies[0]) {
980 state.ui_state.army_status_window->unit_id = state.selected_armies[0];
981 state.ui_state.army_status_window->impl_on_update(state);
982 } else {
983 state.ui_state.army_status_window->unit_id = state.selected_armies[0];
984 state.ui_state.army_status_window->set_visible(state, true);
985 }
986 state.ui_state.navy_status_window->set_visible(state, false);
987 } else if(state.selected_navies.size() == 1) {
988 state.ui_state.multi_unit_selection_window->set_visible(state, false);
989 state.ui_state.army_status_window->set_visible(state, false);
990 if(state.ui_state.navy_status_window->is_visible() && state.ui_state.navy_status_window->unit_id != state.selected_navies[0]) {
991 state.ui_state.navy_status_window->unit_id = state.selected_navies[0];
992 state.ui_state.navy_status_window->impl_on_update(state);
993 } else {
994 state.ui_state.navy_status_window->unit_id = state.selected_navies[0];
995 state.ui_state.navy_status_window->set_visible(state, true);
996 }
997 } else {
998 state.ui_state.multi_unit_selection_window->set_visible(state, false);
999 state.ui_state.army_status_window->set_visible(state, false);
1000 state.ui_state.navy_status_window->set_visible(state, false);
1001 }
1002}
1003
1005 if(state.ui_state.unit_details_box && state.ui_state.unit_details_box->is_visible()) {
1006 state.ui_state.unit_details_box->impl_on_update(state);
1007 }
1008 if(state.ui_state.units_root) {
1009 state.ui_state.units_root->impl_on_update(state);
1010 }
1011}
1012
1016 if(state.ui_state.rgos_root) {
1017 state.ui_state.rgos_root->impl_on_update(state);
1018 }
1020
1021 if(state.ui_state.ctrl_held_down && state.map_state.get_zoom() >= ui::big_counter_cutoff && state.ui_state.province_details_root) {
1022 state.ui_state.province_details_root->impl_on_update(state);
1023 }
1024}
1025
1027 if(state.ui_state.army_combat_window && state.ui_state.army_combat_window->is_visible()) {
1028 ui::land_combat_window* win = static_cast<ui::land_combat_window*>(state.ui_state.army_combat_window);
1029 if(win->battle && !state.world.land_battle_is_valid(win->battle)) {
1030 state.ui_state.army_combat_window->set_visible(state, false);
1031 }
1032 }
1034 state.map_state.map_data.update_borders(state);
1035}
1036
1039 state.map_state.map_data.update_borders(state);
1040}
1041
1044 state.map_state.map_data.update_borders(state);
1045}
1046
1048 state.map_state.map_data.update_borders(state);
1049}
1050
1053}
1054
1057}
1060}
1061
1062void highlight_player_nation(sys::state& state, std::vector<uint32_t>& data, dcon::province_id selected_province) {
1063 for(const auto pc : state.world.nation_get_province_ownership_as_nation(state.local_player_nation)) {
1064 data[province::to_map_id(pc.get_province())] = 0x2B2B2B2B;
1065 }
1066}
1067
1068void highlight_given_province(sys::state& state, std::vector<uint32_t>& data, dcon::province_id selected_province) {
1069 if(selected_province) {
1070 data[province::to_map_id(selected_province)] = 0x2B2B2B2B;
1071 }
1072}
1073
1074void highlight_defensive_positions(sys::state& state, std::vector<uint32_t>& data, dcon::province_id selected_province) {
1075 if(state.selected_army_group) {
1076
1077 for(auto position : state.world.automated_army_group_get_provinces_defend(state.selected_army_group)) {
1078 data[province::to_map_id(position)] = 0x2B2B2B2B;
1079 }
1080
1081 for(auto position : state.world.automated_army_group_get_provinces_ferry_origin(state.selected_army_group)) {
1082 data[province::to_map_id(position)] = 0x2B2B2B2B;
1083 }
1084
1085 for(auto position : state.world.automated_army_group_get_provinces_enforce_control(state.selected_army_group)) {
1086 data[province::to_map_id(position)] = 0x2B2B2B2B;
1087 }
1088 }
1089}
1090
1092 return state.ui_state.end_screen.get();
1093}
1094
1096 return state.ui_state.nation_picker.get();
1097}
1098
1100 return state.ui_state.root.get();
1101}
1102
1104 return state.ui_state.military_root.get();
1105}
1106
1108 return state.ui_state.army_group_selector_root.get();
1109}
1110
1112 return state.ui_state.army_group_selector_root.get();
1113}
1114
1116 return state.ui_state.economy_viewer_root.get();
1117}
1118
1120 return state.ui_state.select_states_legend.get();
1121}
1122
1123}
static void show_toggle(sys::state &state)
virtual message_result impl_set(sys::state &state, Cyto::Any &payload) noexcept
element_base * parent
dcon::land_battle_id battle
#define assert(condition)
Definition: debug.h:74
std::vector< dcon::province_id > can_move_navy(sys::state &state, dcon::nation_id source, dcon::navy_id n, dcon::province_id dest)
Definition: commands.cpp:3522
bool can_notify_player_picks_nation(sys::state &state, dcon::nation_id source, dcon::nation_id target)
Definition: commands.cpp:5061
std::vector< dcon::province_id > can_move_army(sys::state &state, dcon::nation_id source, dcon::army_id a, dcon::province_id dest)
Definition: commands.cpp:3284
void update(sys::state &state)
bool navy_is_in_selection(sys::state &state, int32_t x, int32_t y, dcon::navy_id n)
Definition: game_scene.cpp:393
void update_military_game_scene(sys::state &state)
void render_map_generic(sys::state &state)
Definition: game_scene.cpp:214
void in_game_hotkeys(sys::state &state, sys::virtual_key keycode, sys::key_modifiers mod)
Definition: game_scene.cpp:635
scene_properties nation_picker()
Definition: game_scene.hpp:189
void select_wargoal_state_from_selected_province(sys::state &state)
Definition: game_scene.cpp:188
bool belongs_on_map(sys::state &state, ui::element_base *checked_element)
Definition: game_scene.cpp:88
void on_lbutton_up(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:475
void highlight_given_province(sys::state &state, std::vector< uint32_t > &data, dcon::province_id selected_province)
void handle_lbutton_down_map_interaction(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:273
ui::mouse_probe recalculate_mouse_probe_military(sys::state &state, ui::mouse_probe mouse_probe, ui::mouse_probe tooltip_probe)
Definition: game_scene.cpp:856
void switch_scene(sys::state &state, scene_id ui_scene)
Definition: game_scene.cpp:13
void military_screen_on_lbutton_up(sys::state &state)
Definition: game_scene.cpp:550
void on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:278
void update_ui_state_basic(sys::state &state)
void select_player_nation_from_selected_province(sys::state &state)
Definition: game_scene.cpp:167
void render_ui_ingame(sys::state &state)
Definition: game_scene.cpp:780
void render_ui_military(sys::state &state)
Definition: game_scene.cpp:771
void update_ui_unit_details(sys::state &state)
void handle_escape_basic(sys::state &state, sys::virtual_key keycode, sys::key_modifiers mod)
Definition: game_scene.cpp:616
ui::element_base * root_game_economy_viewer(sys::state &state)
void highlight_defensive_positions(sys::state &state, std::vector< uint32_t > &data, dcon::province_id selected_province)
void do_nothing_screen(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:86
scene_properties basic_game()
Definition: game_scene.hpp:215
ui::mouse_probe recalculate_mouse_probe_units(sys::state &state, ui::mouse_probe mouse_probe, ui::mouse_probe tooltip_probe)
Definition: game_scene.cpp:819
ui::element_base * root_end_screen(sys::state &state)
void highlight_player_nation(sys::state &state, std::vector< uint32_t > &data, dcon::province_id selected_province)
void on_rbutton_down_map(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:236
void console_log_other(sys::state &state, std::string_view message)
Definition: game_scene.cpp:730
ui::element_base * root_game_basic(sys::state &state)
scene_properties state_wargoal_selector()
Definition: game_scene.hpp:319
void open_chat_before_game(sys::state &state)
ui::element_base * root_game_wargoal_state_selection(sys::state &state)
void do_nothing_province_target(sys::state &state, dcon::nation_id nation, dcon::province_id target, sys::key_modifiers mod)
Definition: game_scene.cpp:81
void stop_dragging(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:207
void render_units_info_box(sys::state &state)
Definition: game_scene.cpp:765
void on_lbutton_up_ui_click_hold_and_release(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:313
void open_diplomacy(sys::state &state, dcon::nation_id nation, dcon::province_id target, sys::key_modifiers mod)
Definition: game_scene.cpp:153
void generic_map_scene_update(sys::state &state)
void deselect_units(sys::state &state)
Definition: game_scene.cpp:342
void update_add_units_game_scene(sys::state &state)
void clean_up_basic_game_scene(sys::state &state)
Definition: game_scene.cpp:938
void clean_up_selected_armies_and_navies(sys::state &state)
Definition: game_scene.cpp:912
scene_properties battleplan_editor_add_army()
Definition: game_scene.hpp:268
void render_units(sys::state &state)
Definition: game_scene.cpp:759
ui::mouse_probe recalculate_mouse_probe_identity(sys::state &state, ui::mouse_probe mouse_probe, ui::mouse_probe tooltip_probe)
Definition: game_scene.cpp:801
ui::mouse_probe recalculate_mouse_probe_units_details(sys::state &state, ui::mouse_probe mouse_probe, ui::mouse_probe tooltip_probe)
Definition: game_scene.cpp:805
void state_selector_hotkeys(sys::state &state, sys::virtual_key keycode, sys::key_modifiers mod)
Definition: game_scene.cpp:539
void on_key_down(sys::state &state, sys::virtual_key keycode, sys::key_modifiers mod)
Definition: game_scene.cpp:721
sys::virtual_key replace_keycodes_map_movement(sys::state &state, sys::virtual_key keycode, sys::key_modifiers mod)
Definition: game_scene.cpp:499
sys::virtual_key replace_keycodes(sys::state &state, sys::virtual_key keycode, sys::key_modifiers mod)
Definition: game_scene.cpp:518
void military_screen_hotkeys(sys::state &state, sys::virtual_key keycode, sys::key_modifiers mod)
Definition: game_scene.cpp:571
void ui_lbutton(sys::state &state, sys::key_modifiers mod)
Definition: game_scene.cpp:226
void handle_rbutton_down_map_interaction(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:248
void nation_picker_hotkeys(sys::state &state, sys::virtual_key keycode, sys::key_modifiers mod)
Definition: game_scene.cpp:528
void render_ui_selection_screen(sys::state &state)
Definition: game_scene.cpp:775
map::map_view get_view(sys::state &state)
Definition: game_scene.cpp:99
bool province_port_is_in_selection(sys::state &state, int32_t x, int32_t y, dcon::province_id province)
Definition: game_scene.cpp:361
bool army_is_in_selection(sys::state &state, int32_t x, int32_t y, dcon::army_id a)
Definition: game_scene.cpp:388
void do_nothing(sys::state &state)
Definition: game_scene.cpp:85
void do_nothing_hotkeys(sys::state &state, sys::virtual_key keycode, sys::key_modifiers mod)
Definition: game_scene.cpp:716
void update_army_group_selection_ui(sys::state &state)
Definition: game_scene.cpp:968
void start_dragging(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:200
scene_properties battleplan_editor()
Definition: game_scene.hpp:244
void on_lbutton_down_map(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:240
void update_unit_selection_ui(sys::state &state)
Definition: game_scene.cpp:972
ui::element_base * root_game_battleplanner(sys::state &state)
void center_on_capital(sys::state &state, dcon::nation_id nation)
Definition: game_scene.cpp:627
ui::mouse_probe recalculate_mouse_probe_basic(sys::state &state, ui::mouse_probe mouse_probe, ui::mouse_probe tooltip_probe)
Definition: game_scene.cpp:843
void select_units(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:407
ui::element_base * root_game_battleplanner_add_army(sys::state &state)
ui::element_base * root_pick_nation(sys::state &state)
void on_lbutton_up_map(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:244
bool province_mid_point_is_in_selection(sys::state &state, int32_t x, int32_t y, dcon::province_id province)
Definition: game_scene.cpp:347
float get_effects_volume(sys::state &state)
Definition: game_scene.cpp:110
void open_chat_during_game(sys::state &state)
scene_properties end_screen()
Definition: game_scene.hpp:339
void send_selected_province_to_province_window(sys::state &state)
Definition: game_scene.cpp:194
ui::mouse_probe recalculate_mouse_probe_units_and_details(sys::state &state, ui::mouse_probe mouse_probe, ui::mouse_probe tooltip_probe)
Definition: game_scene.cpp:831
void handle_drag_stop(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:446
void economy_scene_update(sys::state &state)
void ui_rbutton(sys::state &state, sys::key_modifiers mod)
Definition: game_scene.cpp:218
void update_basic_game_scene(sys::state &state)
ui::mouse_probe recalculate_tooltip_probe_basic(sys::state &state, ui::mouse_probe mouse_probe, ui::mouse_probe tooltip_probe)
Definition: game_scene.cpp:896
scene_properties economy_viewer_scene()
Definition: game_scene.hpp:295
void selected_units_control(sys::state &state, dcon::nation_id nation, dcon::province_id target, sys::key_modifiers mod)
Definition: game_scene.cpp:114
ui::mouse_probe recalculate_tooltip_probe_units_and_details(sys::state &state, ui::mouse_probe mouse_probe, ui::mouse_probe tooltip_probe)
Definition: game_scene.cpp:872
sys::virtual_key replace_keycodes_identity(sys::state &state, sys::virtual_key keycode, sys::key_modifiers mod)
Definition: game_scene.cpp:514
ui::element_base * root_game_battleplanner_unit_selection(sys::state &state)
void economy_screen_hotkeys(sys::state &state, sys::virtual_key keycode, sys::key_modifiers mod)
Definition: game_scene.cpp:605
void on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mod)
Definition: game_scene.cpp:297
void update_map_mode(sys::state &state)
Definition: map_modes.cpp:1001
void set_map_mode(sys::state &state, mode mode)
Definition: map_modes.cpp:776
constexpr float zoom_close
Definition: constants.hpp:605
map_view
Definition: map_state.hpp:17
constexpr float zoom_very_close
Definition: constants.hpp:606
constexpr dcon::province_id from_map_id(uint16_t id)
Definition: province.hpp:13
constexpr uint16_t to_map_id(dcon::province_id id)
Definition: province.hpp:10
directory get_or_create_data_dumps_directory()
void append_file(directory const &dir, native_string_view file_name, char const *file_data, uint32_t file_size)
audio_instance & get_random_province_select_sound(sys::state &state)
Definition: sound_nix.cpp:403
audio_instance & get_navy_move_sound(sys::state &state)
Definition: sound_nix.cpp:320
void play_effect(sys::state &state, audio_instance &s, float volume)
Definition: sound_nix.cpp:198
audio_instance & get_navy_select_sound(sys::state &state)
Definition: sound_nix.cpp:317
audio_instance & get_army_select_sound(sys::state &state)
Definition: sound_nix.cpp:311
void play_interface_sound(sys::state &state, audio_instance &s, float volume)
Definition: sound_nix.cpp:203
audio_instance & get_error_sound(sys::state &state)
Definition: sound_nix.cpp:323
audio_instance & get_army_move_sound(sys::state &state)
Definition: sound_nix.cpp:314
NLOHMANN_BASIC_JSON_TPL_DECLARATION void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL &j1, nlohmann::NLOHMANN_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name, cert-dcl58-cpp) is_nothrow_move_constructible< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression, cppcoreguidelines-noexcept-swap, performance-noexcept-swap) is_nothrow_move_assignable< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
Definition: json.hpp:24635
virtual_key
Definition: constants.hpp:5
key_modifiers
Definition: constants.hpp:156
void open_chat_during_game(sys::state &state)
void open_chat_before_game(sys::state &state)
void close_expired_event_windows(sys::state &state)
Definition: gui_event.cpp:1148
constexpr float big_counter_cutoff
void show_main_menu_nation_picker(sys::state &state)
void show_main_menu_nation_basic(sys::state &state)
void open_chat_window(sys::state &state)
void change_cursor(sys::state &state, cursor_type type)
Definition: window_nix.cpp:351
#define NATIVE(X)
uint uint32_t
uchar uint8_t
Holds important data about the game world, state, and other data regarding windowing,...
element_base * under_mouse