allow tile in Label tokens to be either pen or id

develop
Myk Taylor 2023-01-31 23:54:27 -08:00
parent d6a4b1d37a
commit e442e23589
No known key found for this signature in database
3 changed files with 6 additions and 2 deletions

@ -68,6 +68,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `helpdb`: changed from auto-refreshing every 60 seconds to only refreshing on explicit call to ``helpdb.refresh()``. docs very rarely change during a play session, and the automatic database refreshes were slowing down the startup of `gui/launcher`
- ``widgets.Label``: ``label.scroll()`` now understands ``home`` and ``end`` keywords for scrolling to the top or bottom
- ``dfhack.units.getCitizens()``: gets a list of citizens
- ``Label``: token ``tile`` properties can now be either pens or numeric texture ids
## Removed
- `autohauler`: no plans to port to v50, as it just doesn't make sense with the new work detail system

@ -4658,7 +4658,8 @@ containing newlines, or a table with the following possible fields:
* ``token.tile = pen``
Specifies a pen to paint as one tile before the main part of the token.
Specifies a pen or texture index to paint as one tile before the main part of
the token.
* ``token.width = ...``

@ -1110,7 +1110,9 @@ function render_text(obj,dc,x0,y0,pen,dpen,disabled)
if token.tile then
x = x + 1
if dc then
dc:tile(nil, token.tile)
local tile_pen = tonumber(token.tile) and
to_pen{tile=token.tile} or token.tile
dc:char(nil, token.tile)
if token.width then
dc:advance(token.width-1)
end