| 792 | } |
| 793 | |
| 794 | static bool paintTileProcessing(MapExtras::Block* block, const df::coord2d& blockPos, const TileType& target) { |
| 795 | df::tiletype source = block->tiletypeAt(blockPos); |
| 796 | df::tile_designation des = block->DesignationAt(blockPos); |
| 797 | |
| 798 | // Stone painting operates on the base layer |
| 799 | if (target.stone_material >= 0) |
| 800 | source = block->baseTiletypeAt(blockPos); |
| 801 | |
| 802 | df::tiletype_shape shape = target.shape; |
| 803 | if (shape == tiletype_shape::NONE) |
| 804 | shape = tileShape(source); |
| 805 | |
| 806 | df::tiletype_material material = target.material; |
| 807 | if (material == tiletype_material::NONE) |
| 808 | material = tileMaterial(source); |
| 809 | |
| 810 | df::tiletype_special special = target.special; |
| 811 | if (special == tiletype_special::NONE) |
| 812 | special = tileSpecial(source); |
| 813 | |
| 814 | df::tiletype_variant variant = target.variant; |
| 815 | /* |
| 816 | * FIXME: variant should be: |
| 817 | * 1. If user variant: |
| 818 | * 2. If user variant \belongs target variants |
| 819 | * 3. use user variant |
| 820 | * 4. Else |
| 821 | * 5. use variant 0 |
| 822 | * 6. If the source variant \belongs target variants |
| 823 | * 7 use source variant |
| 824 | * 8 ElseIf num target shape/material variants > 1 |
| 825 | * 9. pick one randomly |
| 826 | * 10.Else |
| 827 | * 11. use variant 0 |
| 828 | * |
| 829 | * The following variant check has been disabled because it's severely limiting |
| 830 | * the usefullness of the tool. |
| 831 | */ |
| 832 | /* |
| 833 | if (variant == tiletype_variant::NONE) |
| 834 | { |
| 835 | variant = tileVariant(source); |
| 836 | } |
| 837 | */ |
| 838 | // Remove direction from directionless tiles |
| 839 | DFHack::TileDirection direction = tileDirection(source); |
| 840 | if (!(material == tiletype_material::RIVER || shape == tiletype_shape::BROOK_BED || special == tiletype_special::TRACK || (shape == tiletype_shape::WALL && (material == tiletype_material::CONSTRUCTION || special == tiletype_special::SMOOTH)))) |
| 841 | direction.whole = 0; |
| 842 | |
| 843 | df::tiletype type = DFHack::findTileType(shape, material, variant, special, direction); |
| 844 | // hack for empty space |
| 845 | if (shape == tiletype_shape::EMPTY && material == tiletype_material::AIR && variant == tiletype_variant::VAR_1 && special == tiletype_special::NORMAL && direction.whole == 0) |
| 846 | type = tiletype::OpenSpace; |
| 847 | |
| 848 | // make sure it's not invalid |
| 849 | if (type != tiletype::Void) { |
| 850 | if (target.stone_material >= 0) { |
| 851 | if (!block->setStoneAt(blockPos, type, target.stone_material, target.vein_type, true, true)) |
no test coverage detected