summaryrefslogtreecommitdiff
path: root/src/company_base.h
diff options
context:
space:
mode:
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;