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

Function write_minimal

plugins/blueprint.cpp:1419–1447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1417}
1418
1419static void write_minimal(ofstream &ofile, const blueprint_options &opts,
1420 const bp_volume &mapdata) {
1421 if (mapdata.begin() == mapdata.end())
1422 return;
1423
1424 const string z_key = opts.depth > 0 ? "#<" : "#>";
1425
1426 int16_t zprev = 0;
1427 for (auto &area : mapdata) {
1428 for ( ; zprev < area.first; ++zprev)
1429 ofile << z_key << endl;
1430 int16_t yprev = 0;
1431 for (auto &row : area.second) {
1432 for ( ; yprev < row.first; ++yprev)
1433 ofile << endl;
1434 size_t xprev = 0;
1435 auto &tiles = row.second;
1436 size_t rowsize = tiles.size();
1437 for (size_t x = 0; x < rowsize; ++x) {
1438 if (!tiles[x])
1439 continue;
1440 for ( ; xprev < x; ++xprev)
1441 ofile << ",";
1442 ofile << tiles[x];
1443 }
1444 }
1445 ofile << endl;
1446 }
1447}
1448
1449static void write_pretty(ofstream &ofile, const blueprint_options &opts,
1450 const bp_volume &mapdata) {

Callers 1

write_blueprintFunction · 0.85

Calls 3

beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected