Merge remote-tracking branch 'dfhack/develop'

develop
expwnent 2014-09-08 13:23:28 -04:00
commit 4800794ba6
10 changed files with 1182 additions and 1413 deletions

@ -182,7 +182,7 @@ IF(UNIX)
if(APPLE) if(APPLE)
SET(CPACK_GENERATOR "ZIP") SET(CPACK_GENERATOR "ZIP")
else() else()
SET(CPACK_GENERATOR "TGZ") SET(CPACK_GENERATOR "TBZ2")
endif() endif()
ELSEIF(WIN32) ELSEIF(WIN32)
SET(CPACK_GENERATOR "ZIP") SET(CPACK_GENERATOR "ZIP")

@ -3,13 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.11: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.8.1: http://docutils.sourceforge.net/" />
<title>Building DFHACK</title> <title>Building DFHACK</title>
<style type="text/css"> <style type="text/css">
/* /*
:Author: David Goodger (goodger@python.org) :Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7614 2013-02-21 15:55:51Z milde $ :Id: $Id: html4css1.css 7056 2011-06-17 10:50:48Z milde $
:Copyright: This stylesheet has been placed in the public domain. :Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils. Default cascading style sheet for the HTML output of Docutils.
@ -77,7 +77,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title, div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title, div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error { div.warning p.admonition-title {
color: red ; color: red ;
font-weight: bold ; font-weight: bold ;
font-family: sans-serif } font-family: sans-serif }
@ -249,19 +249,10 @@ pre.address {
margin-top: 0 ; margin-top: 0 ;
font: inherit } font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code { pre.literal-block, pre.doctest-block, pre.math {
margin-left: 2em ; margin-left: 2em ;
margin-right: 2em } margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier { span.classifier {
font-family: sans-serif ; font-family: sans-serif ;
font-style: oblique } font-style: oblique }
@ -313,21 +304,6 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ; white-space: nowrap ;
padding-left: 0 } padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% } font-size: 100% }
@ -396,11 +372,14 @@ git submodule update
<h2><a class="toc-backref" href="#id6">Dependencies</a></h2> <h2><a class="toc-backref" href="#id6">Dependencies</a></h2>
<p>DFHack is meant to be installed into an existing DF folder, so get one ready.</p> <p>DFHack is meant to be installed into an existing DF folder, so get one ready.</p>
<p>For building, you need a 32-bit version of GCC. For example, to build DFHack on <p>For building, you need a 32-bit version of GCC. For example, to build DFHack on
a 64-bit distribution like Arch, you'll need the multilib development tools and libraries.</p> a 64-bit distribution like Arch, you'll need the multilib development tools and libraries.
Alternatively, you might be able to use <tt class="docutils literal">lxc</tt> to
<a class="reference external" href="http://www.bay12forums.com/smf/index.php?topic=139553.msg5435310#msg5435310">create a virtual 32-bit environment</a>.</p>
<p>Before you can build anything, you'll also need <tt class="docutils literal">cmake</tt>. It is advisable to also get <p>Before you can build anything, you'll also need <tt class="docutils literal">cmake</tt>. It is advisable to also get
<tt class="docutils literal">ccmake</tt> on distributions that split the cmake package into multiple parts.</p> <tt class="docutils literal">ccmake</tt> on distributions that split the cmake package into multiple parts.</p>
<p>For the code generation parts, you need perl and the XML::LibXML and XML::LibXSLT perl packages. <p>For the code generation parts, you need perl and the XML::LibXML and XML::LibXSLT perl packages.
You should be able to find them in your distro repositories (on Arch linux 'perl-xml-libxml' and 'perl-xml-libxslt').</p> You should be able to find them in your distro repositories (on Arch linux 'perl-xml-libxml' and 'perl-xml-libxslt').</p>
<p>To build Stonesense, you'll also need OpenGL headers.</p>
</div> </div>
<div class="section" id="build"> <div class="section" id="build">
<h2><a class="toc-backref" href="#id7">Build</a></h2> <h2><a class="toc-backref" href="#id7">Build</a></h2>
@ -489,7 +468,7 @@ process. Just stick with the defaults for everything and you'll be fine.</p>
</li> </li>
<li><p class="first">Get the dfhack source:</p> <li><p class="first">Get the dfhack source:</p>
<pre class="literal-block"> <pre class="literal-block">
git clone https://github.com/danaris/dfhack.git git clone git://github.com/DFHack/dfhack.git
cd dfhack cd dfhack
git submodule init git submodule init
git submodule update git submodule update

@ -33,6 +33,8 @@ DFHack is meant to be installed into an existing DF folder, so get one ready.
For building, you need a 32-bit version of GCC. For example, to build DFHack on For building, you need a 32-bit version of GCC. For example, to build DFHack on
a 64-bit distribution like Arch, you'll need the multilib development tools and libraries. a 64-bit distribution like Arch, you'll need the multilib development tools and libraries.
Alternatively, you might be able to use ``lxc`` to
`create a virtual 32-bit environment <http://www.bay12forums.com/smf/index.php?topic=139553.msg5435310#msg5435310>`_.
Before you can build anything, you'll also need ``cmake``. It is advisable to also get Before you can build anything, you'll also need ``cmake``. It is advisable to also get
``ccmake`` on distributions that split the cmake package into multiple parts. ``ccmake`` on distributions that split the cmake package into multiple parts.
@ -40,6 +42,8 @@ Before you can build anything, you'll also need ``cmake``. It is advisable to al
For the code generation parts, you need perl and the XML::LibXML and XML::LibXSLT perl packages. For the code generation parts, you need perl and the XML::LibXML and XML::LibXSLT perl packages.
You should be able to find them in your distro repositories (on Arch linux 'perl-xml-libxml' and 'perl-xml-libxslt'). You should be able to find them in your distro repositories (on Arch linux 'perl-xml-libxml' and 'perl-xml-libxslt').
To build Stonesense, you'll also need OpenGL headers.
Build Build
===== =====
Building is fairly straightforward. Enter the ``build`` folder and start the build like this:: Building is fairly straightforward. Enter the ``build`` folder and start the build like this::
@ -118,7 +122,7 @@ If you are building on 10.6, please read the subsection below titled "Snow Leopa
6. Get the dfhack source:: 6. Get the dfhack source::
git clone https://github.com/danaris/dfhack.git git clone git://github.com/DFHack/dfhack.git
cd dfhack cd dfhack
git submodule init git submodule init
git submodule update git submodule update

@ -3,13 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.11: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.8.1: http://docutils.sourceforge.net/" />
<title>DFHack Lua API</title> <title>DFHack Lua API</title>
<style type="text/css"> <style type="text/css">
/* /*
:Author: David Goodger (goodger@python.org) :Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7614 2013-02-21 15:55:51Z milde $ :Id: $Id: html4css1.css 7056 2011-06-17 10:50:48Z milde $
:Copyright: This stylesheet has been placed in the public domain. :Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils. Default cascading style sheet for the HTML output of Docutils.
@ -77,7 +77,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title, div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title, div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error { div.warning p.admonition-title {
color: red ; color: red ;
font-weight: bold ; font-weight: bold ;
font-family: sans-serif } font-family: sans-serif }
@ -249,19 +249,10 @@ pre.address {
margin-top: 0 ; margin-top: 0 ;
font: inherit } font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code { pre.literal-block, pre.doctest-block, pre.math {
margin-left: 2em ; margin-left: 2em ;
margin-right: 2em } margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier { span.classifier {
font-family: sans-serif ; font-family: sans-serif ;
font-style: oblique } font-style: oblique }
@ -313,21 +304,6 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ; white-space: nowrap ;
padding-left: 0 } padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% } font-size: 100% }
@ -1757,6 +1733,15 @@ functions in this section, this may be used at any time.</p>
<p>Returns the string that should be used to represent the given <p>Returns the string that should be used to represent the given
logical keybinding on the screen in texts like &quot;press Key to ...&quot;.</p> logical keybinding on the screen in texts like &quot;press Key to ...&quot;.</p>
</li> </li>
<li><p class="first"><tt class="docutils literal">dfhack.screen.keyToChar(key)</tt></p>
<p>Returns the integer character code of the string input
character represented by the given logical keybinding,
or <em>nil</em> if not a string input key.</p>
</li>
<li><p class="first"><tt class="docutils literal">dfhack.screen.charToKey(charcode)</tt></p>
<p>Returns the keybinding representing the given string input
character, or <em>nil</em> if impossible.</p>
</li>
</ul> </ul>
<p>The &quot;pen&quot; argument used by functions above may be represented by <p>The &quot;pen&quot; argument used by functions above may be represented by
a table with the following possible fields:</p> a table with the following possible fields:</p>
@ -3230,6 +3215,18 @@ tweaking (e.g. adding custom reactions)</p>
<li><p class="first"><tt class="docutils literal">onInventoryChange(unit_id,item_id,old_equip,new_equip)</tt></p> <li><p class="first"><tt class="docutils literal">onInventoryChange(unit_id,item_id,old_equip,new_equip)</tt></p>
<p>Gets called when someone picks up an item, puts one down, or changes the way they are holding it. If an item is picked up, old_equip will be null. If an item is dropped, new_equip will be null. If an item is re-equipped in a new way, then neither will be null. You absolutely must NOT alter either old_equip or new_equip or you might break other plugins.</p> <p>Gets called when someone picks up an item, puts one down, or changes the way they are holding it. If an item is picked up, old_equip will be null. If an item is dropped, new_equip will be null. If an item is re-equipped in a new way, then neither will be null. You absolutely must NOT alter either old_equip or new_equip or you might break other plugins.</p>
</li> </li>
<li><p class="first"><tt class="docutils literal">onReport(reportId)</tt></p>
<p>Gets called when a report happens. This happens more often than you probably think, even if it doesn't show up in the announcements.</p>
</li>
<li><p class="first"><tt class="docutils literal">onUnitAttack(attackerId, defenderId, woundId)</tt></p>
<p>Called when a unit wounds another with a weapon. Is NOT called if blocked, dodged, deflected, or parried.</p>
</li>
<li><p class="first"><tt class="docutils literal">onUnload()</tt></p>
<p>A convenience event in case you don't want to register for every onStateChange event.</p>
</li>
<li><p class="first"><tt class="docutils literal">onInteraction(attackVerb, defendVerb, attackerId, defenderId, attackReportId, defendReportId)</tt></p>
<p>Called when a unit uses an interaction on another.</p>
</li>
</ol> </ol>
</div> </div>
<div class="section" id="functions"> <div class="section" id="functions">

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2
build/.gitignore vendored

@ -1,2 +1,4 @@
VC2010 VC2010
DF_PATH.txt DF_PATH.txt
_CPack_Packages
*.tar.*

@ -490,6 +490,13 @@ struct tradeview_hook : public df::viewscreen_tradegoodsst
{ {
INTERPOSE_NEXT(render)(); INTERPOSE_NEXT(render)();
if (counteroffer.size() > 0)
{
// The merchant is proposing a counteroffer,
// so there is nothing to mark.
return;
}
// Insert into the blank line between trade items and standard keys. // Insert into the blank line between trade items and standard keys.
// The blank line at the bottom is taken by the search plugin. // The blank line at the bottom is taken by the search plugin.
auto dim = Screen::getWindowSize(); auto dim = Screen::getWindowSize();

@ -408,7 +408,7 @@ protected:
//bool redo_search; //bool redo_search;
string search_string; string search_string;
private: protected:
int *cursor_pos; int *cursor_pos;
char select_key; char select_key;
bool valid; bool valid;
@ -1074,15 +1074,24 @@ class trade_search_merc : public trade_search_base
public: public:
virtual void render() const virtual void render() const
{ {
if (viewscreen->counteroffer.size() > 0)
{
// The merchant is proposing a counteroffer.
// Not only is there nothing to search,
// but the native hotkeys are where we normally write.
return;
}
print_search_option(2, -1); print_search_option(2, -1);
if (!search_string.empty()) if (!search_string.empty())
{ {
make_text_dim(2, 37, 22);
make_text_dim(42, gps->dimx-2, 22);
int32_t x = 2; int32_t x = 2;
int32_t y = gps->dimy - 3; int32_t y = gps->dimy - 3;
OutputString(COLOR_YELLOW, x, y, "Note: Clear search to trade"); make_text_dim(2, 37, y);
make_text_dim(42, gps->dimx-2, y);
OutputString(COLOR_LIGHTRED, x, y, string(1, select_key + 'A' - 'a'));
OutputString(COLOR_WHITE, x, y, ": Clear search to trade ");
} }
} }
@ -1116,15 +1125,24 @@ class trade_search_fort : public trade_search_base
public: public:
virtual void render() const virtual void render() const
{ {
if (viewscreen->counteroffer.size() > 0)
{
// The merchant is proposing a counteroffer.
// Not only is there nothing to search,
// but the native hotkeys are where we normally write.
return;
}
print_search_option(42, -1); print_search_option(42, -1);
if (!search_string.empty()) if (!search_string.empty())
{ {
make_text_dim(2, 37, 22);
make_text_dim(42, gps->dimx-2, 22);
int32_t x = 42; int32_t x = 42;
int32_t y = gps->dimy - 3; int32_t y = gps->dimy - 3;
OutputString(COLOR_YELLOW, x, y, "Note: Clear search to trade"); make_text_dim(2, 37, y);
make_text_dim(42, gps->dimx-2, y);
OutputString(COLOR_LIGHTRED, x, y, string(1, select_key + 'A' - 'a'));
OutputString(COLOR_WHITE, x, y, ": Clear search to trade ");
} }
} }

@ -5,7 +5,7 @@ def display_death_event(e)
str << " (cause: #{e.death_cause.to_s.downcase})," str << " (cause: #{e.death_cause.to_s.downcase}),"
str << " killed by the #{e.slayer_race_tg.name[0]} #{e.slayer_hf_tg.name}" if e.slayer_hf != -1 str << " killed by the #{e.slayer_race_tg.name[0]} #{e.slayer_hf_tg.name}" if e.slayer_hf != -1
str << " using a #{df.world.raws.itemdefs.weapons[e.weapon.item_subtype].name}" if e.weapon.item_type == :WEAPON str << " using a #{df.world.raws.itemdefs.weapons[e.weapon.item_subtype].name}" if e.weapon.item_type == :WEAPON
str << ", shot by a #{df.world.raws.itemdefs.weapons[e.weapon.bow_item_subtype].name}" if e.weapon.bow_item_type == :WEAPON str << ", shot by a #{df.world.raws.itemdefs.weapons[e.weapon.shooter_item_subtype].name}" if e.weapon.shooter_item_type == :WEAPON
puts str.chomp(',') + '.' puts str.chomp(',') + '.'
end end