Merge branch 'develop' of https://github.com/DFHack/dfhack into develop

develop
Japa 2016-10-16 06:33:04 +05:30
commit 84ea03f68c
12 changed files with 113 additions and 56 deletions

@ -31,7 +31,9 @@ function(download_file_unzip URL ZIP_TYPE ZIP_DEST ZIP_MD5 UNZIP_DEST UNZIP_MD5)
if(EXISTS "${ZIP_DEST}") if(EXISTS "${ZIP_DEST}")
message("* Decompressing ${FILENAME}") message("* Decompressing ${FILENAME}")
if("${ZIP_TYPE}" STREQUAL "gz") if("${ZIP_TYPE}" STREQUAL "gz")
execute_process(COMMAND gunzip --force "${ZIP_DEST}") execute_process(COMMAND
"${PERL_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/depends/gunzip.pl"
"${ZIP_DEST}" --force)
else() else()
message(SEND_ERROR "Unknown ZIP_TYPE: ${ZIP_TYPE}") message(SEND_ERROR "Unknown ZIP_TYPE: ${ZIP_TYPE}")
endif() endif()

@ -137,8 +137,8 @@ endif()
# set up versioning. # set up versioning.
set(DF_VERSION "0.43.05") set(DF_VERSION "0.43.05")
SET(DFHACK_RELEASE "alpha0") SET(DFHACK_RELEASE "alpha1")
SET(DFHACK_PRERELEASE FALSE) SET(DFHACK_PRERELEASE TRUE)
set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}")

@ -33,8 +33,31 @@ Changelog
DFHack future DFHack future
============= =============
Internals
---------
- 64-bit support on all platforms
- Visual Studio 2015 now required on Windows instead of 2010
- GCC 4.8 recommended on Linux and OS X (and now supported on OS X)
- Several structure fixes to match 64-bit DF's memory layout
Lua
---
- Lua has been updated to 5.3 - see http://www.lua.org/manual/5.3/readme.html for details
- Floats are no longer implicitly converted to integers in DFHack API calls
- ``df.new()`` supports more types: ``char``, ``intptr_t``, ``uintptr_t``, ``long``, ``unsigned long``
- String representations of vectors and a few other containers now include their lengths
Ruby
----
- Added support for loading ruby 2.x libraries
- Fixed some layouts on x64 (incomplete)
New Plugins New Plugins
----------- -----------
- `dwarfvet` enables animal caretaking
- `labormanager` (formerly autolabor2): a more advanced alternative to `autolabor`
- `title-folder`: shows DF folder name in window title bar when enabled - `title-folder`: shows DF folder name in window title bar when enabled
New Scripts New Scripts
@ -43,7 +66,20 @@ New Scripts
Fixes Fixes
----- -----
- The DF path on OS X can now contain spaces and ``:`` characters
- Buildings::setOwner() changes now persist properly when saved - Buildings::setOwner() changes now persist properly when saved
- `devel/find-offsets`: fixed a crash when vtables used by globals aren't available
Misc Improvements
-----------------
- `lua` and `gui/gm-editor` now support the same aliases (``scr``, ``unit``, etc.)
- `remotefortressreader`: Added support for
- world map snow coverage
- spatters
- wall info
- site towers, world buildings
- surface material
DFHack 0.43.03-r1 DFHack 0.43.03-r1
================= =================
@ -52,10 +88,6 @@ Lua
--- ---
- Label widgets can now easily register handlers for mouse clicks - Label widgets can now easily register handlers for mouse clicks
New Plugins
-----------
- `dwarfvet` enables animal caretaking.
New Features New Features
------------ ------------
- `add-thought`: allow syndrome name as ``-thought`` argument - `add-thought`: allow syndrome name as ``-thought`` argument

@ -0,0 +1,21 @@
#!/usr/bin/perl
use strict;
use warnings;
use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
my %args = map { $_ => 1 } @ARGV;
my $in_file = $ARGV[0] or die "no input file";
# remove extension
(my $out_file = $in_file) =~ s{\.[^.]+$}{};
if (! -f $in_file) {
die "input file does not exist: \"$in_file\"\n";
}
if (-f $out_file and !exists($args{'--force'})) {
die "output file exists, not overwriting: \"$out_file\"";
}
gunzip $in_file => $out_file or die "gunzip failed: $GunzipError\n";

@ -818,6 +818,12 @@ Examples:
``autolabor CUTWOOD disable`` ``autolabor CUTWOOD disable``
Turn off autolabor for wood cutting. Turn off autolabor for wood cutting.
.. _labormanager:
labormanager
============
A more advanced alternative to `autolabor`.
.. _autohauler: .. _autohauler:
autohauler autohauler

