<p>On Windows, DFHack replaces the SDL library distributed with DF.</p>
<divclass="section"id="id1">
<h2><aclass="toc-backref"href="#id9">How to get the code</a></h2>
<h2><aclass="toc-backref"href="#id10">How to get the code</a></h2>
<p>DFHack doesn't have any kind of system of code snapshots in place, so you will have to get code from the github repository using git.
You will need some sort of Windows port of git, or a GUI. Some examples:</p>
<blockquote>
@ -428,7 +484,7 @@ git submodule update
<p>If you want to get really involved with the development, create an account on github, make a clone there and then use that as your remote repository instead. Detailed instructions are beyond the scope of this document. If you need help, join us on IRC (#dfhack channel on freenode).</p>
<p>It has the usual installer wizard. Make sure you let it add its binary folder
@ -445,7 +501,7 @@ Grab it from Microsoft's site.</p>
<p>If you already have a different version of perl (for example the one from cygwin), you can run into some trouble. Either remove the other perl install from PATH, or install libxml and libxslt for it instead. Strawberry perl works though and has all the required packages.</p>
<p>There are several different batch files in the <ttclass="docutils literal">build</tt> folder along with a script that's used for picking the DF path.</p>
<p>First, run set_df_path.vbs and point the dialog that pops up at your DF folder that you want to use for development.
Next, run one of the scripts with <ttclass="docutils literal">generate</tt> prefix. These create the MSVC solution file(s):</p>
@ -467,7 +523,7 @@ So pick either Release or RelWithDebInfo build and build the INSTALL target.</p>
<h2><aclass="toc-backref"href="#id14">DF data structure definitions</a></h2>
<h2><aclass="toc-backref"href="#id15">DF data structure definitions</a></h2>
<p>DFHack uses information about the game data structures, represented via xml files in the library/xml/ submodule.</p>
<p>Data structure layouts are described in files following the df.*.xml name pattern. This information is transformed by a perl script into C++ headers describing the structures, and associated metadata for the Lua wrapper. These headers and data are then compiled into the DFHack libraries, thus necessitating a compatibility break every time layouts change; in return it significantly boosts the efficiency and capabilities of DFHack code.</p>
<p>Global object addresses are stored in symbols.xml, which is copied to the dfhack release package and loaded as data at runtime.</p>
<p>DFHack supports remote access by exchanging Google protobuf messages via a TCP socket. Both the core and plugins can define remotely accessible methods. The <ttclass="docutils literal"><spanclass="pre">dfhack-run</span></tt> command uses this interface to invoke ordinary console commands.</p>
<p>Currently the supported set of requests is limited, because the developers don't know what exactly is most useful.</p>
<p>Protocol client implementations exist for Java and C#.</p>
</div>
<divclass="section"id="contributing-to-dfhack">
<h2><aclass="toc-backref"href="#id16">Contributing to DFHack</a></h2>
<h2><aclass="toc-backref"href="#id17">Contributing to DFHack</a></h2>
<p>Several things should be kept in mind when contributing to DFHack.</p>
3. Open Xcode, go to Preferences > Downloads, and install the Command Line Tools.
4. Install MacPorts.
5. Install dependencies from MacPorts:
* sudo port install gcc45 +universal cmake +universal git-core +universal (This will take some time—maybe hours, depending on your machine.)
* At some point during this process, it may ask you to install a Java environment; let it do so.
* ``sudo port install gcc45 +universal cmake +universal git-core +universal``
This will take some time—maybe hours, depending on your machine.
* At some point during this process, it may ask you to install a Java environment; let it do so.
6. Install perl dependencies
1. sudo cpan (If this is the first time you've run cpan, you will need to go through the setup process. Just stick with the defaults for everything and you'll be fine.)
<p>Returns a map block object for given x,y,z in local block coordinates.</p>
</li>
<li><pclass="first"><ttclass="docutils literal">dfhack.maps.isValidTilePos(coords)</tt>, or isValidTilePos(x,y,z)``</p>
<li><pclass="first"><ttclass="docutils literal">dfhack.maps.isValidTilePos(coords)</tt>, or <ttclass="docutils literal">isValidTilePos(x,y,z)</tt></p>
<p>Checks if the given df::coord or x,y,z in local tile coordinates are valid.</p>
</li>
<li><pclass="first"><ttclass="docutils literal">dfhack.maps.getTileBlock(coords)</tt>, or <ttclass="docutils literal">getTileBlock(x,y,z)</tt></p>
@ -1273,6 +1289,12 @@ Returns <em>false</em> in case of error.</p>
<li><pclass="first"><ttclass="docutils literal">dfhack.maps.ensureTileBlock(coords)</tt>, or <ttclass="docutils literal">ensureTileBlock(x,y,z)</tt></p>
<p>Like <ttclass="docutils literal">getTileBlock</tt>, but if the block is not allocated, try creating it.</p>
</li>
<li><pclass="first"><ttclass="docutils literal">dfhack.maps.getTileType(coords)</tt>, or <ttclass="docutils literal">getTileType(x,y,z)</tt></p>
<p>Returns the tile type at the given coordinates, or <em>nil</em> if invalid.</p>
</li>
<li><pclass="first"><ttclass="docutils literal">dfhack.maps.getTileFlags(coords)</tt>, or <ttclass="docutils literal">getTileFlags(x,y,z)</tt></p>
<p>Returns designation and occupancy references for the given coordinates, or <em>nil, nil</em> if invalid.</p>
</li>
<li><pclass="first"><ttclass="docutils literal">dfhack.maps.getRegionBiome(region_coord2d)</tt>, or <ttclass="docutils literal">getRegionBiome(x,y)</tt></p>
<p>Returns the biome info struct for the given global map region.</p>
<p>This script remove negative thoughts from your dwarves. Very useful against
tantrum spirals.</p>
<p>With a selected unit in 'v' mode, will clear this unit's mind, otherwise
clear all your fort's units minds.</p>
<p>The script can target a single creature, when used with the <ttclass="docutils literal">him</tt> argument,
or the whole fort population, with <ttclass="docutils literal">all</tt>.</p>
<p>To show every bad thought present without actually removing them, run the
script with the <ttclass="docutils literal"><spanclass="pre">-n</span></tt> or <ttclass="docutils literal"><spanclass="pre">--dry-run</span></tt> argument. This can give a quick
hint on what bothers your dwarves the most.</p>
<p>Individual dwarf happiness may not increase right after this command is run,
but in the short term your dwarves will get much more joyful.
The thoughts are set to be very old, and the game will remove them soon when
you unpause.</p>
<p>With the optional <ttclass="docutils literal"><spanclass="pre">-v</span></tt> parameter, the script will dump the negative thoughts
it removed.</p>
but in the short term your dwarves will get much more joyful.</p>
<p>Internals: the thoughts are set to be very old, so that the game remove them