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

Function tilesieve

plugins/devel/tilesieve.cpp:51–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49};
50
51command_result tilesieve(color_ostream &out, std::vector<std::string> & params)
52{
53 if (!Maps::IsValid())
54 {
55 out.printerr("Map is not available!\n");
56 return CR_FAILURE;
57 }
58 out.print("Scanning.\n");
59 std::set <df::tiletype> seen;
60 for (auto iter = world->map.map_blocks.begin(); iter != world->map.map_blocks.end(); iter++)
61 {
62 df::map_block *block = *iter;
63 df::tiletype tt;
64 // for each tile in block
65 for (uint32_t x = 0; x < 16; x++) for (uint32_t y = 0; y < 16; y++)
66 {
67 tt = block->tiletype[x][y];
68 const char * name = tileName(tt);
69 if(tileShape(tt) != tiletype_shape::NONE )
70 continue;
71 if(name && strlen(name) != 0)
72 continue;
73 if(seen.count(tt))
74 continue;
75 seen.insert(tt);
76 out.print("Found tile {} @ {} {} {}\n", ENUM_AS_STR(tt), block->map_pos.x + x, block->map_pos.y + y, block->map_pos.z);
77 }
78 }
79 return CR_OK;
80}

Callers

nothing calls this directly

Calls 7

tileNameFunction · 0.85
tileShapeFunction · 0.85
printMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
countMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected