* Modify road, rails, and wire connections at a given tile. * @param x X map coordinate. * @param y Y map coordinate. * @param effects Modification collecting object. */
| 580 | * @param effects Modification collecting object. |
| 581 | */ |
| 582 | void Micropolis::fixSingle(int x, int y, ToolEffects *effects) |
| 583 | { |
| 584 | unsigned short adjTile = 0; |
| 585 | |
| 586 | MapTile tile = effects->getMapTile(x, y); |
| 587 | |
| 588 | tile = neutralizeRoad(tile); |
| 589 | |
| 590 | if (tile >= ROADS && tile <= INTERSECTION) { /* Cleanup Road */ |
| 591 | |
| 592 | if (y > 0) { |
| 593 | tile = effects->getMapTile(x, y - 1); |
| 594 | tile = neutralizeRoad(tile); |
| 595 | if ((tile == HRAILROAD || (tile >= ROADBASE && tile <= VROADPOWER)) |
| 596 | && tile != HROADPOWER && tile != VRAILROAD |
| 597 | && tile != ROADBASE) { |
| 598 | adjTile |= 0x0001; |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | if (x < WORLD_W - 1) { |
| 603 | tile = effects->getMapTile(x + 1, y); |
| 604 | tile = neutralizeRoad(tile); |
| 605 | if ((tile == VRAILROAD || (tile >= ROADBASE && tile <= VROADPOWER)) |
| 606 | && tile != VROADPOWER && tile != HRAILROAD |
| 607 | && tile != VBRIDGE) { |
| 608 | adjTile |= 0x0002; |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | if (y < WORLD_H - 1) { |
| 613 | tile = effects->getMapTile(x, y + 1); |
| 614 | tile = neutralizeRoad(tile); |
| 615 | if ((tile == HRAILROAD || (tile >= ROADBASE && tile <= VROADPOWER)) |
| 616 | && tile != HROADPOWER && tile != VRAILROAD |
| 617 | && tile != ROADBASE) { |
| 618 | adjTile |= 0x0004; |
| 619 | } |
| 620 | } |
| 621 | |
| 622 | if (x > 0) { |
| 623 | tile = effects->getMapTile(x - 1, y); |
| 624 | tile = neutralizeRoad(tile); |
| 625 | if ((tile == VRAILROAD || (tile >= ROADBASE && tile <= VROADPOWER)) |
| 626 | && tile != VROADPOWER && tile != HRAILROAD |
| 627 | && tile != VBRIDGE) { |
| 628 | adjTile |= 0x0008; |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | effects->setMapValue(x, y, RoadTable[adjTile] | BULLBIT | BURNBIT); |
| 633 | return; |
| 634 | } |
| 635 | |
| 636 | if (tile >= LHRAIL && tile <= LVRAIL10) { /* Cleanup Rail */ |
| 637 | |
| 638 | if (y > 0) { |
| 639 | tile = effects->getMapTile(x, y - 1); |
nothing calls this directly
no test coverage detected