Skip to content

Commit

Permalink
cleanup false ports
Browse files Browse the repository at this point in the history
  • Loading branch information
gawquon committed Jul 22, 2024
1 parent 26c0132 commit d3cf8ec
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
13 changes: 6 additions & 7 deletions EU4ToVic3/Source/Output/outBuildings/outBuildings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
Expand All @@ -35,17 +35,16 @@ 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";
output << "\t\t\t\t\t\ttype = building_financial_district\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\rregion = " << shareholder.state << "\n";
output << "\t\t\t\t\t }\n";
output << "\t\t\t\t\t}\n";
}
if (shareholder.type == "aristocratic")
{
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions EU4ToVic3/Source/V3World/ClayManager/State/SubState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ bool V3::SubState::isBuildingValid(const Building& building,
const std::map<std::string, StateModifier>& 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<std::string> coastalBuildings = {"building_naval_base", "building_port", "building_shipyards"};
if (const std::set<std::string> coastalBuildings = {"building_naval_base", "building_shipyards"}; // ports are pre-seeded
coastalBuildings.contains(building.getName()))
{
if (!isCoastal())
Expand Down
3 changes: 2 additions & 1 deletion EU4ToVic3/Source/V3World/EconomyManager/EconomyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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")
{
Expand Down
2 changes: 1 addition & 1 deletion EU4ToVic3/Source/V3World/EconomyManager/EconomyManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class EconomyManager
void loadCentralizedStates(const std::map<std::string, std::shared_ptr<Country>>& 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,
Expand All @@ -61,7 +62,6 @@ class EconomyManager
void balanceNationalBudgets() const;
void buildBuildings(const std::map<std::string, Law>& lawsMap) const;
void investCapital() const;
void establishBureaucracy(const PoliticalManager& politicalManager) const;
void setPMs() const;

[[nodiscard]] const auto& getCentralizedCountries() const { return centralizedCountries; }
Expand Down
7 changes: 4 additions & 3 deletions EU4ToVic3/Source/V3World/V3World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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. ***";
Expand Down

0 comments on commit d3cf8ec

Please sign in to comment.