@ -341,6 +341,14 @@ namespace DFHack {namespace Lua {
DFHACK_EXPORT int PushPosXYZ(lua_State *state, df::coord pos); DFHACK_EXPORT int PushPosXYZ(lua_State *state, df::coord pos);
DFHACK_EXPORT int PushPosXY(lua_State *state, df::coord2d 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 void CheckPen(lua_State *L, Screen::Pen *pen, int index, bool allow_nil = false, bool allow_color = true); DFHACK_EXPORT void CheckPen(lua_State *L, Screen::Pen *pen, int index, bool allow_nil = false, bool allow_color = true);
DFHACK_EXPORT bool IsCoreContext(lua_State *state); DFHACK_EXPORT bool IsCoreContext(lua_State *state);

@ -38,8 +38,6 @@ distribution.
#include "df/item.h" #include "df/item.h"
#include "df/inclusion_type.h" #include "df/inclusion_type.h"
using namespace DFHack;
namespace df { namespace df {
struct world_region_details; struct world_region_details;
} }
@ -47,6 +45,8 @@ namespace df {
namespace MapExtras namespace MapExtras
{ {
using namespace DFHack;
class DFHACK_EXPORT MapCache; class DFHACK_EXPORT MapCache;
class Block; class Block;

@ -152,10 +152,11 @@ public:
class FloodBrush : public Brush class FloodBrush : public Brush
{ {
public: public:
FloodBrush(Core *c){c_ = c;}; FloodBrush(DFHack::Core *c){c_ = c;};
~FloodBrush(){}; ~FloodBrush(){};
coord_vec points(MapExtras::MapCache & mc, DFHack::DFCoord start) coord_vec points(MapExtras::MapCache & mc, DFHack::DFCoord start)
{ {
using namespace DFHack;
coord_vec v; coord_vec v;
std::stack<DFCoord> to_flood; std::stack<DFCoord> to_flood;
@ -198,19 +199,21 @@ public:
return "flood"; return "flood";
} }
private: private:
void maybeFlood(DFCoord c, std::stack<DFCoord> &to_flood, MapExtras::MapCache &mc) { void maybeFlood(DFHack::DFCoord c, std::stack<DFHack::DFCoord> &to_flood,
MapExtras::MapCache &mc) {
if (mc.testCoord(c)) { if (mc.testCoord(c)) {
to_flood.push(c); to_flood.push(c);
} }
} }
Core *c_; DFHack::Core *c_;
}; };
command_result parseRectangle(color_ostream & out, DFHack::command_result parseRectangle(DFHack::color_ostream & out,
vector<string> & input, int start, int end, vector<string> & input, int start, int end,
int & width, int & height, int & zLevels, int & width, int & height, int & zLevels,
bool hasConsole = true) bool hasConsole = true)
{ {
using namespace DFHack;
int newWidth = 0, newHeight = 0, newZLevels = 0; int newWidth = 0, newHeight = 0, newZLevels = 0;
if (end > start + 1) if (end > start + 1)

@ -176,19 +176,12 @@ namespace conf_lua {
{ {
Lua::Push(l_state, val); Lua::Push(l_state, val);
} }
template <typename KeyType, typename ValueType>
void table_set (lua_State *L, KeyType k, ValueType v)
{
Lua::Push(L, k);
Lua::Push(L, v);
lua_settable(L, -3);
}
namespace api { namespace api {
int get_ids (lua_State *L) int get_ids (lua_State *L)
{ {
lua_newtable(L); lua_newtable(L);
for (auto it = confirmations.begin(); it != confirmations.end(); ++it) for (auto it = confirmations.begin(); it != confirmations.end(); ++it)
table_set(L, it->first, true); Lua::TableInsert(L, it->first, true);
return 1; return 1;
} }
int get_conf_data (lua_State *L) int get_conf_data (lua_State *L)
@ -199,8 +192,8 @@ namespace conf_lua {
{ {
Lua::Push(L, i++); Lua::Push(L, i++);
lua_newtable(L); lua_newtable(L);
table_set(L, "id", it->first); Lua::TableInsert(L, "id", it->first);
table_set(L, "enabled", it->second->is_enabled()); Lua::TableInsert(L, "enabled", it->second->is_enabled());
lua_settable(L, -3); lua_settable(L, -3);
} }
return 1; return 1;

@ -187,14 +187,6 @@ namespace dm_lua {
return safe_call(nargs); return safe_call(nargs);
} }
template <typename KeyType, typename ValueType>
void table_set (lua_State *L, KeyType k, ValueType v)
{
Lua::Push(L, k);
Lua::Push(L, v);
lua_settable(L, -3);
}
namespace api { namespace api {
int monitor_state (lua_State *L) int monitor_state (lua_State *L)
{ {
@ -229,7 +221,7 @@ namespace dm_lua {
} }
} }
lua_newtable(L); lua_newtable(L);
#define WTYPE(type, name) dm_lua::table_set(L, #type, type); #define WTYPE(type, name) Lua::TableInsert(L, #type, type);
WEATHER_TYPES WEATHER_TYPES
#undef WTYPE #undef WTYPE
#undef WEATHER_TYPES #undef WEATHER_TYPES
@ -242,9 +234,9 @@ namespace dm_lua {
{ {
Lua::Push(L, i); Lua::Push(L, i);
lua_newtable(L); lua_newtable(L);
dm_lua::table_set(L, "value", misery[i]); Lua::TableInsert(L, "value", misery[i]);
dm_lua::table_set(L, "color", monitor_colors[i]); Lua::TableInsert(L, "color", monitor_colors[i]);
dm_lua::table_set(L, "last", (i == 6)); Lua::TableInsert(L, "last", (i == 6));
lua_settable(L, -3); lua_settable(L, -3);
} }
return 1; return 1;

@ -1 +1 @@
Subproject commit 352dc4ac8a169bf4789448f01d5121c740669400 Subproject commit de996207994e4ce3e221c010c9cc042b06620a2e