From d3cf8ec15ccb3ce10172278c764b45ca5e3275ea Mon Sep 17 00:00:00 2001 From: Gawquon Date: Mon, 22 Jul 2024 07:28:22 -0400 Subject: [PATCH] cleanup false ports --- .../Source/Output/outBuildings/outBuildings.cpp | 13 ++++++------- .../Source/V3World/ClayManager/State/SubState.cpp | 4 ++-- .../V3World/EconomyManager/EconomyManager.cpp | 3 ++- .../Source/V3World/EconomyManager/EconomyManager.h | 2 +- EU4ToVic3/Source/V3World/V3World.cpp | 7 ++++--- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/EU4ToVic3/Source/Output/outBuildings/outBuildings.cpp b/EU4ToVic3/Source/Output/outBuildings/outBuildings.cpp index 54b76f204..5176f7ab2 100644 --- a/EU4ToVic3/Source/Output/outBuildings/outBuildings.cpp +++ b/EU4ToVic3/Source/Output/outBuildings/outBuildings.cpp @@ -21,12 +21,12 @@ void outShareholders(std::ostream& output, const V3::Building& building) for (const auto& shareholder: building.getShareholders()) { output << "\t\t\t\tadd_ownership = {\n"; - if (shareholder.type == "national") + if (shareholder.type == "national" || shareholder.type == "national_service") { output << "\t\t\t\t\tcountry = {\n"; output << "\t\t\t\t\t\tcountry = c:" << shareholder.tag << "\n"; output << "\t\t\t\t\t\tlevels = " << shareholder.level << "\n"; - output << "\t\t\t\t\t }\n"; + output << "\t\t\t\t\t}\n"; } if (shareholder.type == "local") { @@ -35,9 +35,8 @@ void outShareholders(std::ostream& output, const V3::Building& building) output << "\t\t\t\t\t\tcountry = c:" << shareholder.tag << "\n"; output << "\t\t\t\t\t\tlevels = " << shareholder.level << "\n"; output << "\t\t\t\t\t\rregion = " << shareholder.state << "\n"; - output << "\t\t\t\t\t }\n"; + output << "\t\t\t\t\t}\n"; } - output << "\t\t\t\t }\n"; if (shareholder.type == "capitalist") { output << "\t\t\t\t\tbuilding = {\n"; @@ -45,7 +44,7 @@ void outShareholders(std::ostream& output, const V3::Building& building) output << "\t\t\t\t\t\tcountry = c:" << shareholder.tag << "\n"; output << "\t\t\t\t\t\tlevels = " << shareholder.level << "\n"; output << "\t\t\t\t\t\rregion = " << shareholder.state << "\n"; - output << "\t\t\t\t\t }\n"; + output << "\t\t\t\t\t}\n"; } if (shareholder.type == "aristocratic") { @@ -54,9 +53,9 @@ void outShareholders(std::ostream& output, const V3::Building& building) output << "\t\t\t\t\t\tcountry = c:" << shareholder.tag << "\n"; output << "\t\t\t\t\t\tlevels = " << shareholder.level << "\n"; output << "\t\t\t\t\t\rregion = " << shareholder.state << "\n"; - output << "\t\t\t\t\t }\n"; + output << "\t\t\t\t\t}\n"; } - output << "\t\t\t\t }\n"; + output << "\t\t\t\t}\n"; } } void outBuilding(std::ostream& output, const V3::Building& building) diff --git a/EU4ToVic3/Source/V3World/ClayManager/State/SubState.cpp b/EU4ToVic3/Source/V3World/ClayManager/State/SubState.cpp index 7bd7124c4..ffde685d1 100644 --- a/EU4ToVic3/Source/V3World/ClayManager/State/SubState.cpp +++ b/EU4ToVic3/Source/V3World/ClayManager/State/SubState.cpp @@ -362,11 +362,11 @@ bool V3::SubState::isBuildingValid(const Building& building, const std::map& traitMap) const { // Government Admin is a special case, we're not building it. - if (building.getName() == "building_government_administration") + if (building.getName() == "building_government_administration" || building.getName() == "building_port") { return false; } - if (const std::set coastalBuildings = {"building_naval_base", "building_port", "building_shipyards"}; + if (const std::set coastalBuildings = {"building_naval_base", "building_shipyards"}; // ports are pre-seeded coastalBuildings.contains(building.getName())) { if (!isCoastal()) diff --git a/EU4ToVic3/Source/V3World/EconomyManager/EconomyManager.cpp b/EU4ToVic3/Source/V3World/EconomyManager/EconomyManager.cpp index 77b28e337..1a5e4aab4 100644 --- a/EU4ToVic3/Source/V3World/EconomyManager/EconomyManager.cpp +++ b/EU4ToVic3/Source/V3World/EconomyManager/EconomyManager.cpp @@ -111,6 +111,7 @@ void V3::EconomyManager::hardcodePorts() const port->setName("building_port"); port->setPMGroups({"pmg_base_building_port"}); port->setLevel(1); + port->addInvestor(1, "national_service", subState->getHomeStateName(), country->getTag()); subState->addBuilding(port); ++counter; @@ -484,7 +485,7 @@ void V3::EconomyManager::investCapital() const const auto& type = buildingGroups.getAncestralCategory(building->getBuildingGroup()).value_or(""); if (type.empty()) { - Log(LogLevel::Warning) << "Unrecognized building group " << type << " when investing."; + Log(LogLevel::Warning) << "Unrecognized building group " << type << " when investing. B: " << building->getName(); } else if (type == "bg_agriculture" || type == "bg_plantation" || type == "bg_ranching") { diff --git a/EU4ToVic3/Source/V3World/EconomyManager/EconomyManager.h b/EU4ToVic3/Source/V3World/EconomyManager/EconomyManager.h index c077f8a6e..790ae0538 100644 --- a/EU4ToVic3/Source/V3World/EconomyManager/EconomyManager.h +++ b/EU4ToVic3/Source/V3World/EconomyManager/EconomyManager.h @@ -50,6 +50,7 @@ class EconomyManager void loadCentralizedStates(const std::map>& countries); void loadMappersAndConfigs(const commonItems::ModFilesystem& modFS, const std::string& filePath = ""); + void establishBureaucracy(const PoliticalManager& politicalManager) const; void hardcodePorts() const; void assignCountryCPBudgets(Configuration::ECONOMY economyType, @@ -61,7 +62,6 @@ class EconomyManager void balanceNationalBudgets() const; void buildBuildings(const std::map& lawsMap) const; void investCapital() const; - void establishBureaucracy(const PoliticalManager& politicalManager) const; void setPMs() const; [[nodiscard]] const auto& getCentralizedCountries() const { return centralizedCountries; } diff --git a/EU4ToVic3/Source/V3World/V3World.cpp b/EU4ToVic3/Source/V3World/V3World.cpp index 8a81a09c1..3b4f18599 100644 --- a/EU4ToVic3/Source/V3World/V3World.cpp +++ b/EU4ToVic3/Source/V3World/V3World.cpp @@ -203,16 +203,17 @@ V3::World::World(const Configuration& configuration, const EU4::World& sourceWor Log(LogLevel::Progress) << "71 %"; economyManager.loadCentralizedStates(politicalManager.getCountries()); Log(LogLevel::Progress) << "72 %"; - economyManager.establishBureaucracy(politicalManager); - Log(LogLevel::Progress) << "73 %"; economyManager.hardcodePorts(); - Log(LogLevel::Progress) << "74 %"; + Log(LogLevel::Progress) << "73 %"; economyManager.assignCountryCPBudgets(configBlock.economy, configBlock.startDate, datingData, politicalManager, configBlock.vn); + Log(LogLevel::Progress) << "74 %"; economyManager.balanceNationalBudgets(); Log(LogLevel::Progress) << "75 %"; economyManager.assignSubStateCPBudgets(configBlock.economy); Log(LogLevel::Progress) << "76 %"; economyManager.buildBuildings(politicalManager.getLawsMap()); + economyManager.investCapital(); + economyManager.establishBureaucracy(politicalManager); economyManager.setPMs(); Log(LogLevel::Info) << "*** Goodbye, Vicky 3, and godspeed. ***";