From cf0d45be785fad65457ae2ebaa8d890afad79953 Mon Sep 17 00:00:00 2001 From: Robert Heinrich Date: Sun, 15 Apr 2012 12:32:25 +0200 Subject: [PATCH] merged stuff from peterix --- CMakeLists.txt | 9 +- LUA_API.rst | 36 + Lua API.html | 27 + build/generate-MSVC-all-breakfast.bat | 8 + library/Core.cpp | 20 +- library/DataDefs.cpp | 396 ---------- library/LuaApi.cpp | 88 ++- library/LuaTools.cpp | 17 + library/LuaTypes.cpp | 6 + library/PlugLoad-linux.cpp | 2 +- library/PlugLoad-windows.cpp | 2 +- library/PluginManager.cpp | 112 ++- library/RemoteTools.cpp | 30 + library/VersionInfoFactory.cpp | 9 +- library/include/Core.h | 8 +- library/include/DataFuncs.h | 6 +- library/include/DataIdentity.h | 48 +- library/include/LuaWrapper.h | 11 +- library/include/PluginManager.h | 64 +- library/include/TileTypes.h | 12 + library/include/VersionInfo.h | 32 +- .../df/custom/block_burrow.methods.inc | 9 +- .../block_square_event_mineralst.methods.inc | 9 +- library/include/modules/Items.h | 18 +- library/include/modules/Maps.h | 16 +- library/include/modules/Units.h | 9 + library/lua/dfhack.lua | 19 + library/modules/Items.cpp | 187 ++++- library/modules/Maps.cpp | 73 +- library/modules/Units.cpp | 74 ++ library/proto/Basic.proto | 15 + library/proto/BasicApi.proto | 7 +- plugins/CMakeLists.txt | 15 +- plugins/Dfusion/luafiles/init.lua | 15 +- plugins/Dfusion/luafiles/tools/init.lua | 43 +- plugins/autodump.cpp | 10 +- plugins/burrows.cpp | 678 ++++++++++++++++++ plugins/lua/burrows.lua | 33 + plugins/zone.cpp | 2 + 39 files changed, 1651 insertions(+), 524 deletions(-) create mode 100644 build/generate-MSVC-all-breakfast.bat delete mode 100644 library/DataDefs.cpp create mode 100644 plugins/burrows.cpp create mode 100644 plugins/lua/burrows.lua diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cbbe6a1f..1cbf9ed24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,11 @@ endif(CMAKE_CONFIGURATION_TYPES) cmake_minimum_required(VERSION 2.8 FATAL_ERROR) project(dfhack) +if(MSVC) +# disable C4819 code-page warning +add_definitions( "/wd4819" ) +endif() + # set up folder structures for IDE solutions # MSVC Express won't load solutions that use this. It also doesn't include MFC supported # Check for MFC! @@ -58,9 +63,9 @@ set(DF_VERSION_MINOR "34") set(DF_VERSION_PATCH "07") set(DF_VERSION "${DF_VERSION_MAJOR}.${DF_VERSION_MINOR}.${DF_VERSION_PATCH}") -set(DFHACK_RELEASE "1") +SET(DFHACK_RELEASE "r1" CACHE STRING "Current release revision.") -set(DFHACK_VERSION "${DF_VERSION_MAJOR}.${DF_VERSION_MINOR}.${DF_VERSION_PATCH}-r${DFHACK_RELEASE}") +set(DFHACK_VERSION "${DF_VERSION_MAJOR}.${DF_VERSION_MINOR}.${DF_VERSION_PATCH}-${DFHACK_RELEASE}") add_definitions(-DDFHACK_VERSION="${DFHACK_VERSION}") ## where to install things (after the build is done, classic 'make install' or package structure) diff --git a/LUA_API.rst b/LUA_API.rst index fc86070c3..d5af5e7a4 100644 --- a/LUA_API.rst +++ b/LUA_API.rst @@ -663,6 +663,14 @@ Job module Units module ------------ +* ``dfhack.units.getPosition(unit)`` + + Returns true *x,y,z* of the unit; may be not equal to unit.pos if caged. + +* ``dfhack.units.getContainer(unit)`` + + Returns the container (cage) item or *nil*. + * ``dfhack.units.setNickname(unit,nick)`` Sets the unit's nickname properly. @@ -687,6 +695,10 @@ Units module The unit is capable of rational action, i.e. not dead, insane or zombie. +* ``dfhack.units.clearBurrowMembers(burrow)`` + + Removes all units from the burrow. + * ``dfhack.units.isInBurrow(unit,burrow)`` Checks if the unit is in the burrow. @@ -699,6 +711,10 @@ Units module Items module ------------ +* ``dfhack.items.getPosition(item)`` + + Returns true *x,y,z* of the item; may be not equal to item.pos if in inventory. + * ``dfhack.items.getOwner(item)`` Returns the owner unit or *nil*. @@ -708,6 +724,22 @@ Items module Replaces the owner of the item. If unit is *nil*, removes ownership. Returns *false* in case of error. +* ``dfhack.items.getContainer(item)`` + + Returns the container item or *nil*. + +* ``dfhack.items.getContainedItems(item)`` + + Returns a list of items contained in this one. + +* ``dfhack.items.moveToGround(item,pos)`` + + Move the item to the ground at position. Returns *false* if impossible. + +* ``dfhack.items.moveToContainer(item,container)`` + + Move the item to the container. Returns *false* if impossible. + Maps module ----------- @@ -748,6 +780,10 @@ Maps module Returns a table of map block pointers. +* ``dfhack.maps.clearBurrowTiles(burrow)`` + + Removes all tiles from the burrow. + * ``dfhack.maps.isBurrowTile(burrow,tile_coord)`` Checks if the tile is in burrow. diff --git a/Lua API.html b/Lua API.html index 7c3eeddb9..66385840b 100644 --- a/Lua API.html +++ b/Lua API.html @@ -900,6 +900,12 @@ a lua list containing them.

Units module