summaryrefslogtreecommitdiff
path: root/src/rail.cpp
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2019-02-05 08:23:25 +0000
committerPeterN <peter@fuzzle.org>2019-02-06 07:40:55 +0000
commite3b440c9c50b39092a2f887dba9370b21369f2cb (patch)
tree2c91e502fdcaa94012a30c69ec3d565c560601d2 /src/rail.cpp
parent4764d1c45e7d82bc35f6fcb25012f5cfe545ce6c (diff)
downloadopenttd-e3b440c9c50b39092a2f887dba9370b21369f2cb.tar.xz
Add #5006: Flag to hide rail type from construction.
Diffstat (limited to 'src/rail.cpp')
-rw-r--r--src/rail.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rail.cpp b/src/rail.cpp
index 1664f78e9..8bd7aa518 100644
--- a/src/rail.cpp
+++ b/src/rail.cpp
@@ -180,14 +180,24 @@ RailType GetTileRailType(TileIndex tile)
}
/**
- * Finds out if a company has a certain railtype available
+ * Finds out if a company has a certain buildable railtype available.
* @param company the company in question
* @param railtype requested RailType
* @return true if company has requested RailType available
*/
bool HasRailtypeAvail(const CompanyID company, const RailType railtype)
{
- return HasBit(Company::Get(company)->avail_railtypes, railtype);
+ return !HasBit(_railtypes_hidden_mask, railtype) && HasBit(Company::Get(company)->avail_railtypes, railtype);
+}
+
+/**
+ * Test if any buildable railtype is available for a company.
+ * @param company the company in question
+ * @return true if company has any RailTypes available
+ */
+bool HasAnyRailtypesAvail(const CompanyID company)
+{
+ return (Company::Get(company)->avail_railtypes & ~_railtypes_hidden_mask) != 0;
}
/**