summaryrefslogtreecommitdiff
path: root/src/company_base.h
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2012-02-11 22:43:39 +0000
committermichi_cc <michi_cc@openttd.org>2012-02-11 22:43:39 +0000
commit0542e26460cf5da6fb4a3486ed9b515721bdb0bd (patch)
tree901640a66314b34ff1bc6a72b67dc288683a79c9 /src/company_base.h
parent1cf2f521ab32279b6770a79e7fb50ef5bbcd4011 (diff)
downloadopenttd-0542e26460cf5da6fb4a3486ed9b515721bdb0bd.tar.xz
(svn r23931) -Change: Scale infrastructure cost of rail tracks by the total number of all tracks and not independently for each rail type.
Diffstat (limited to 'src/company_base.h')
-rw-r--r--src/company_base.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/company_base.h b/src/company_base.h
index 58c0a0ce0..0f9e8ae10 100644
--- a/src/company_base.h
+++ b/src/company_base.h
@@ -35,6 +35,14 @@ struct CompanyInfrastructure {
uint32 water; ///< Count of company owned track bits for canals.
uint32 station; ///< Count of company owned station tiles.
uint32 airport; ///< Count of company owned airports.
+
+ /** Get total sum of all owned track bits. */
+ uint32 GetRailTotal() const
+ {
+ uint32 total = 0;
+ for (RailType rt = RAILTYPE_BEGIN; rt < RAILTYPE_END; rt++) total += this->rail[rt];
+ return total;
+ }
};
typedef Pool<Company, CompanyByte, 1, MAX_COMPANIES> CompanyPool;