* Checks if the source and destination of a subsidy are inside the distance limit. * @param src Source of cargo. * @param dst Destination of cargo. * @return True if they are inside the distance limit. */
| 157 | * @return True if they are inside the distance limit. |
| 158 | */ |
| 159 | static bool CheckSubsidyDistance(Source src, Source dst) |
| 160 | { |
| 161 | TileIndex tile_src = (src.type == SourceType::Town) ? Town::Get(src.ToTownID())->xy : Industry::Get(src.ToIndustryID())->location.tile; |
| 162 | TileIndex tile_dst = (dst.type == SourceType::Town) ? Town::Get(dst.ToTownID())->xy : Industry::Get(dst.ToIndustryID())->location.tile; |
| 163 | |
| 164 | return (DistanceManhattan(tile_src, tile_dst) <= SUBSIDY_MAX_DISTANCE); |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Creates a subsidy with the given parameters. |
no test coverage detected