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

Function paintAimScreen

plugins/siege-engine.cpp:1110–1164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1108}
1109
1110static void paintAimScreen(df::building_siegeenginest *bld, df::coord view, df::coord2d ltop, df::coord2d size)
1111{
1112 auto engine = find_engine(bld, true);
1113 CHECK_NULL_POINTER(engine);
1114
1115 for (int x = 0; x < size.x; x++)
1116 {
1117 for (int y = 0; y < size.y; y++)
1118 {
1119 df::coord tile_pos = view + df::coord(x,y,0);
1120 if (is_in_range(engine->building_rect, tile_pos))
1121 continue;
1122
1123 Pen cur_tile = Screen::readTile(ltop.x+x, ltop.y+y, true);
1124 if (!cur_tile.valid())
1125 continue;
1126
1127 int color = COLOR_YELLOW;
1128
1129 switch (calcTileStatus(engine, tile_pos))
1130 {
1131 case TARGET_OK:
1132 color = COLOR_GREEN;
1133 break;
1134 case TARGET_RANGE:
1135 color = COLOR_CYAN;
1136 break;
1137 case TARGET_BLOCKED:
1138 color = COLOR_RED;
1139 break;
1140 case TARGET_SEMIBLOCKED:
1141 color = COLOR_BROWN;
1142 break;
1143 }
1144
1145 if (cur_tile.fg && cur_tile.ch != ' ')
1146 {
1147 cur_tile.fg = color;
1148 cur_tile.bg = 0;
1149 }
1150 else
1151 {
1152 cur_tile.fg = 0;
1153 cur_tile.bg = color;
1154 }
1155
1156 cur_tile.bold = engine->onTarget(tile_pos);
1157
1158 if (cur_tile.tile)
1159 cur_tile.tile_mode = Pen::CharColor;
1160
1161 Screen::paintTile(cur_tile, ltop.x+x, ltop.y+y, true);
1162 }
1163 }
1164}
1165
1166/*
1167 * Unit tracking

Callers

nothing calls this directly

Calls 6

find_engineFunction · 0.85
is_in_rangeFunction · 0.85
calcTileStatusFunction · 0.85
paintTileFunction · 0.85
validMethod · 0.80
onTargetMethod · 0.80

Tested by

no test coverage detected