Skip to content

Commit

Permalink
add investor fxn
Browse files Browse the repository at this point in the history
  • Loading branch information
gawquon committed Jul 22, 2024
1 parent aaa2dbc commit ea9c3df
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions EU4ToVic3/Source/V3World/EconomyManager/Building/Building.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,8 @@ void V3::Building::registerKeys(const std::map<std::string, int>& costTiers)
});
registerRegex(commonItems::catchallRegex, commonItems::ignoreItem);
}

void V3::Building::addInvestor(const int theLevel, const std::string& type, const std::string& theState, const std::string& theNation)
{
shareholders.push_back({type, theNation, theState, theLevel});
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Building: commonItems::parser
void setWeight(const double theWeight) { weight = theWeight; }
void addPM(const std::string& pm) { PMs.emplace(pm); }
void setPMGroups(const std::set<std::string>& pmgs) { PMGroups = pmgs; }
void addInvestor(const int theLevel, const std::string& type, const std::string& theState, const std::string& theNation);

[[nodiscard]] const auto& getName() const { return name; }
[[nodiscard]] const auto& getBuildingGroup() const { return buildingGroup; }
Expand Down
11 changes: 7 additions & 4 deletions EU4ToVic3/Source/V3World/EconomyManager/EconomyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,20 +487,23 @@ void V3::EconomyManager::investCapital() const
}
else if (type == "bg_agriculture" || type == "bg_plantation" || type == "bg_ranching") // All Aristocrats
{
building.addInvestor(building->getLevel(), "aristocratic", country->getTag());
building->addInvestor(building->getLevel(), "aristocratic", subState->getHomeStateName(), country->getTag());
}
else if (type == "bg_mining" || type == "bg_logging" || type == "bg_whaling" || type == "bg_fishing" ||
type == "bg_urban_facilities ") // Resource extraction and art is split between the middle class and the upper classes
{
building.addInvestor(building->getLevel(), "local", country->getTag()); // Industry is split between the middle, capitalists and the state
building->addInvestor(building->getLevel(),
"local",
subState->getHomeStateName(),
country->getTag()); // Industry is split between the middle, capitalists and the state
}
else if (type == "bg_manufacturing")
{
building.addInvestor(building->getLevel(), "capitalist", country->getTag());
building->addInvestor(building->getLevel(), "capitalist", subState->getHomeStateName(), country->getTag());
}
else // services are owned by the state
{
building.addInvestor(building->getLevel(), "national_service", country->getTag());
building->addInvestor(building->getLevel(), "national_service", subState->getHomeStateName(), country->getTag());
}
}
}
Expand Down

0 comments on commit ea9c3df

Please sign in to comment.