Merge branch 'master' into jgrpp
# Conflicts: # src/company_cmd.cpp # src/console_cmds.cpp # src/linkgraph/linkgraph_gui.cpp # src/screenshot.cpp # src/settings_gui.cp
This commit is contained in:
@@ -108,6 +108,8 @@ Prices _price;
|
||||
Money _additional_cash_required;
|
||||
static PriceMultipliers _price_base_multiplier;
|
||||
|
||||
extern int GetAmountOwnedBy(const Company *c, Owner owner);
|
||||
|
||||
/**
|
||||
* Calculate the value of the company. That is the value of all
|
||||
* assets (vehicles, stations, shares) and money minus the loan,
|
||||
@@ -122,18 +124,12 @@ Money CalculateCompanyValue(const Company *c, bool including_loan)
|
||||
Money owned_shares_value = 0;
|
||||
|
||||
for (const Company *co : Company::Iterate()) {
|
||||
uint8 shares_owned = 0;
|
||||
int shares_owned = GetAmountOwnedBy(co, c->index);
|
||||
|
||||
for (uint8 i = 0; i < 4; i++) {
|
||||
if (co->share_owners[i] == c->index) {
|
||||
shares_owned++;
|
||||
}
|
||||
}
|
||||
|
||||
owned_shares_value += (CalculateCompanyValueExcludingShares(co) / 4) * shares_owned;
|
||||
if (shares_owned > 0) owned_shares_value += (CalculateCompanyValueExcludingShares(co) / 4) * shares_owned;
|
||||
}
|
||||
|
||||
return std::max<Money>(owned_shares_value + CalculateCompanyValueExcludingShares(c), 1);
|
||||
return owned_shares_value + CalculateCompanyValueExcludingShares(c);
|
||||
}
|
||||
|
||||
Money CalculateCompanyValueExcludingShares(const Company *c, bool including_loan)
|
||||
@@ -2433,8 +2429,6 @@ static void DoAcquireCompany(Company *c)
|
||||
CheckCaches(true, nullptr, CHECK_CACHE_ALL | CHECK_CACHE_EMIT_LOG);
|
||||
}
|
||||
|
||||
extern int GetAmountOwnedBy(const Company *c, Owner owner);
|
||||
|
||||
/**
|
||||
* Acquire shares in an opposing company.
|
||||
* @param tile unused
|
||||
|
Reference in New Issue
Block a user