MCPcopy Create free account
hub / github.com/DFHack/dfhack / scan_tiles

Method scan_tiles

plugins/3dveins.cpp:715–758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

713}
714
715bool VeinGenerator::scan_tiles()
716{
717 for (int x = 0; x < size.x; x++)
718 {
719 for (int y = 0; y < size.y; y++)
720 {
721 df::coord2d column(x,y);
722
723 int top = findTopBlock(map, x, y);
724
725 // First find where layers start and end
726 for (int z = top; z >= 0; z--)
727 {
728 Block *b = map.BlockAt(df::coord(x,y,z));
729 if (!b || !b->is_valid())
730 continue;
731
732 if (!scan_layer_depth(b, column, z))
733 return false;
734 }
735
736 if (!adjust_layer_depth(column))
737 return false;
738
739 // Collect tile data
740 for (int z = top; z >= 0; z--)
741 {
742 Block *b = map.BlockAt(df::coord(x,y,z));
743 if (!b || !b->is_valid())
744 continue;
745
746 if (!scan_block_tiles(b, column, z))
747 return false;
748
749 map.discardBlock(b);
750 }
751
752 // Discard this column of parsed blocks
753 map.trash();
754 }
755 }
756
757 return true;
758}
759
760bool VeinGenerator::scan_layer_depth(Block *b, df::coord2d column, int z)
761{

Callers 1

cmd_3dveinsFunction · 0.80

Calls 3

findTopBlockFunction · 0.85
BlockAtMethod · 0.80
discardBlockMethod · 0.80

Tested by

no test coverage detected