Merge branch 'bplan_itemselection' of https://github.com/TaxiService/dfhack into bplan_itemselection

develop
Taxi Service 2023-04-04 18:27:15 +02:00
commit eda88a87ef
13 changed files with 51 additions and 18 deletions

@ -20,11 +20,11 @@ repos:
args: ['--fix=lf']
- id: trailing-whitespace
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.21.0
rev: 0.22.0
hooks:
- id: check-github-workflows
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.4.2
rev: v1.5.1
hooks:
- id: forbid-tabs
exclude_types:

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

@ -42,13 +42,14 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Misc Improvements
- `buildingplan`: items in the item selection dialog should now use the same item quality symbols as the base game
- `buildingplan`: rearranged elements of ``itemselection`` interface
-@ `buildingplan`: rearranged elements of ``itemselection`` interface
## Documentation
## API
## Lua
- added two new window borders: ``gui.BOLD_FRAME`` for accented elements and ``gui.INTERIOR_MEDIUM_FRAME`` for a signature-less frame that's thicker than the existing ``gui.INTERIOR_FRAME``
## Removed

@ -4352,11 +4352,22 @@ There are the following predefined frame style tables:
A frame suitable for overlay widget panels.
* ``BOLD_FRAME``
A frame suitable for a non-draggable panel meant to capture the user's focus,
like an important notification, confirmation dialog or error message.
* ``INTERIOR_FRAME``
A frame suitable for light interior accent elements. This frame does *not* have
a visible ``DFHack`` signature on it, so it must not be used as the most external
frame for a DFHack-owned UI.
A frame suitable for light interior accent elements. This frame does *not*
have a visible ``DFHack`` signature on it, so it must not be used as the most
external frame for a DFHack-owned UI.
* ``INTERIOR_MEDIUM_FRAME``
A copy of ``MEDIUM_FRAME`` that lacks the ``DFHack`` signature. Suitable for
panels that are part of a larger widget cluster. Must *not* be used as the
most external frame for a DFHack-owned UI.
gui.widgets
===========

@ -1718,6 +1718,7 @@ static const LuaWrapper::FunctionReg dfhack_textures_module[] = {
WRAPM(Textures, getControlPanelTexposStart),
WRAPM(Textures, getThinBordersTexposStart),
WRAPM(Textures, getMediumBordersTexposStart),
WRAPM(Textures, getBoldBordersTexposStart),
WRAPM(Textures, getPanelBordersTexposStart),
WRAPM(Textures, getWindowBordersTexposStart),
{ NULL, NULL }

@ -56,6 +56,7 @@ DFHACK_EXPORT long getControlPanelTexposStart();
*/
DFHACK_EXPORT long getThinBordersTexposStart();
DFHACK_EXPORT long getMediumBordersTexposStart();
DFHACK_EXPORT long getBoldBordersTexposStart();
DFHACK_EXPORT long getPanelBordersTexposStart();
DFHACK_EXPORT long getWindowBordersTexposStart();

@ -916,8 +916,11 @@ end
WINDOW_FRAME = make_frame('Window', true)
PANEL_FRAME = make_frame('Panel', false)
MEDIUM_FRAME = make_frame('Medium', false)
BOLD_FRAME = make_frame('Bold', true)
INTERIOR_FRAME = make_frame('Thin', false)
INTERIOR_FRAME.signature_pen = false
INTERIOR_MEDIUM_FRAME = copyall(MEDIUM_FRAME)
INTERIOR_MEDIUM_FRAME.signature_pen = false
-- for compatibility with pre-steam code
GREY_LINE_FRAME = WINDOW_FRAME

@ -720,13 +720,14 @@ df::coord Items::getPosition(df::item *item)
return item->pos;
}
// These '\xFF' chars refer to quality markers from curses.png, namely: 250 (≡), 15 (☼), 174 («) and 175 (»).
static const char MARKER_EXCEPTIONAL = '\xF0';
static const char MARKER_MASTERWORK = '\x0F';
static const char MARKER_IMPROVED_LEFT = '\xAE';
static const char MARKER_IMPROVED_RIGHT = '\xAF';
static char quality_table[] = { 0, '-', '+', '*', MARKER_EXCEPTIONAL, MARKER_MASTERWORK };
static const char quality_table[] = {
'\0', // (base)
'-', // well-crafted
'+', // finely-crafted
'*', // superior quality
'\xF0', // (≡) exceptional
'\x0F' // (☼) masterful
};
static void addQuality(std::string &tmp, int quality)
{
@ -831,7 +832,7 @@ std::string Items::getDescription(df::item *item, int type, bool decorate)
addQuality(tmp, item->getQuality());
if (item->isImproved()) {
tmp = MARKER_IMPROVED_LEFT + tmp + MARKER_IMPROVED_RIGHT;
tmp = '\xAE' + tmp + '\xAF'; // («) + tmp + (»)
addQuality(tmp, item->getImprovementQuality());
}
}

