From d41ff4e8368d66a6cb2fb0373cd01e97131aa909 Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 1 Jun 2017 16:17:59 -0400 Subject: [PATCH] Implement map parameters for Lua paintString() and fillRect(), update docs --- docs/Lua API.rst | 6 +++--- library/LuaApi.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/Lua API.rst b/docs/Lua API.rst index 1c08407ae..cd2379c48 100644 --- a/docs/Lua API.rst +++ b/docs/Lua API.rst @@ -1640,19 +1640,19 @@ Basic painting functions: Returns *false* if coordinates out of bounds, or other error. -* ``dfhack.screen.readTile(x,y)`` +* ``dfhack.screen.readTile(x,y[,map])`` Retrieves the contents of the specified tile from the screen buffers. Returns a pen object, or *nil* if invalid or TrueType. -* ``dfhack.screen.paintString(pen,x,y,text)`` +* ``dfhack.screen.paintString(pen,x,y,text[,map])`` Paints the string starting at *x,y*. Uses the string characters in sequence to override the ``ch`` field of pen. Returns *true* if painting at least one character succeeded. -* ``dfhack.screen.fillRect(pen,x1,y1,x2,y2)`` +* ``dfhack.screen.fillRect(pen,x1,y1,x2,y2[,map])`` Fills the rectangle specified by the coordinates with the given pen. Returns *true* if painting at least one character succeeded. diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 09e96780c..f5c2d8363 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -2087,7 +2087,8 @@ static int screen_paintString(lua_State *L) int x = luaL_checkint(L, 2); int y = luaL_checkint(L, 3); const char *text = luaL_checkstring(L, 4); - lua_pushboolean(L, Screen::paintString(pen, x, y, text)); + bool map = lua_toboolean(L, 5); + lua_pushboolean(L, Screen::paintString(pen, x, y, text, map)); return 1; } @@ -2099,7 +2100,8 @@ static int screen_fillRect(lua_State *L) int y1 = luaL_checkint(L, 3); int x2 = luaL_checkint(L, 4); int y2 = luaL_checkint(L, 5); - lua_pushboolean(L, Screen::fillRect(pen, x1, y1, x2, y2)); + bool map = lua_toboolean(L, 6); + lua_pushboolean(L, Screen::fillRect(pen, x1, y1, x2, y2, map)); return 1; }