From 2f2a321606725e466031bffdb0755a1c9bde04d6 Mon Sep 17 00:00:00 2001 From: schombert Date: Sun, 21 Jul 2024 01:21:23 -0700 Subject: [PATCH] 1.1.2 --- CMakeLists.txt | 4 +- ParserGenerator/CMakeLists.txt | 2 +- .../DataContainerGenerator/CMakeLists.txt | 2 +- src/gamestate/game_scene.cpp | 16 +- src/gamestate/game_scene.hpp | 243 +++++++++--------- src/gamestate/system_state.cpp | 77 +++--- src/gamestate/system_state.hpp | 8 +- 7 files changed, 185 insertions(+), 167 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dd34cf8a..7c095e047 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,12 +125,12 @@ if(WIN32) if(OPTIMIZE_MODE STREQUAL "On") message(STATUS "Optimizing with PGO data") target_compile_options(AliceCommon INTERFACE - /bigobj /wd4100 /wd4189 /wd4065 /wd4201 /wd4324 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389 -Wno-unused-macros -Wno-zero-length-array -Wno-reserved-identifier -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field /Z7 -Wno-invalid-offsetof -Wno-deprecated-volatile -Wno-missing-prototypes -Wno-reserved-identifier -Wno-implicit-int-float-conversion -Wno-unsafe-buffer-usage -Wno-float-equal -Wno-shadow-field-in-constructor -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-shadow-uncaptured-local -Wno-nonportable-system-include-path -Wno-format-nonliteral -Wno-shorten-64-to-32 -Wno-ctad-maybe-unsupported -Wno-implicit-int-conversion -Wno-disabled-macro-expansion -Wno-comma -Wno-cast-function-type-strict -Wno-cast-function-type /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline -Wno-profile-instr-missing -Wno-profile-instr-out-of-date -fprofile-instr-use=code.profdata) + /bigobj /wd4100 /wd4189 /wd4065 /wd4201 /wd4324 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389 -Wno-unused-macros -Wno-zero-length-array -Wno-switch-default -Wno-reserved-identifier -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field /Z7 -Wno-invalid-offsetof -Wno-deprecated-volatile -Wno-missing-prototypes -Wno-reserved-identifier -Wno-implicit-int-float-conversion -Wno-unsafe-buffer-usage -Wno-float-equal -Wno-shadow-field-in-constructor -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-shadow-uncaptured-local -Wno-nonportable-system-include-path -Wno-format-nonliteral -Wno-shorten-64-to-32 -Wno-ctad-maybe-unsupported -Wno-implicit-int-conversion -Wno-disabled-macro-expansion -Wno-comma -Wno-cast-function-type-strict -Wno-cast-function-type /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline -Wno-profile-instr-missing -Wno-profile-instr-out-of-date -fprofile-instr-use=code.profdata) target_link_options(AliceCommon INTERFACE /OPT:REF /OPT:ICF /LTCG -fprofile-instr-use=code.profdata) elseif(PROFILE_MODE STREQUAL "On") message(STATUS "Compiling for PGO instrumentation") target_compile_options(AliceCommon INTERFACE - /bigobj /wd4100 /wd4189 /wd4065 /wd4201 /wd4324 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389 -Wno-unused-macros -Wno-zero-length-array -Wno-reserved-identifier -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field /Z7 -Wno-invalid-offsetof -Wno-deprecated-volatile -Wno-missing-prototypes -Wno-reserved-identifier -Wno-implicit-int-float-conversion -Wno-unsafe-buffer-usage -Wno-float-equal -Wno-shadow-field-in-constructor -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-shadow-uncaptured-local -Wno-nonportable-system-include-path -Wno-format-nonliteral -Wno-shorten-64-to-32 -Wno-ctad-maybe-unsupported -Wno-implicit-int-conversion -Wno-disabled-macro-expansion -Wno-comma -Wno-cast-function-type-strict -Wno-cast-function-type /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline -fprofile-instr-generate) + /bigobj /wd4100 /wd4189 /wd4065 /wd4201 /wd4324 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389 -Wno-unused-macros -Wno-zero-length-array -Wno-switch-default -Wno-reserved-identifier -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field /Z7 -Wno-invalid-offsetof -Wno-deprecated-volatile -Wno-missing-prototypes -Wno-reserved-identifier -Wno-implicit-int-float-conversion -Wno-unsafe-buffer-usage -Wno-float-equal -Wno-shadow-field-in-constructor -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-shadow-uncaptured-local -Wno-nonportable-system-include-path -Wno-format-nonliteral -Wno-shorten-64-to-32 -Wno-ctad-maybe-unsupported -Wno-implicit-int-conversion -Wno-disabled-macro-expansion -Wno-comma -Wno-cast-function-type-strict -Wno-cast-function-type /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline -fprofile-instr-generate) target_link_options(AliceCommon INTERFACE /DEBUG:FULL /OPT:REF /OPT:ICF /LTCG -fprofile-instr-generate) else() target_compile_options(AliceCommon INTERFACE diff --git a/ParserGenerator/CMakeLists.txt b/ParserGenerator/CMakeLists.txt index 8173848ee..7760a1ee8 100644 --- a/ParserGenerator/CMakeLists.txt +++ b/ParserGenerator/CMakeLists.txt @@ -16,7 +16,7 @@ if(WIN32) target_compile_options(ParserGenerator PRIVATE /bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389 - -Wno-missing-prototypes -Wno-unsafe-buffer-usage + -Wno-missing-prototypes -Wno-unsafe-buffer-usage -Wno-switch-default $<$: /RTC1 /EHsc /MTd /Od /RTC1> $<$>: /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline>) target_link_options(ParserGenerator PRIVATE diff --git a/dependencies/DataContainerGenerator/CMakeLists.txt b/dependencies/DataContainerGenerator/CMakeLists.txt index 349191029..1553ae92a 100644 --- a/dependencies/DataContainerGenerator/CMakeLists.txt +++ b/dependencies/DataContainerGenerator/CMakeLists.txt @@ -25,7 +25,7 @@ if(WIN32) set(CMAKE_CXX_FLAGS_RELEASE "") if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options(DCONGENERATOR PRIVATE - /bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /wd4388 /wd4389 -Wno-unused-parameter -Wno-sign-compare -Wno-newline-eof -Wno-missing-prototypes -Wno-unsafe-buffer-usage -Wno-shadow-uncaptured-local -Wno-unreachable-code-break + /bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /wd4388 /wd4389 -Wno-switch-default -Wno-unused-parameter -Wno-sign-compare -Wno-newline-eof -Wno-missing-prototypes -Wno-unsafe-buffer-usage -Wno-shadow-uncaptured-local -Wno-unreachable-code-break $<$: /RTC1 /EHsc /MTd /Od> $<$>: /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline>) target_link_options(DCONGENERATOR PRIVATE diff --git a/src/gamestate/game_scene.cpp b/src/gamestate/game_scene.cpp index ff68e85cf..8c8826a90 100644 --- a/src/gamestate/game_scene.cpp +++ b/src/gamestate/game_scene.cpp @@ -29,7 +29,7 @@ void switch_scene(sys::state& state, scene_id ui_scene) { switch(ui_scene) { case scene_id::in_game_state_selector: - state.current_scene = state_wargoal_selector; + state.current_scene = state_wargoal_selector(); state.stored_map_mode = state.map_state.active_map_mode; map_mode::set_map_mode(state, map_mode::mode::state_select); @@ -43,31 +43,35 @@ void switch_scene(sys::state& state, scene_id ui_scene) { map_mode::set_map_mode(state, state.stored_map_mode); } - state.current_scene = basic_game; + state.current_scene = basic_game(); return; case scene_id::in_game_military: - state.current_scene = battleplan_editor; + state.current_scene = battleplan_editor(); return; case scene_id::end_screen: - state.current_scene = end_screen; + state.current_scene = end_screen(); return; case scene_id::pick_nation: - state.current_scene = nation_picker; + state.current_scene = nation_picker(); return; case scene_id::in_game_military_selector: - state.current_scene = battleplan_editor_add_army; + state.current_scene = battleplan_editor_add_army(); + return; + case scene_id::count: // this should never happen + assert(false); return; } + } void do_nothing_province_target(sys::state& state, diff --git a/src/gamestate/game_scene.hpp b/src/gamestate/game_scene.hpp index 45bf6e162..c3be42a60 100644 --- a/src/gamestate/game_scene.hpp +++ b/src/gamestate/game_scene.hpp @@ -175,146 +175,157 @@ struct scene_properties { }; -inline scene_properties nation_picker{ - .id = scene_id::pick_nation, - - .get_root = root_pick_nation, - - .starting_scene = true, - .enforced_pause = true, - .overwrite_map_tooltip = true, - .is_lobby = true, - .game_in_progress = false, - - .rbutton_selected_units = do_nothing_province_target, - .rbutton_province = do_nothing_province_target, - .allow_drag_selection = false, - .on_drag_start = do_nothing_screen, - .drag_selection = do_nothing_screen, - .lbutton_up = select_player_nation_from_selected_province, - .keycode_mapping = replace_keycodes_map_movement, - .handle_hotkeys = nation_picker_hotkeys, - .console_log = console_log_pick_nation, - .open_chat = open_chat_before_game, - .update_highlight_texture = highlight_player_nation, -}; - -inline scene_properties basic_game{ - .id = scene_id::in_game_basic, - - .get_root = root_game_basic, - - .accept_events = true, - - .rbutton_selected_units = selected_units_control, - .rbutton_province = open_diplomacy, - .allow_drag_selection = true, - .on_drag_start = start_dragging, - .drag_selection = select_units, - .lbutton_up = do_nothing, - .keycode_mapping = replace_keycodes_map_movement, - .handle_hotkeys = in_game_hotkeys, - .console_log = console_log_other, +inline scene_properties nation_picker() { + return scene_properties{ +.id = scene_id::pick_nation, + +.get_root = root_pick_nation, + +.starting_scene = true, +.enforced_pause = true, +.overwrite_map_tooltip = true, +.is_lobby = true, +.game_in_progress = false, + +.rbutton_selected_units = do_nothing_province_target, +.rbutton_province = do_nothing_province_target, +.allow_drag_selection = false, +.on_drag_start = do_nothing_screen, +.drag_selection = do_nothing_screen, +.lbutton_up = select_player_nation_from_selected_province, +.keycode_mapping = replace_keycodes_map_movement, +.handle_hotkeys = nation_picker_hotkeys, +.console_log = console_log_pick_nation, +.open_chat = open_chat_before_game, +.update_highlight_texture = highlight_player_nation, + }; +} - .render_ui = render_ui_ingame, +inline scene_properties basic_game() { + return scene_properties{ +.id = scene_id::in_game_basic, - .recalculate_mouse_probe = recalculate_mouse_probe_basic, - .recalculate_tooltip_probe = recalculate_tooltip_probe_basic, +.get_root = root_game_basic, - .clean_up = clean_up_basic_game_scene, - .on_game_state_update = update_basic_game_scene, - .on_game_state_update_update_ui = update_ui_state_basic, -}; +.accept_events = true, -inline scene_properties battleplan_editor{ - .id = scene_id::in_game_military, +.rbutton_selected_units = selected_units_control, +.rbutton_province = open_diplomacy, +.allow_drag_selection = true, +.on_drag_start = start_dragging, +.drag_selection = select_units, +.lbutton_up = do_nothing, +.keycode_mapping = replace_keycodes_map_movement, +.handle_hotkeys = in_game_hotkeys, +.console_log = console_log_other, - .get_root = root_game_battleplanner, +.render_ui = render_ui_ingame, - .rbutton_selected_units = do_nothing_province_target, - .rbutton_province = do_nothing_province_target, - .allow_drag_selection = false, - .on_drag_start = do_nothing_screen, - .drag_selection = do_nothing_screen, - .lbutton_up = do_nothing, - .keycode_mapping = replace_keycodes_map_movement, - .handle_hotkeys = military_screen_hotkeys, - .console_log = console_log_other, +.recalculate_mouse_probe = recalculate_mouse_probe_basic, +.recalculate_tooltip_probe = recalculate_tooltip_probe_basic, - .render_ui = render_ui_military, +.clean_up = clean_up_basic_game_scene, +.on_game_state_update = update_basic_game_scene, +.on_game_state_update_update_ui = update_ui_state_basic, + }; +} - .recalculate_mouse_probe = recalculate_mouse_probe_military, +inline scene_properties battleplan_editor() { return scene_properties{ + .id = scene_id::in_game_military, - .on_game_state_update = update_military_game_scene, - .update_highlight_texture = highlight_defensive_positions -}; + .get_root = root_game_battleplanner, -inline scene_properties battleplan_editor_add_army{ - .id = scene_id::in_game_military_selector, + .rbutton_selected_units = do_nothing_province_target, + .rbutton_province = do_nothing_province_target, + .allow_drag_selection = false, + .on_drag_start = do_nothing_screen, + .drag_selection = do_nothing_screen, + .lbutton_up = do_nothing, + .keycode_mapping = replace_keycodes_map_movement, + .handle_hotkeys = military_screen_hotkeys, + .console_log = console_log_other, - .get_root = root_game_battleplanner_add_army, + .render_ui = render_ui_military, - .rbutton_selected_units = do_nothing_province_target, - .rbutton_province = do_nothing_province_target, - .allow_drag_selection = true, - .on_drag_start = start_dragging, - .drag_selection = select_units, - .lbutton_up = do_nothing, - .keycode_mapping = replace_keycodes_map_movement, - .handle_hotkeys = military_screen_hotkeys, - .console_log = console_log_other, + .recalculate_mouse_probe = recalculate_mouse_probe_military, - .render_ui = render_ui_selection_screen, + .on_game_state_update = update_military_game_scene, + .update_highlight_texture = highlight_defensive_positions + }; +} - .recalculate_mouse_probe = recalculate_mouse_probe_units_and_details, - .recalculate_tooltip_probe = recalculate_tooltip_probe_units_and_details, +inline scene_properties battleplan_editor_add_army() { + return scene_properties{ +.id = scene_id::in_game_military_selector, - .on_game_state_update = update_add_units_game_scene, - .on_game_state_update_update_ui = update_ui_unit_details, - .update_highlight_texture = highlight_defensive_positions -}; +.get_root = root_game_battleplanner_add_army, -inline scene_properties state_wargoal_selector{ - .id = scene_id::in_game_state_selector, +.rbutton_selected_units = do_nothing_province_target, +.rbutton_province = do_nothing_province_target, +.allow_drag_selection = true, +.on_drag_start = start_dragging, +.drag_selection = select_units, +.lbutton_up = do_nothing, +.keycode_mapping = replace_keycodes_map_movement, +.handle_hotkeys = military_screen_hotkeys, +.console_log = console_log_other, - .get_root = root_game_wargoal_state_selection, +.render_ui = render_ui_selection_screen, - .borders = borders_granularity::state, +.recalculate_mouse_probe = recalculate_mouse_probe_units_and_details, +.recalculate_tooltip_probe = recalculate_tooltip_probe_units_and_details, - .rbutton_selected_units = do_nothing_province_target, - .rbutton_province = do_nothing_province_target, - .allow_drag_selection = false, - .on_drag_start = do_nothing_screen, - .drag_selection = do_nothing_screen, - .lbutton_up = select_wargoal_state_from_selected_province, - .keycode_mapping = replace_keycodes_map_movement, - .handle_hotkeys = state_selector_hotkeys, - .console_log = console_log_other -}; +.on_game_state_update = update_add_units_game_scene, +.on_game_state_update_update_ui = update_ui_unit_details, +.update_highlight_texture = highlight_defensive_positions + }; +} -inline scene_properties end_screen{ - .id = scene_id::end_screen, +inline scene_properties state_wargoal_selector() { + return scene_properties{ +.id = scene_id::in_game_state_selector, - .get_root = root_end_screen, +.get_root = root_game_wargoal_state_selection, - .final_scene = true, - .enforced_pause = true, - .based_on_map = false, - .game_in_progress = false, +.borders = borders_granularity::state, - .rbutton_selected_units = do_nothing_province_target, - .rbutton_province = do_nothing_province_target, - .allow_drag_selection = false, - .on_drag_start = do_nothing_screen, - .drag_selection = do_nothing_screen, - .lbutton_up = do_nothing, - .keycode_mapping = replace_keycodes_identity, - .handle_hotkeys = do_nothing_hotkeys, - .console_log = console_log_other, +.rbutton_selected_units = do_nothing_province_target, +.rbutton_province = do_nothing_province_target, +.allow_drag_selection = false, +.on_drag_start = do_nothing_screen, +.drag_selection = do_nothing_screen, +.lbutton_up = select_wargoal_state_from_selected_province, +.keycode_mapping = replace_keycodes_map_movement, +.handle_hotkeys = state_selector_hotkeys, +.console_log = console_log_other + }; +} - .render_map = do_nothing, - .on_game_state_update = do_nothing, -}; +inline scene_properties end_screen() { + return scene_properties{ +.id = scene_id::end_screen, + +.get_root = root_end_screen, + +.final_scene = true, +.enforced_pause = true, +.based_on_map = false, +.game_in_progress = false, + +.rbutton_selected_units = do_nothing_province_target, +.rbutton_province = do_nothing_province_target, +.allow_drag_selection = false, +.on_drag_start = do_nothing_screen, +.drag_selection = do_nothing_screen, +.lbutton_up = do_nothing, +.keycode_mapping = replace_keycodes_identity, +.handle_hotkeys = do_nothing_hotkeys, +.console_log = console_log_other, + +.render_map = do_nothing, +.on_game_state_update = do_nothing, + }; +} } diff --git a/src/gamestate/system_state.cpp b/src/gamestate/system_state.cpp index eca53bb4e..5d6a2eaeb 100644 --- a/src/gamestate/system_state.cpp +++ b/src/gamestate/system_state.cpp @@ -461,6 +461,9 @@ inline constexpr int32_t tooltip_width = 400; void state::render() { // called to render the frame may (and should) delay returning until the frame is rendered, including // waiting for vsync + if(!current_scene.get_root) + return; + auto game_state_was_updated = game_state_updated.exchange(false, std::memory_order::acq_rel); if(game_state_was_updated && !current_scene.starting_scene && !ui_state.lazy_load_in_game) { window::change_cursor(*this, window::cursor_type::busy); @@ -557,13 +560,13 @@ void state::render() { // called to render the frame may (and should) delay retu float total = 0.f; for(dcon::regiment_id regiment : army_group.land_regiments) { auto regiment_type = world.regiment_get_type(regiment); - auto status = army_group.regiment_status[regiment.index()]; - if(status == army_group_regiment_status::awaiting_orders - || status == army_group_regiment_status::idle - ) { - regiments_distribution[regiment_type.index()] += 1.f; - total += 1.f; - } + //auto status = army_group.regiment_status[regiment.index()]; + //if(status == army_group_regiment_status::awaiting_orders + // || status == army_group_regiment_status::idle + //) { + // regiments_distribution[regiment_type.index()] += 1.f; + // total += 1.f; + //} } if(total > 0.5f) { @@ -593,14 +596,14 @@ void state::render() { // called to render the frame may (and should) delay retu //recalculate distribution float total = 0.f; for(dcon::regiment_id regiment : army_group.land_regiments) { - auto regiment_type = world.regiment_get_type(regiment); - auto status = army_group.regiment_status[regiment.index()]; - if(status == army_group_regiment_status::awaiting_orders - || status == army_group_regiment_status::idle - ) { - regiments_distribution[regiment_type.index()] += 1.f; - total += 1.f; - } + //auto regiment_type = world.regiment_get_type(regiment); + //auto status = army_group.regiment_status[regiment.index()]; + //if(status == army_group_regiment_status::awaiting_orders + // || status == army_group_regiment_status::idle + //) { + // regiments_distribution[regiment_type.index()] += 1.f; + // total += 1.f; + //} } if(total > 0.5f) { @@ -738,9 +741,9 @@ void state::render() { // called to render the frame may (and should) delay retu } for(dcon::regiment_id regiment : army_group.land_regiments) { - if(army_group.regiment_status[regiment.index()] != army_group_regiment_status::awaiting_naval_travel) { - continue; - } + //if(army_group.regiment_status[regiment.index()] != army_group_regiment_status::awaiting_naval_travel) { + // continue; + //} auto army = world.regiment_get_army_from_army_membership(regiment); @@ -835,9 +838,9 @@ void state::render() { // called to render the frame may (and should) delay retu if(world.army_get_location_from_army_location(army) == current_location) { for(auto rg : world.army_get_army_membership(army)) { current_weight += 3.0f; - if(army_group.regiment_status[rg.get_regiment().id.index()] == army_group_regiment_status::idle) { - army_group.regiment_status[rg.get_regiment().id.index()] = army_group_regiment_status::awaiting_orders; - } + //if(army_group.regiment_status[rg.get_regiment().id.index()] == army_group_regiment_status::idle) { + // army_group.regiment_status[rg.get_regiment().id.index()] = army_group_regiment_status::awaiting_orders; + //} } } } else if(current_path[0] == current_location) { @@ -898,10 +901,10 @@ void state::render() { // called to render the frame may (and should) delay retu auto army = world.regiment_get_army_from_army_membership(current_regiment); auto current_location = world.army_get_location_from_army_location(army); auto current_path = world.army_get_path(army); - auto status = army_group.regiment_status[current_regiment.index()]; - if(status != army_group_regiment_status::idle) { - continue; - } + //auto status = army_group.regiment_status[current_regiment.index()]; + //if(status != army_group_regiment_status::idle) { + // continue; + //} if(current_location == target_location) { continue; @@ -4179,7 +4182,7 @@ void state::single_game_tick() { ai::update_ai_colonial_investment(*this); } - if(defines.alice_eval_ai_mil_everyday) { + if(defines.alice_eval_ai_mil_everyday != 0.0f) { ai::make_defense(*this); ai::make_attacks(*this); ai::update_ships(*this); @@ -4637,7 +4640,7 @@ void state::remove_regiment_from_army_group(army_group* selected_group, dcon::re return; } selected_group->land_regiments.erase(index_of); - selected_group->regiment_status[regiment_to_delete.index()] = army_group_regiment_status::idle; + //selected_group->regiment_status[regiment_to_delete.index()] = army_group_regiment_status::idle; } void state::remove_ship_from_army_group(army_group* selected_group, dcon::ship_id ship_to_delete) { auto index_of = std::find(selected_group->ships.begin(), selected_group->ships.end(), ship_to_delete); @@ -4645,7 +4648,7 @@ void state::remove_ship_from_army_group(army_group* selected_group, dcon::ship_i return; } selected_group->ships.erase(index_of); - selected_group->ship_status[ship_to_delete.index()] = army_group_ship_status::idle; + //selected_group->ship_status[ship_to_delete.index()] = army_group_ship_status::idle; } void state::remove_regiment_from_all_army_groups(dcon::regiment_id regiment_to_delete) { @@ -4762,8 +4765,8 @@ bool state::fill_province_up_to_supply_limit( ) { for(auto rg : world.army_get_army_membership(army)) { auto regiment = rg.get_regiment().id; - if(group->regiment_status[regiment.index()] == army_group_regiment_status::moving) - group->regiment_status[regiment.index()] = final_status; + //if(group->regiment_status[regiment.index()] == army_group_regiment_status::moving) + // group->regiment_status[regiment.index()] = final_status; } } } @@ -4856,9 +4859,9 @@ bool state::fill_province( // now find a unit to move there for(auto regiment : group->land_regiments) { - if(group->regiment_status[regiment.index()] != initial_status) { - continue; - } + //if(group->regiment_status[regiment.index()] != initial_status) { + // continue; + //} auto regiment_type = world.regiment_get_type(regiment); @@ -4889,10 +4892,10 @@ bool state::fill_province( } if(fitting) { - for(auto m : world.army_get_army_membership(army)) { - auto army_regiment = m.get_regiment().id; - group->regiment_status[army_regiment.index()] = army_group_regiment_status::moving; - } + //for(auto m : world.army_get_army_membership(army)) { + // auto army_regiment = m.get_regiment().id; + // group->regiment_status[army_regiment.index()] = army_group_regiment_status::moving; + //} command::move_army(*this, local_player_nation, army, target, false); } else { std::array data; diff --git a/src/gamestate/system_state.hpp b/src/gamestate/system_state.hpp index ec9f86bd0..d567ef02b 100644 --- a/src/gamestate/system_state.hpp +++ b/src/gamestate/system_state.hpp @@ -431,11 +431,11 @@ struct army_group { dcon::province_id hq; std::vector land_forces; std::vector land_regiments; - std::array regiment_status; + //std::array regiment_status; std::vector naval_forces; std::vector ships; - std::array ship_status; + //std::array ship_status; std::vector defensive_line; @@ -614,7 +614,7 @@ struct alignas(64) state { army_group * selected_army_group = nullptr; //current ui - game_scene::scene_properties current_scene = game_scene::nation_picker; + game_scene::scene_properties current_scene; std::optional state_selection; map_mode::mode stored_map_mode = map_mode::mode::political; @@ -733,7 +733,7 @@ struct alignas(64) state { dcon::trigger_key commit_trigger_data(std::vector data); dcon::effect_key commit_effect_data(std::vector data); - state() : untrans_key_to_text_sequence(0, text::vector_backed_ci_hash(key_data), text::vector_backed_ci_eq(key_data)), locale_key_to_text_sequence(0, text::vector_backed_ci_hash(key_data), text::vector_backed_ci_eq(key_data)), incoming_commands(1024), new_n_event(1024), new_f_n_event(1024), new_p_event(1024), new_f_p_event(1024), new_requests(256), new_messages(2048), naval_battle_reports(256), land_battle_reports(256) { + state() : untrans_key_to_text_sequence(0, text::vector_backed_ci_hash(key_data), text::vector_backed_ci_eq(key_data)), locale_key_to_text_sequence(0, text::vector_backed_ci_hash(key_data), text::vector_backed_ci_eq(key_data)), current_scene(game_scene::nation_picker()), incoming_commands(1024), new_n_event(1024), new_f_n_event(1024), new_p_event(1024), new_f_p_event(1024), new_requests(256), new_messages(2048), naval_battle_reports(256), land_battle_reports(256) { key_data.push_back(0); }