@ -26,6 +26,7 @@ static long g_on_off_texpos_start = -1;
static long g_control_panel_texpos_start = -1;
static long g_thin_borders_texpos_start = -1;
static long g_medium_borders_texpos_start = -1;
static long g_bold_borders_texpos_start = -1;
static long g_panel_borders_texpos_start = -1;
static long g_window_borders_texpos_start = -1;
@ -134,6 +135,8 @@ void Textures::init(color_ostream &out) {
&g_thin_borders_texpos_start);
g_num_dfhack_textures += load_textures(out, "hack/data/art/border-medium.png",
&g_medium_borders_texpos_start);
g_num_dfhack_textures += load_textures(out, "hack/data/art/border-bold.png",
&g_bold_borders_texpos_start);
g_num_dfhack_textures += load_textures(out, "hack/data/art/border-panel.png",
&g_panel_borders_texpos_start);
g_num_dfhack_textures += load_textures(out, "hack/data/art/border-window.png",
@ -202,6 +205,10 @@ long Textures::getMediumBordersTexposStart() {
return g_medium_borders_texpos_start;
}
long Textures::getBoldBordersTexposStart() {
return g_bold_borders_texpos_start;
}
long Textures::getPanelBordersTexposStart() {
return g_panel_borders_texpos_start;
}

@ -1 +1 @@
Subproject commit 739d1786723bbe912f448064c5705092a7936cc6
Subproject commit d7f07e54b4ea7832b226f8d8678906c9c366918a

@ -103,6 +103,14 @@ function get_desc(filter)
desc = 'Mechanism'
elseif desc == 'Wood' then
desc = 'Log'
elseif desc == 'Any weapon' then
desc = 'Weapon'
elseif desc == 'Any spike' then
desc = 'Spike'
elseif desc == 'Ballistapart' then
desc = 'Ballista part'
elseif desc == 'Catapultpart' then
desc = 'Catapult part'
end
return desc

@ -19,8 +19,8 @@ function reload_pens()
local tb_texpos = dfhack.textures.getThinBordersTexposStart()
VERT_TOP_PEN = to_pen{tile=tp(tb_texpos, 10), ch=194, fg=COLOR_GREY, bg=COLOR_BLACK}
VERT_MID_PEN = to_pen{tile=tp(tb_texpos, 4), ch=192, fg=COLOR_GREY, bg=COLOR_BLACK}
VERT_BOT_PEN = to_pen{tile=tp(tb_texpos, 11), ch=179, fg=COLOR_GREY, bg=COLOR_BLACK}
VERT_MID_PEN = to_pen{tile=tp(tb_texpos, 4), ch=179, fg=COLOR_GREY, bg=COLOR_BLACK}
VERT_BOT_PEN = to_pen{tile=tp(tb_texpos, 11), ch=193, fg=COLOR_GREY, bg=COLOR_BLACK}
local cp_texpos = dfhack.textures.getControlPanelTexposStart()
BUTTON_START_PEN = to_pen{tile=tp(cp_texpos, 13), ch='[', fg=COLOR_YELLOW}

@ -1 +1 @@
Subproject commit d2dad272e4b24c043ca62f843511c763fb1f67b5
Subproject commit 53f0aedf9f7df33a4f79246ba46de02794619d09