Add #5006: Flag to hide rail type from construction.

This commit is contained in:
Peter Nelson
2019-02-05 08:23:25 +00:00
committed by PeterN
parent 4764d1c45e
commit e3b440c9c5
4 changed files with 25 additions and 4 deletions

View File

@@ -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;
}
/**