From 897e78b174d62d5782317b1a6ebc0e1c0fab4749 Mon Sep 17 00:00:00 2001 From: ymber Date: Wed, 1 Apr 2020 15:09:51 +0100 Subject: [PATCH 01/11] Activate autodump in default config --- dfhack.init-example | 1 + 1 file changed, 1 insertion(+) diff --git a/dfhack.init-example b/dfhack.init-example index d8cf832c7..0fd445fff 100644 --- a/dfhack.init-example +++ b/dfhack.init-example @@ -245,6 +245,7 @@ enable \ dwarfmonitor \ mousequery \ autogems \ + autodump \ automelt \ autotrade \ buildingplan \ From 36df6eac8b649f7787c54d95c93b42280a7f6d81 Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 15 Apr 2020 01:15:09 -0400 Subject: [PATCH 02/11] Restrict status badge to push events only --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a0499a333..e4bfefb38 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # DFHack Readme -[![Build Status](https://github.com/DFHack/dfhack/workflows/Build/badge.svg)](https://github.com/DFHack/dfhack/actions?query=workflow%3ABuild) +[![Build Status](https://github.com/DFHack/dfhack/workflows/Build/badge.svg?event=push)](https://github.com/DFHack/dfhack/actions?query=workflow%3ABuild) [![Documentation Status](https://readthedocs.org/projects/dfhack/badge)](https://dfhack.readthedocs.org) [![License](https://img.shields.io/badge/license-ZLib-blue.svg)](https://en.wikipedia.org/wiki/Zlib_License) From b5c6fd26e2632286a8d9dc8a4fb3cdea33f10be6 Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 15 Apr 2020 17:33:58 -0400 Subject: [PATCH 03/11] Update changelog (#1531) --- docs/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index 11734d9f7..47f891cb5 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -45,6 +45,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - `tweak` embark-profile-name: fixed handling of the native shift+space key ## Misc Improvements +- ``dfhack.init-example``: enabled `autodump` - `manipulator`: added intrigue to displayed skills - `search`: added support for the fortress mode justice screen From 253b15aeb98581b7cc61013be88db464f3c5a3d7 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Wed, 15 Apr 2020 19:03:40 -0500 Subject: [PATCH 04/11] update structures --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index f185d0b22..96a8df43d 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit f185d0b22acb1daf36b3a017f7a30b48994ee42c +Subproject commit 96a8df43d1c4508800c209701ce39ca972579e3b From 8427f518c941f8e5734e98f2ff56648522f1281b Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Wed, 15 Apr 2020 20:05:15 -0500 Subject: [PATCH 05/11] match capitalization changes I made to df-structures in specific_ref --- library/modules/Items.cpp | 2 +- library/modules/Job.cpp | 4 ++-- plugins/orders.cpp | 8 ++++---- plugins/stocks.cpp | 10 +++++----- plugins/workflow.cpp | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/library/modules/Items.cpp b/library/modules/Items.cpp index 4939aa9dd..4b6010718 100644 --- a/library/modules/Items.cpp +++ b/library/modules/Items.cpp @@ -658,7 +658,7 @@ df::coord Items::getPosition(df::item *item) switch (ref->type) { case specific_ref_type::VERMIN_ESCAPED_PET: - return ref->data.VERMIN_ESCAPED_PET->pos; + return ref->data.vermin->pos; default: break; diff --git a/library/modules/Job.cpp b/library/modules/Job.cpp index d0487941f..0aa01af95 100644 --- a/library/modules/Job.cpp +++ b/library/modules/Job.cpp @@ -311,7 +311,7 @@ void DFHack::Job::disconnectJobItem(df::job *job, df::job_item_ref *ref) { auto ref = item->specific_refs[refIndex]; if (ref->type == df::specific_ref_type::JOB) { - if (ref->data.JOB == job) { + if (ref->data.job == job) { vector_erase_at(item->specific_refs, refIndex); delete ref; } else { @@ -579,7 +579,7 @@ bool DFHack::Job::attachJobItem(df::job *job, df::item *item, auto item_link = new df::specific_ref(); item_link->type = specific_ref_type::JOB; - item_link->data.JOB = job; + item_link->data.job = job; item->specific_refs.push_back(item_link); auto job_link = new df::job_item_ref(); diff --git a/plugins/orders.cpp b/plugins/orders.cpp index f600b0cd0..6c6888c0e 100644 --- a/plugins/orders.cpp +++ b/plugins/orders.cpp @@ -798,13 +798,13 @@ static command_result orders_clear_command(color_ostream & out) { delete condition; } - if (order->anon_1) + if (order->items) { - for (auto anon_1 : *order->anon_1) + for (auto item : *order->items) { - delete anon_1; + delete item; } - delete order->anon_1; + delete order->items; } delete order; diff --git a/plugins/stocks.cpp b/plugins/stocks.cpp index d9ec97c0d..af49dcb2a 100644 --- a/plugins/stocks.cpp +++ b/plugins/stocks.cpp @@ -179,8 +179,8 @@ static map items_in_cages; static df::job *get_item_job(df::item *item) { auto ref = Items::getSpecificRef(item, specific_ref_type::JOB); - if (ref && ref->data.JOB) - return ref->data.JOB; + if (ref && ref->data.job) + return ref->data.job; return nullptr; } @@ -1008,12 +1008,12 @@ private: if (item->flags.bits.in_job) { auto ref = Items::getSpecificRef(item, specific_ref_type::JOB); - if (ref && ref->data.JOB) + if (ref && ref->data.job) { - if (ref->data.JOB->job_type == job_type::Eat || ref->data.JOB->job_type == job_type::Drink) + if (ref->data.job->job_type == job_type::Eat || ref->data.job->job_type == job_type::Drink) return pos; - auto unit = Job::getWorker(ref->data.JOB); + auto unit = Job::getWorker(ref->data.job); if (unit) return unit->pos; } diff --git a/plugins/workflow.cpp b/plugins/workflow.cpp index 3e31d14ab..600a8bef1 100644 --- a/plugins/workflow.cpp +++ b/plugins/workflow.cpp @@ -1151,10 +1151,10 @@ static bool itemInRealJob(df::item *item) return false; auto ref = Items::getSpecificRef(item, specific_ref_type::JOB); - if (!ref || !ref->data.JOB) + if (!ref || !ref->data.job) return true; - return ENUM_ATTR(job_type, type, ref->data.JOB->job_type) + return ENUM_ATTR(job_type, type, ref->data.job->job_type) != job_type_class::Hauling; } From c8ff8d0d8efa7a7c69658a30d18255a73c2955c8 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Fri, 17 Apr 2020 11:52:16 -0500 Subject: [PATCH 06/11] update scripts and structures --- library/xml | 2 +- scripts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/xml b/library/xml index 96a8df43d..816497911 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 96a8df43d1c4508800c209701ce39ca972579e3b +Subproject commit 81649791116754a789aae85222797c4df3945b08 diff --git a/scripts b/scripts index b3ce8fa65..c6bb439ad 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit b3ce8fa650f86c7a1dbd5329d72c3d73dd76d05d +Subproject commit c6bb439ad18455fff85cdfab480689a1c94f56fe From 54d4b68f3cdef054b55849a248a8bcdaac8033df Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Sat, 18 Apr 2020 20:39:57 -0500 Subject: [PATCH 07/11] don't crash if the path to an instance-vector contains a null pointer --- library/DataStatics.cpp | 5 +++-- library/xml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/library/DataStatics.cpp b/library/DataStatics.cpp index 61b7b6378..275cae584 100644 --- a/library/DataStatics.cpp +++ b/library/DataStatics.cpp @@ -12,10 +12,11 @@ namespace { template - inline T &_toref(T &r) { return r; } + inline T *_toptr(T &r) { return &r; } template - inline T &_toref(T *&p) { return *p; } + inline T *_toptr(T *&p) { return p; } } +#define _fieldptr(ptr, fn) (ptr) ? _toptr((ptr)->fn) : NULL #define INIT_GLOBAL_FUNCTION_PREFIX \ DFHack::VersionInfo *global_table_ = DFHack::Core::getInstance().vinfo.get(); \ diff --git a/library/xml b/library/xml index 816497911..d9a31fa45 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 81649791116754a789aae85222797c4df3945b08 +Subproject commit d9a31fa45228a7507b975dbbddbf00c7905644ea From d3a007489c5248b758627d019d1a6c4f4a53fd34 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sun, 19 Apr 2020 12:16:48 -0400 Subject: [PATCH 08/11] Fix ZLIB_ROOT in newer CMake versions --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e40c932a0..f8dd5dc86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,12 @@ if("${CMAKE_GENERATOR}" STREQUAL Ninja) endif() endif() +if(NOT("${CMAKE_VERSION}" VERSION_LESS 3.12)) + # make ZLIB_ROOT work in CMake >= 3.12 + # https://cmake.org/cmake/help/git-stage/policy/CMP0074.html + cmake_policy(SET CMP0074 NEW) +endif() + # Set up build types if(CMAKE_CONFIGURATION_TYPES) set(CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo" CACHE STRING "List of supported configuration types" FORCE) From 2f1e057bc7efc215702cf14d0448dfaeaf1574e0 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Sun, 19 Apr 2020 22:03:03 -0500 Subject: [PATCH 09/11] check-structures-sanity: report known void* types with a better message --- plugins/devel/check-structures-sanity/dispatch.cpp | 5 +++++ plugins/devel/check-structures-sanity/types.cpp | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/devel/check-structures-sanity/dispatch.cpp b/plugins/devel/check-structures-sanity/dispatch.cpp index fcc6b0b8e..f6342d03c 100644 --- a/plugins/devel/check-structures-sanity/dispatch.cpp +++ b/plugins/devel/check-structures-sanity/dispatch.cpp @@ -67,6 +67,11 @@ bool Checker::queue_item(const QueueItem & item, CheckedStructure cs) auto offset = uintptr_t(item.ptr) - uintptr_t(prev->first); if (!prev->second.second.has_type_at_offset(cs, offset)) { + if (offset == 0 && cs.identity == df::identity_traits::get()) + { + FAIL("unknown pointer is " << prev->second.second.identity->getFullName() << ", previously seen at " << prev->second.first); + return false; + } // TODO FAIL("TODO: handle merging structures: " << item.path << " overlaps " << prev->second.first << " (backward)"); return false; diff --git a/plugins/devel/check-structures-sanity/types.cpp b/plugins/devel/check-structures-sanity/types.cpp index 9e565215a..86d691f1d 100644 --- a/plugins/devel/check-structures-sanity/types.cpp +++ b/plugins/devel/check-structures-sanity/types.cpp @@ -129,7 +129,6 @@ bool CheckedStructure::has_type_at_offset(const CheckedStructure & type, size_t auto st = dynamic_cast(identity); if (!st) { - UNEXPECTED; return false; } From 66314806b137a86a0ff7627b08251ab9ce4d0d6f Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Sun, 19 Apr 2020 22:03:13 -0500 Subject: [PATCH 10/11] update structures --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index d9a31fa45..ce91eb750 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit d9a31fa45228a7507b975dbbddbf00c7905644ea +Subproject commit ce91eb750026e97b0044e88043f36fe4ff5218c0 From 9a10ea9fe5cec8b84a68f0846012f4cf4fca470a Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 22 Apr 2020 02:13:24 -0400 Subject: [PATCH 11/11] Update submodules --- library/xml | 2 +- scripts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/xml b/library/xml index ce91eb750..353caa341 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit ce91eb750026e97b0044e88043f36fe4ff5218c0 +Subproject commit 353caa3413f728938821c8aaccebb389a322bfef diff --git a/scripts b/scripts index c6bb439ad..1468a773e 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit c6bb439ad18455fff85cdfab480689a1c94f56fe +Subproject commit 1468a773e4b56716d94c28cc90a6988739d0c561