The library is compilable under Linux with GCC and under Windows with
MinGW32 and MSVC compilers. It is using the cmake build system. See
COMPILE for details.
@@ -485,17 +490,17 @@ the dfhack repository is welcome and the right thing to do :)
code does have a lot of comments though (and getting better all the
time).
-
+
Several things should be kept in mind when contributing to DFHack.
-
+
DFhack uses ANSI formatting and four spaces as indentation. Line
endings are UNIX. The files use UTF-8 encoding. Code not following this
won't make me happy, because I'll have to fix it. There's a good chance
I'll make you fix it ;)
-
+
You can send patches or make a clone of the github repo and ask me on
the IRC channel to pull your code in. I'll review it and see if there
are any problems. I'll fix them if they are minor.
@@ -505,7 +510,7 @@ this is also a good place to dump new ideas and/or bugs that need
fixing.
-
+
DFHack uses modules to partition sets of features into manageable
chunks. A module can have both client and server side.
Client side is the part that goes into the main library and is
@@ -543,7 +548,7 @@ server, it allows accelerating the reading of map blocks.
pretty fast, but needs quite a bit of care to not break.
-
+
- Internal
- either part of the codebase or statically linked.
@@ -555,7 +560,7 @@ dependencies for core dfhack should be either public domain or require
attribution at most. External dependencies for tools can be either
that, or any Free Software licenses.
-
+
- tinyxml
- used by core dfhack to read offset definitions from Memory.xml
@@ -567,7 +572,7 @@ DF binaries on Linux.
-
+
- wide-character ncurses
- used for the veinlook tool on Linux.
@@ -576,7 +581,7 @@ DF binaries on Linux.
-
+
- cmake
- you need cmake to generate the build system and some configuration
@@ -587,7 +592,7 @@ headers
-
+
The files with memory offset definitions used by dfhack can be found in the
data folder.
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
index 57f78725f..8e09a2203 100644
--- a/library/CMakeLists.txt
+++ b/library/CMakeLists.txt
@@ -186,9 +186,17 @@ if(MSVC)
ADD_CUSTOM_COMMAND(TARGET dfhack POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/data/Memory.xml $(TargetDir)/Memory.xml
)
+ ADD_CUSTOM_COMMAND(TARGET dfhack POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Compile.html $(TargetDir)/Compile.html
+ )
+ ADD_CUSTOM_COMMAND(TARGET dfhack POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Readme.html $(TargetDir)/Readme.html
+ )
else(MSVC)
# Just put the file in the output directory on Linux and Mac
configure_file(${CMAKE_SOURCE_DIR}/data/Memory.xml ${DATA_OUTPUT_PATH}/Memory.xml COPYONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/Compile.html ${DATA_OUTPUT_PATH}/Compile.html COPYONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/Readme.html ${DATA_OUTPUT_PATH}/Readme.html COPYONLY)
endif(MSVC)
IF(UNIX)
diff --git a/tools/supported/CMakeLists.txt b/tools/supported/CMakeLists.txt
index 0a0d93f68..f7006aeb2 100644
--- a/tools/supported/CMakeLists.txt
+++ b/tools/supported/CMakeLists.txt
@@ -51,6 +51,11 @@ TARGET_LINK_LIBRARIES(dfflows dfhack)
ADD_EXECUTABLE(dfliquids liquids.cpp)
TARGET_LINK_LIBRARIES(dfliquids dfhack)
+# Solves the problem of unusable items after reclaim by clearing the 'in_job' bit of all items.
+# Original author: Quietust
+ADD_EXECUTABLE(dfcleartask cleartask.cpp)
+TARGET_LINK_LIBRARIES(dfcleartask dfhack)
+
# position - check the DF window and cursor parameters
ADD_EXECUTABLE(dfposition position.cpp)
TARGET_LINK_LIBRARIES(dfposition dfhack)
@@ -104,6 +109,7 @@ dfunstuck
dfprobe
dfdoffsets
dfattachtest
+dfcleartask
dfexpbench
dfsuspend
dfflows
diff --git a/tools/supported/cleartask.cpp b/tools/supported/cleartask.cpp
new file mode 100644
index 000000000..267a686ff
--- /dev/null
+++ b/tools/supported/cleartask.cpp
@@ -0,0 +1,73 @@
+// clears the "tasked" flag on all items
+// original code by Quietust (http://www.bay12forums.com/smf/index.php?action=profile;u=18111)
+#include
+#include
+#include
+#include
+#include
+#include
+using namespace std;
+
+#include
+#include
+#include
+
+int main ()
+{
+ DFHack::Process * p;
+ unsigned int i;
+ DFHack::ContextManager DFMgr("Memory.xml");
+ DFHack::Context * DF;
+ try
+ {
+ DF = DFMgr.getSingleContext();
+ DF->Attach();
+ }
+ catch (exception& e)
+ {
+ cerr << e.what() << endl;
+#ifndef LINUX_BUILD
+ cin.ignore();
+#endif
+ return 1;
+ }
+
+ DFHack::memory_info * mem = DF->getMemoryInfo();
+ p = DF->getProcess();
+ uint32_t item_vec_offset = 0;
+ try
+ {
+ item_vec_offset = p->getDescriptor()->getAddress ("items_vector");
+ }
+ catch(DFHack::Error::MissingMemoryDefinition & e)
+ {
+ cerr << "missing offset for the item vector, exiting :(" << endl;
+ #ifndef LINUX_BUILD
+ cin.ignore();
+ #endif
+ return 1;
+ }
+
+ DFHack::DfVector p_items (p, item_vec_offset);
+ uint32_t size = p_items.size();
+
+ int numtasked = 0;
+ for (i=0;ireadDWord(p_items[i] + 0x0C);
+ if (flags.bits.in_job)
+ {
+ flags.bits.in_job = 0;
+ p->writeDWord(p_items[i] + 0x0C, flags.whole);
+ numtasked++;
+ }
+ }
+ cout << "Found and untasked " << numtasked << " items." << endl;
+
+#ifndef LINUX_BUILD
+ cout << "Done. Press any key to continue" << endl;
+ cin.ignore();
+#endif
+ return 0;
+}
\ No newline at end of file