Merge branch 'develop' into hotkeylabel-enhancements

develop
Myk 2023-02-08 12:37:16 -08:00 committed by GitHub
commit 1787d2435c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 49 additions and 97 deletions

@ -189,8 +189,8 @@ if(NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl
endif()
# set up versioning.
set(DF_VERSION "50.05")
set(DFHACK_RELEASE "alpha3.1")
set(DF_VERSION "50.07")
set(DFHACK_RELEASE "alpha0")
set(DFHACK_PRERELEASE TRUE)
set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 997 B

@ -1138,42 +1138,6 @@
"job" : "MakeWeapon",
"material" : "INORGANIC:SILVER"
},
{
"amount_left" : 1,
"amount_total" : 1,
"frequency" : "Daily",
"id" : 64,
"is_active" : false,
"is_validated" : false,
"item_conditions" :
[
{
"condition" : "AtLeast",
"item_type" : "BAR",
"material" : "INORGANIC:SILVER",
"value" : 20
},
{
"condition" : "AtLeast",
"item_type" : "BAR",
"material" : "COAL",
"value" : 100
},
{
"condition" : "AtMost",
"flags" :
[
"metal"
],
"item_subtype" : "ITEM_WEAPON_CROSSBOW",
"item_type" : "WEAPON",
"value" : 10
}
],
"item_subtype" : "ITEM_WEAPON_CROSSBOW",
"job" : "MakeWeapon",
"material" : "INORGANIC:SILVER"
},
{
"amount_left" : 1,
"amount_total" : 1,
@ -1656,12 +1620,6 @@
"item_type" : "WEAPON",
"material" : "INORGANIC:STEEL",
"value" : 10
},
{
"condition" : "LessThan",
"item_type" : "BAR",
"material" : "INORGANIC:SILVER",
"value" : 5
}
],
"item_subtype" : "ITEM_WEAPON_CROSSBOW",
@ -2357,12 +2315,6 @@
"material" : "INORGANIC:STEEL",
"value" : 30
},
{
"condition" : "LessThan",
"item_type" : "BAR",
"material" : "INORGANIC:SILVER",
"value" : 5
},
{
"condition" : "AtMost",
"flags" :
@ -3068,12 +3020,6 @@
"material" : "INORGANIC:STEEL",
"value" : 30
},
{
"condition" : "LessThan",
"item_type" : "BAR",
"material" : "INORGANIC:SILVER",
"value" : 5
},
{
"condition" : "AtMost",
"flags" :
@ -3856,12 +3802,6 @@
"material" : "INORGANIC:STEEL",
"value" : 30
},
{
"condition" : "LessThan",
"item_type" : "BAR",
"material" : "INORGANIC:SILVER",
"value" : 5
},
{
"condition" : "AtMost",
"flags" :
@ -4734,12 +4674,6 @@
"material" : "INORGANIC:STEEL",
"value" : 30
},
{
"condition" : "LessThan",
"item_type" : "BAR",
"material" : "INORGANIC:SILVER",
"value" : 5
},
{
"condition" : "AtMost",
"flags" :

@ -49,6 +49,8 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `clean`: new hotkey for `spotclean`: Ctrl-C
- `autobutcher`: changed defaults from 5 females / 1 male to 4 females / 2 males so a single unfortunate accident doesn't leave players without a mating pair
- `autobutcher`: now immediately loads races available at game start into the watchlist
- replaced DFHack logo used for the hover hotspot with a crisper image
- `orders`: recipe for silver crossbows removed from ``library/military`` as it is not a vanilla recipe, but is available in ``library/military_include_artifact_materials``
## Documentation
@ -59,6 +61,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- ``widgets.CycleHotkeyLabel``: Added ``key_back`` optional parameter to cycle backwards.
- ``widgets.HotkeyLabel``: Added ``setLabel`` method to allow easily updating the label text without mangling the keyboard shortcut.
- ``widgets.HotkeyLabel``: Added ``setOnActivate`` method to allow easily updating the ``on_activate`` callback.
- ``widgets.FilteredList``: Added ``case_sensitive`` optional paramter to determine if filtering is case sensitive.
## Removed

@ -4968,6 +4968,7 @@ construction that allows filtering the list by subwords of its items.
In addition to passing through all attributes supported by List, it
supports:
:case_sensitive: If true, matching is case sensitive. Defaults to true.
:edit_pen: If specified, used instead of ``cursor_pen`` for the edit field.
:edit_below: If true, the edit field is placed below the list instead of above.
:edit_key: If specified, the edit field is disabled until this key is pressed.

@ -478,7 +478,7 @@ static void OpenPersistent(lua_State *state)
static int DFHACK_MATINFO_TOKEN = 0;
void Lua::Push(lua_State *state, MaterialInfo &info)
void Lua::Push(lua_State *state, const MaterialInfo &info)
{
if (!info.isValid())
{

@ -101,7 +101,7 @@ void DFHack::Lua::Push(lua_State *state, const Units::NoblePosition &pos)
lua_setfield(state, -2, "position");
}
void DFHack::Lua::Push(lua_State *state, df::coord pos)
void DFHack::Lua::Push(lua_State *state, const df::coord &pos)
{
lua_createtable(state, 0, 3);
lua_pushinteger(state, pos.x);
@ -112,7 +112,7 @@ void DFHack::Lua::Push(lua_State *state, df::coord pos)
lua_setfield(state, -2, "z");
}
void DFHack::Lua::Push(lua_State *state, df::coord2d pos)
void DFHack::Lua::Push(lua_State *state, const df::coord2d &pos)
{
lua_createtable(state, 0, 2);
lua_pushinteger(state, pos.x);
@ -191,7 +191,7 @@ void DFHack::Lua::PushInterfaceKeys(lua_State *L,
}
}
int DFHack::Lua::PushPosXYZ(lua_State *state, df::coord pos)
int DFHack::Lua::PushPosXYZ(lua_State *state, const df::coord &pos)
{
if (!pos.isValid())
{
@ -207,7 +207,7 @@ int DFHack::Lua::PushPosXYZ(lua_State *state, df::coord pos)
}
}
int DFHack::Lua::PushPosXY(lua_State *state, df::coord2d pos)
int DFHack::Lua::PushPosXY(lua_State *state, const df::coord2d &pos)
{
if (!pos.isValid())
{

@ -325,10 +325,10 @@ namespace DFHack {namespace Lua {
inline void Push(lua_State *state, const std::string &str) {
lua_pushlstring(state, str.data(), str.size());
}
DFHACK_EXPORT void Push(lua_State *state, df::coord obj);
DFHACK_EXPORT void Push(lua_State *state, df::coord2d obj);
DFHACK_EXPORT void Push(lua_State *state, const df::coord &obj);
DFHACK_EXPORT void Push(lua_State *state, const df::coord2d &obj);
void Push(lua_State *state, const Units::NoblePosition &pos);
DFHACK_EXPORT void Push(lua_State *state, MaterialInfo &info);
DFHACK_EXPORT void Push(lua_State *state, const MaterialInfo &info);
DFHACK_EXPORT void Push(lua_State *state, const Screen::Pen &info);
template<class T> inline void Push(lua_State *state, T *ptr) {
PushDFObject(state, ptr);
@ -361,29 +361,34 @@ namespace DFHack {namespace Lua {
DFHACK_EXPORT void GetVector(lua_State *state, std::vector<std::string> &pvec);
DFHACK_EXPORT int PushPosXYZ(lua_State *state, df::coord pos);
DFHACK_EXPORT int PushPosXY(lua_State *state, df::coord2d pos);
template <typename T_Key, typename T_Value>
inline void TableInsert(lua_State *state, T_Key key, T_Value value)
{
Lua::Push(state, key);
Lua::Push(state, value);
lua_settable(state, -3);
}
DFHACK_EXPORT int PushPosXYZ(lua_State *state, const df::coord &pos);
DFHACK_EXPORT int PushPosXY(lua_State *state, const df::coord2d &pos);
template<typename T_Key, typename T_Value>
void Push(lua_State *L, const std::map<T_Key, T_Value> &pmap) {
lua_createtable(L, 0, pmap.size());
for (auto &entry : pmap)
TableInsert(L, entry.first, entry.second);
for (auto &entry : pmap) {
Lua::Push(L, entry.first);
Lua::Push(L, entry.second);
lua_settable(L, -3);
}
}
template<typename T_Key, typename T_Value>
void Push(lua_State *L, const std::unordered_map<T_Key, T_Value> &pmap) {
lua_createtable(L, 0, pmap.size());
for (auto &entry : pmap)
TableInsert(L, entry.first, entry.second);
for (auto &entry : pmap) {
Lua::Push(L, entry.first);
Lua::Push(L, entry.second);
lua_settable(L, -3);
}
}
template <typename T_Key, typename T_Value>
inline void TableInsert(lua_State *state, const T_Key &key, const T_Value &value) {
Lua::Push(state, key);
Lua::Push(state, value);
lua_settable(state, -3);
}
DFHACK_EXPORT void CheckPen(lua_State *L, Screen::Pen *pen, int index, bool allow_nil = false, bool allow_color = true);

@ -1652,7 +1652,9 @@ end
function List:postComputeFrame(body)
self.page_size = math.max(1, math.floor(body.height / self.row_height))
self.page_top = math.max(1, math.min(#self.choices - self.page_size + 1))
if #self.choices - self.page_size < 0 then
self.page_top = 1
end
update_list_scrollbar(self)
end
@ -1880,6 +1882,7 @@ end
FilteredList = defclass(FilteredList, Widget)
FilteredList.ATTRS {
case_sensitive = true,
edit_below = false,
edit_key = DEFAULT_NIL,
edit_ignore_keys = DEFAULT_NIL,
@ -2040,13 +2043,19 @@ function FilteredList:setFilter(filter, pos)
-- start matches at non-space or non-punctuation. this allows
-- punctuation itself to be matched if that is useful (e.g.
-- filenames or parameter names)
if key ~= '' and
not search_key:match('%f[^%p\x00]'..key) and
if key ~= '' then
if not self.case_sensitive then
search_key = string.lower(search_key)
key = string.lower(key)
end
if not search_key:match('%f[^%p\x00]'..key) and
not search_key:match('%f[^%s\x00]'..key) then
ok = false
break
end
end
end
if ok then
table.insert(choices, v)
cidx[#choices] = i

@ -1 +1 @@
Subproject commit eb58cda0f106c20776c273516f010ce21c45f89d
Subproject commit cd5baf4ea82fead3883368da526ac2b606a6209b

@ -1 +1 @@
Subproject commit 52736994e550247aec6a1fb44eb8bc8b3c53b1b0
Subproject commit 54f5d5f3d3b68b07323e88109b9a44d98abe52b1