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

Function design_draw_points

plugins/design.cpp:253–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253static int design_draw_points(lua_State *L) {
254 bool is_graphics_mode = Screen::inGraphicsMode();
255
256 if (lua_istable(L, -1)) {
257 const char *str;
258 lua_rawgeti(L, -1, 2);
259 str = lua_tostring(L, -1);
260 lua_pop(L, 1);
261
262 lua_rawgeti(L, -1, 1);
263 int n = luaL_len(L, -1);
264 for (int i = 1; i <= n; i++) {
265 lua_rawgeti(L, -1, i);
266 int x, y;
267 lua_getfield(L, -1, "y");
268 y = lua_tointeger(L, -1);
269 lua_getfield(L, -2, "x");
270 x = lua_tointeger(L, -1);
271 lua_pop(L, 3);
272
273 Screen::Pen pen;
274 int highlight_tile = 0;
275 get_pen(&pen, &highlight_tile, x, y, arr, str);
276 df::coord2d pos(x - *window_x, y - *window_y);
277 Screen::paintTile(pen, pos.x, pos.y, true);
278 if (is_graphics_mode && highlight_tile > 0) {
279 Screen::Pen highlight_pen;
280 highlight_pen.tile = highlight_tile;
281 Screen::paintTile(highlight_pen, pos.x, pos.y, true, &df::graphic_viewportst::screentexpos_designation);
282 }
283 }
284 lua_pop(L, 1);
285 }
286
287 return 0;
288}
289
290DFHACK_PLUGIN_LUA_COMMANDS{
291 DFHACK_LUA_COMMAND(design_draw_shape),

Callers

nothing calls this directly

Calls 4

lua_rawgetiFunction · 0.85
lua_getfieldFunction · 0.85
get_penFunction · 0.85
paintTileFunction · 0.85

Tested by

no test coverage detected