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

Function write_pretty

plugins/blueprint.cpp:1449–1473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1447}
1448
1449static void write_pretty(ofstream &ofile, const blueprint_options &opts,
1450 const bp_volume &mapdata) {
1451 const string z_key = opts.depth > 0 ? "#<" : "#>";
1452
1453 int16_t absdepth = abs(opts.depth);
1454 for (int16_t z = 0; z < absdepth; ++z) {
1455 const bp_area *area = NULL;
1456 if (mapdata.count(z))
1457 area = &mapdata.at(z);
1458 for (int16_t y = 0; y < opts.height; ++y) {
1459 const bp_row *row = NULL;
1460 if (area && area->count(y))
1461 row = &area->at(y);
1462 for (int16_t x = 0; x < opts.width; ++x) {
1463 const char *tile = NULL;
1464 if (row)
1465 tile = row->at(x);
1466 ofile << (tile ? tile : " ") << ",";
1467 }
1468 ofile << "#" << endl;
1469 }
1470 if (z < absdepth - 1)
1471 ofile << z_key << endl;
1472 }
1473}
1474
1475static string get_modeline(color_ostream &out, const blueprint_options &opts,
1476 const string &mode, const string &phase) {

Callers 1

write_blueprintFunction · 0.85

Calls 1

countMethod · 0.45

Tested by

no test coverage detected