* See SpiralTileSequence constructor for description. */
| 300 | * See SpiralTileSequence constructor for description. |
| 301 | */ |
| 302 | SpiralTileIterator::SpiralTileIterator(TileIndex center, uint diameter) : |
| 303 | max_radius(diameter / 2), |
| 304 | cur_radius(0), |
| 305 | dir(DIAGDIR_BEGIN) |
| 306 | { |
| 307 | assert(diameter > 0); |
| 308 | |
| 309 | if (diameter % 2 == 1) { |
| 310 | this->extent.fill(1); |
| 311 | this->dir = INVALID_DIAGDIR; // special case for odd diameters, see Increment() |
| 312 | this->position = 0; |
| 313 | |
| 314 | this->x = TileX(center); |
| 315 | this->y = TileY(center); |
| 316 | } else { |
| 317 | this->extent.fill(0); |
| 318 | this->dir = DIAGDIR_BEGIN; |
| 319 | this->InitPosition(); |
| 320 | |
| 321 | /* Start with the west corner of the center 2x2 rect */ |
| 322 | this->x = TileX(center) + 1; |
| 323 | this->y = TileY(center); |
| 324 | } |
| 325 | this->SkipOutsideMap(); |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | * See SpiralTileSequence constructor for description. |
nothing calls this directly
no test coverage detected