* Helper to get list of tiles that will cover an industry's production or acceptance. * @param i Industry in question * @param radius Catchment radius to test * @param bta BitmapTileArea to fill */
| 69 | * @param bta BitmapTileArea to fill |
| 70 | */ |
| 71 | static void FillIndustryCatchment(const Industry *i, SQInteger radius, BitmapTileArea &bta) |
| 72 | { |
| 73 | for (TileIndex cur_tile : i->location) { |
| 74 | if (!::IsTileType(cur_tile, MP_INDUSTRY) || ::GetIndustryIndex(cur_tile) != i->index) continue; |
| 75 | |
| 76 | int tx = TileX(cur_tile); |
| 77 | int ty = TileY(cur_tile); |
| 78 | for (int y = -radius; y <= radius; y++) { |
| 79 | if (ty + y < 0 || ty + y > (int)Map::MaxY()) continue; |
| 80 | for (int x = -radius; x <= radius; x++) { |
| 81 | if (tx + x < 0 || tx + x > (int)Map::MaxX()) continue; |
| 82 | TileIndex tile = TileXY(tx + x, ty + y); |
| 83 | if (!IsValidTile(tile)) continue; |
| 84 | if (::IsTileType(tile, MP_INDUSTRY) && ::GetIndustryIndex(tile) == i->index) continue; |
| 85 | bta.SetTile(tile); |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | ScriptTileList_IndustryAccepting::ScriptTileList_IndustryAccepting(IndustryID industry_id, SQInteger radius) |
| 92 | { |
no test coverage detected