diff --git a/data/configurables/convoy_config.txt b/data/configurables/convoy_config.txt index 79812e01..345dd2a9 100644 --- a/data/configurables/convoy_config.txt +++ b/data/configurables/convoy_config.txt @@ -1,2 +1,8 @@ # TODO: Import this number from the HoI mod instead of setting it here. -world_convoys = 1000 +world_convoys = 2500 +method_weights = { + pm_anchorage = 40 + pm_basic_port = 200 + pm_industrial_port = 400 + pm_modern_port = 800 +} diff --git a/src/hoi4_world/countries/hoi4_countries_converter.cpp b/src/hoi4_world/countries/hoi4_countries_converter.cpp index 63d091eb..644cc067 100644 --- a/src/hoi4_world/countries/hoi4_countries_converter.cpp +++ b/src/hoi4_world/countries/hoi4_countries_converter.cpp @@ -3,6 +3,8 @@ #include #include "external/fmt/include/fmt/format.h" +#include "src/hoi4_world/military/convoy_distributor.h" +#include "src/hoi4_world/military/convoy_distributor_builder.h" #include "src/hoi4_world/military/division_templates_importer.h" #include "src/hoi4_world/military/equipment_variant.h" #include "src/hoi4_world/military/equipment_variants_importer.h" @@ -78,6 +80,8 @@ std::map ConvertCountries(const vic3::World source_world, mappers::ImportLeaderTypeMapper("configurables/leader_type_mappings.txt"); const mappers::CharacterTraitMapper character_trait_mapper = mappers::ImportCharacterTraitMapper("configurables/character_traits.txt"); + ConvoyDistributor convoys = BuildConvoyDistributor("configurables/convoy_config.txt"); + convoys.CalculateStateWeights(source_world); for (const auto& [country_number, source_country]: source_world.GetCountries()) { @@ -97,6 +101,7 @@ std::map ConvertCountries(const vic3::World source_world, world_mapper.culture_graphics_mapper, leader_type_mapper, character_trait_mapper, + convoys, characters, culture_queues, debug); diff --git a/src/hoi4_world/countries/hoi4_countries_converter_tests.cpp b/src/hoi4_world/countries/hoi4_countries_converter_tests.cpp index 82ee465b..08ca2c78 100644 --- a/src/hoi4_world/countries/hoi4_countries_converter_tests.cpp +++ b/src/hoi4_world/countries/hoi4_countries_converter_tests.cpp @@ -54,11 +54,22 @@ TEST(Hoi4worldCountriesCountriesConverter, CountriesAreConverted) {1, source_country_one}, {2, source_country_two}, }, + .states = + { + {1, vic3::State({.id = 1})}, + {2, vic3::State({.id = 2})}, + {3, vic3::State({.id = 3})}, + }, .acquired_technologies = { {1, {"source_technology_one"}}, {2, {"source_technology_two"}}, }, + .buildings = vic3::Buildings({ + {1, {vic3::Building(vic3::BuildingType::Port, 1, 0, 1, std::vector{"pm_port_3"})}}, + {2, {vic3::Building(vic3::BuildingType::Port, 2, 0, 1, std::vector{"pm_port_1"})}}, + {3, {vic3::Building(vic3::BuildingType::Port, 3, 0, 1, std::vector{"pm_port_2"})}}, + }), .culture_definitions = { {"culture_0", vic3::CultureDefinition({"culture_0"}, {}, {}, {})}, @@ -74,8 +85,25 @@ TEST(Hoi4worldCountriesCountriesConverter, CountriesAreConverted) }; const States states{ - .states{}, - .vic3_state_ids_to_hoi4_state_ids{{1, 10}, {2, 20}}, + .states{ + State(10, + { + .owner = "TAG", + .provinces = {10}, + }), + State(20, + { + .owner = "TWO", + .provinces = {20}, + }), + State(30, + { + .owner = "TWO", + .provinces = {30}, + }), + }, + .vic3_state_ids_to_hoi4_state_ids{{1, 10}, {2, 20}, {3, 30}}, + .hoi4_state_ids_to_owner{{10, "TAG"}, {20, "TWO"}, {30, "TWO"}}, }; const vic3::World v3World = vic3::World(options); @@ -148,7 +176,8 @@ TEST(Hoi4worldCountriesCountriesConverter, CountriesAreConverted) .character_ids = {1, 3}, .spy_ids = {4}, .starting_research_slots = 3, - .units = {}})), + .units = {}, + .convoys = 100})), testing::Pair("TWO", Country(CountryOptions{.tag = "TWO", .color = commonItems::Color{std::array{2, 4, 6}}, @@ -163,7 +192,8 @@ TEST(Hoi4worldCountriesCountriesConverter, CountriesAreConverted) .graphics_block = expected_graphics_block_two, .character_ids = {2}, .starting_research_slots = 3, - .units = {}})))); + .units = {}, + .convoys = 11})))); } } // namespace hoi4