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

Function paintScreenDesignated

plugins/dig.cpp:2451–2502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2449}
2450
2451static void paintScreenDesignated() {
2452 TRACE(log).print("entering paintScreenDesignated\n");
2453
2454 if (Screen::inGraphicsMode() || blink(500))
2455 return;
2456
2457 Designations designations;
2458 bool draw_priority = blink(1000);
2459
2460 auto dims = Gui::getDwarfmodeViewDims().map();
2461 for (int y = dims.first.y; y <= dims.second.y; ++y) {
2462 for (int x = dims.first.x; x <= dims.second.x; ++x) {
2463 df::coord map_pos(*window_x + x, *window_y + y, *window_z);
2464
2465 if (!Maps::isValidTilePos(map_pos))
2466 continue;
2467
2468 TRACE(log).print("scanning map tile at ({},{},{}) screen offset ({},{})\n",
2469 map_pos.x, map_pos.y, map_pos.z, x, y);
2470
2471 Screen::Pen cur_tile;
2472 cur_tile.fg = COLOR_DARKGREY;
2473
2474 auto des = designations.get(map_pos);
2475
2476 if (is_designated_for_smoothing(des)) {
2477 if (is_smooth_wall(map_pos))
2478 cur_tile.ch = get_tile_char(map_pos, (char)206, draw_priority); // octothorpe, indicating a fortification designation
2479 else
2480 cur_tile.ch = get_tile_char(map_pos, (char)219, draw_priority); // solid block, indicating a smoothing designation
2481 }
2482 else if (is_designated_for_engraving(des)) {
2483 cur_tile.ch = get_tile_char(map_pos, (char)10, draw_priority); // solid block with a circle on it
2484 }
2485 else if (is_designated_for_track_carving(des)) {
2486 cur_tile.ch = get_tile_char(map_pos, get_track_char(des), draw_priority); // directional track
2487 }
2488 else if (is_designated_for_digging(des)) {
2489 static char empty_char = (char)0x00;
2490 cur_tile.ch = get_tile_char(map_pos, empty_char, draw_priority);
2491 if (cur_tile.ch == empty_char)
2492 continue;
2493 }
2494 else {
2495 TRACE(log).print("skipping tile with no designation\n");
2496 continue;
2497 }
2498
2499 Screen::paintTile(cur_tile, x, y, true);
2500 }
2501 }
2502}
2503
2504DFHACK_PLUGIN_LUA_COMMANDS{
2505 DFHACK_LUA_COMMAND(registerWarmDampTile),

Callers

nothing calls this directly

Calls 13

blinkFunction · 0.85
isValidTilePosFunction · 0.85
get_tile_charFunction · 0.85
get_track_charFunction · 0.85
paintTileFunction · 0.85
mapMethod · 0.80
is_smooth_wallFunction · 0.70
printMethod · 0.45

Tested by

no test coverage detected