* Get the calendar date of the earliest town-buildable road type. * @return introduction date of earliest road type, or INT32_MAX if none available. */
| 993 | * @return introduction date of earliest road type, or INT32_MAX if none available. |
| 994 | */ |
| 995 | static TimerGameCalendar::Date GetTownRoadTypeFirstIntroductionDate() |
| 996 | { |
| 997 | const RoadTypeInfo *best = nullptr; |
| 998 | for (RoadType rt : GetMaskForRoadTramType(RTT_ROAD)) { |
| 999 | const RoadTypeInfo *rti = GetRoadTypeInfo(rt); |
| 1000 | |
| 1001 | if (!rti->flags.Test(RoadTypeFlag::TownBuild)) continue; // Town can't build this road type. |
| 1002 | |
| 1003 | if (best != nullptr && rti->introduction_date >= best->introduction_date) continue; |
| 1004 | best = rti; |
| 1005 | } |
| 1006 | |
| 1007 | if (best == nullptr) return TimerGameCalendar::Date(INT32_MAX); |
| 1008 | return best->introduction_date; |
| 1009 | } |
| 1010 | |
| 1011 | /** |
| 1012 | * Check if towns are able to build road. |
no test coverage detected