From ae55d2d526908636edd75e14a24e7e271c602bd8 Mon Sep 17 00:00:00 2001 From: Ben Rosser Date: Sun, 26 Jun 2016 19:48:55 -0400 Subject: [PATCH 01/12] Support linking against an external tinyxml if EXTERNAL_TINYXML is set As best as I can tell, the copy of tinyxml dfhack uses is unmodified from whenever it was first bundled. This commit adds an option to CMake, EXTERNAL_TINYXML, that if set to ON, will attempt to link against a system tinyxml instead of using the dfhack-bundled one. It defaults to OFF, so there is no change in default behavior. The DFHACK_TINYXML variable is then set to either "tinyxml" or "dfhack-tinyxml" so the library (and any plugins that need updating) can link against one or the other. The FindTinyXML.cmake script was taken from https://github.com/ros/cmake_modules (licensed under the 3-clause BSD license). Add license text to new CMake file. --- CMake/Modules/FindTinyXML.cmake | 107 ++++++++++++++++++++++++++++++++ CMakeLists.txt | 17 ++++- depends/CMakeLists.txt | 7 ++- depends/tinyxml/CMakeLists.txt | 8 ++- library/CMakeLists.txt | 6 +- 5 files changed, 137 insertions(+), 8 deletions(-) create mode 100644 CMake/Modules/FindTinyXML.cmake diff --git a/CMake/Modules/FindTinyXML.cmake b/CMake/Modules/FindTinyXML.cmake new file mode 100644 index 000000000..b0466fbd5 --- /dev/null +++ b/CMake/Modules/FindTinyXML.cmake @@ -0,0 +1,107 @@ +# Sourced from: +# https://raw.githubusercontent.com/ros/cmake_modules/0.4-devel/cmake/Modules/FindTinyXML.cmake +# under the following license: https://github.com/ros/cmake_modules/blob/0.4-devel/LICENSE, +# reproduced here: + +# Copyright (c) 2013, Open Source Robotics Foundation +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: + +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. + +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. + +# Neither the name of the {organization} nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +################################################################################################## +# +# CMake script for finding TinyXML. +# +# Input variables: +# +# - TinyXML_ROOT_DIR (optional): When specified, header files and libraries will be searched for in +# ${TinyXML_ROOT_DIR}/include +# ${TinyXML_ROOT_DIR}/libs +# respectively, and the default CMake search order will be ignored. When unspecified, the default +# CMake search order is used. +# This variable can be specified either as a CMake or environment variable. If both are set, +# preference is given to the CMake variable. +# Use this variable for finding packages installed in a nonstandard location, or for enforcing +# that one of multiple package installations is picked up. +# +# +# Cache variables (not intended to be used in CMakeLists.txt files) +# +# - TinyXML_INCLUDE_DIR: Absolute path to package headers. +# - TinyXML_LIBRARY: Absolute path to library. +# +# +# Output variables: +# +# - TinyXML_FOUND: Boolean that indicates if the package was found +# - TinyXML_INCLUDE_DIRS: Paths to the necessary header files +# - TinyXML_LIBRARIES: Package libraries +# +# +# Example usage: +# +# find_package(TinyXML) +# if(NOT TinyXML_FOUND) +# # Error handling +# endif() +# ... +# include_directories(${TinyXML_INCLUDE_DIRS} ...) +# ... +# target_link_libraries(my_target ${TinyXML_LIBRARIES}) +# +################################################################################################## + +# Get package location hint from environment variable (if any) +if(NOT TinyXML_ROOT_DIR AND DEFINED ENV{TinyXML_ROOT_DIR}) + set(TinyXML_ROOT_DIR "$ENV{TinyXML_ROOT_DIR}" CACHE PATH + "TinyXML base directory location (optional, used for nonstandard installation paths)") +endif() + +# Search path for nonstandard package locations +if(TinyXML_ROOT_DIR) + set(TinyXML_INCLUDE_PATH PATHS "${TinyXML_ROOT_DIR}/include" NO_DEFAULT_PATH) + set(TinyXML_LIBRARY_PATH PATHS "${TinyXML_ROOT_DIR}/lib" NO_DEFAULT_PATH) +endif() + +# Find headers and libraries +find_path(TinyXML_INCLUDE_DIR NAMES tinyxml.h PATH_SUFFIXES "tinyxml" ${TinyXML_INCLUDE_PATH}) +find_library(TinyXML_LIBRARY NAMES tinyxml PATH_SUFFIXES "tinyxml" ${TinyXML_LIBRARY_PATH}) + +mark_as_advanced(TinyXML_INCLUDE_DIR + TinyXML_LIBRARY) + +# Output variables generation +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(TinyXML DEFAULT_MSG TinyXML_LIBRARY + TinyXML_INCLUDE_DIR) + +set(TinyXML_FOUND ${TINYXML_FOUND}) # Enforce case-correctness: Set appropriately cased variable... +unset(TINYXML_FOUND) # ...and unset uppercase variable generated by find_package_handle_standard_args + +if(TinyXML_FOUND) + set(TinyXML_INCLUDE_DIRS ${TinyXML_INCLUDE_DIR}) + set(TinyXML_LIBRARIES ${TinyXML_LIBRARY}) +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bd89edce..533fba9ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,7 +186,22 @@ include_directories(depends/protobuf) include_directories(depends/lua/include) include_directories(depends/md5) include_directories(depends/jsoncpp) -include_directories(depends/tinyxml) + +# Support linking against external tinyxml +# If we find an external tinyxml, set the DFHACK_TINYXML variable to "tinyxml" +# Otherwise, set it to "dfhack-tinyxml" +option(EXTERNAL_TINYXML "Choose to link against external TinyXML" OFF) +if(EXTERNAL_TINYXML) + find_package(TinyXML REQUIRED) + if(NOT TinyXML_FOUND) + message(SEND_ERROR "Could not find an external TinyXML, consider setting EXTERNAL_TINYXML to OFF.") + endif() + SET(DFHACK_TINYXML "tinyxml") +else() + include_directories(depends/tinyxml) + SET(DFHACK_TINYXML "dfhack-tinyxml") +endif() + include_directories(depends/tthread) include_directories(${ZLIB_INCLUDE_DIRS}) include_directories(depends/clsocket/src) diff --git a/depends/CMakeLists.txt b/depends/CMakeLists.txt index bf0345bfb..d8442b12a 100644 --- a/depends/CMakeLists.txt +++ b/depends/CMakeLists.txt @@ -2,7 +2,12 @@ add_subdirectory(lua) add_subdirectory(md5) add_subdirectory(protobuf) -add_subdirectory(tinyxml) + +# Don't build tinyxml if it's being externally linked against. +if(NOT TinyXML_FOUND) + add_subdirectory(tinyxml) +endif() + add_subdirectory(tthread) add_subdirectory(jsoncpp) # build clsocket static and only as a dependency. Setting those options here overrides its own default settings. diff --git a/depends/tinyxml/CMakeLists.txt b/depends/tinyxml/CMakeLists.txt index 7d924924f..313837cac 100644 --- a/depends/tinyxml/CMakeLists.txt +++ b/depends/tinyxml/CMakeLists.txt @@ -1,3 +1,5 @@ -project(dfhack-tinyxml) -ADD_LIBRARY(dfhack-tinyxml STATIC EXCLUDE_FROM_ALL tinystr.cpp tinyxml.cpp tinyxmlerror.cpp tinyxmlparser.cpp) -IDE_FOLDER(dfhack-tinyxml "Depends") \ No newline at end of file +if(NOT TinyXML_FOUND) + project(dfhack-tinyxml) + ADD_LIBRARY(dfhack-tinyxml STATIC EXCLUDE_FROM_ALL tinystr.cpp tinyxml.cpp tinyxmlerror.cpp tinyxmlparser.cpp) + IDE_FOLDER(dfhack-tinyxml "Depends") +endif() diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 3a6cd4dc8..346776865 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -269,12 +269,12 @@ IF(UNIX) ENDIF() IF(APPLE) - SET(PROJECT_LIBS dl dfhack-md5 dfhack-tinyxml dfhack-tinythread) + SET(PROJECT_LIBS dl dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread) ELSEIF(UNIX) - SET(PROJECT_LIBS rt dl dfhack-md5 dfhack-tinyxml dfhack-tinythread) + SET(PROJECT_LIBS rt dl dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread) ELSE(WIN32) #FIXME: do we really need psapi? - SET(PROJECT_LIBS psapi dfhack-md5 dfhack-tinyxml dfhack-tinythread) + SET(PROJECT_LIBS psapi dfhack-md5 ${DFHACK_TINYXML} dfhack-tinythread) ENDIF() ADD_LIBRARY(dfhack-version STATIC DFHackVersion.cpp) From af906d6582622dd2599cf992feb963df704afdbb Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 29 Jun 2016 19:06:00 -0400 Subject: [PATCH 02/12] Remove library/scripts submodule --- .gitmodules | 3 --- library/scripts | 1 - 2 files changed, 4 deletions(-) delete mode 160000 library/scripts diff --git a/.gitmodules b/.gitmodules index cbb4c538d..9f1b48395 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,6 +10,3 @@ [submodule "depends/clsocket"] path = depends/clsocket url = git://github.com/DFHack/clsocket.git -[submodule "library/scripts"] - path = library/scripts - url = git://github.com/dfhack/scripts.git diff --git a/library/scripts b/library/scripts deleted file mode 160000 index b67885c0c..000000000 --- a/library/scripts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b67885c0c07931a402a3b642a4e2468f14782058 From 85a920d1df167d48da89aaadb4679a60788f1225 Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 29 Jun 2016 19:07:45 -0400 Subject: [PATCH 03/12] Re-add the scripts submodule, with a different internal name This will break existing clones when using git versions before 1.8.1, which do not support the --name option of "git submodule add", unless steps are taken to remove the old scripts submodules in .git/modules (see Compile.rst). --- .gitmodules | 3 +++ scripts | 1 + 2 files changed, 4 insertions(+) create mode 160000 scripts diff --git a/.gitmodules b/.gitmodules index 9f1b48395..687dae006 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "depends/clsocket"] path = depends/clsocket url = git://github.com/DFHack/clsocket.git +[submodule "scripts2"] + path = scripts + url = git://github.com/dfhack/scripts.git diff --git a/scripts b/scripts new file mode 160000 index 000000000..b67885c0c --- /dev/null +++ b/scripts @@ -0,0 +1 @@ +Subproject commit b67885c0c07931a402a3b642a4e2468f14782058 From cfaba3ec71b0b88a4f01f434f539784349231385 Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 29 Jun 2016 19:38:15 -0400 Subject: [PATCH 04/12] Update various references to scripts/ and mention old git issues in Compile.rst --- .travis.yml | 2 +- CMakeLists.txt | 10 ++++++---- conf.py | 4 ++-- docs/Compile.rst | 18 +++++++++++++++++- library/CMakeLists.txt | 9 --------- 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index b7ac6ae18..1455044aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ script: - python travis/authors-rst.py - python travis/script-in-readme.py - python travis/script-syntax.py --ext=lua --cmd="luac5.2 -p" -- python travis/script-syntax.py --ext=rb --cmd="ruby -c" --path library/scripts/ +- python travis/script-syntax.py --ext=rb --cmd="ruby -c" - mkdir build-travis - cd build-travis - cmake .. -DCMAKE_C_COMPILER=gcc-$GCC_VERSION -DCMAKE_CXX_COMPILER=g++-$GCC_VERSION -DBUILD_DOCS:BOOL=ON diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bd89edce..9b9b985c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,6 +210,8 @@ IF(BUILD_PLUGINS) add_subdirectory (plugins) endif() +add_subdirectory(scripts) + find_package(Sphinx QUIET) if (BUILD_DOCS) if (NOT SPHINX_FOUND) @@ -221,12 +223,12 @@ if (BUILD_DOCS) "${CMAKE_CURRENT_SOURCE_DIR}/docs/images/*.png" "${CMAKE_CURRENT_SOURCE_DIR}/docs/styles/*" "${CMAKE_CURRENT_SOURCE_DIR}/conf.py" - "${CMAKE_CURRENT_SOURCE_DIR}/library/scripts/about.txt" - "${CMAKE_CURRENT_SOURCE_DIR}/library/scripts/*/about.txt" + "${CMAKE_CURRENT_SOURCE_DIR}/scripts/about.txt" + "${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/about.txt" ) file(GLOB_RECURSE SPHINX_SCRIPT_DEPS - "${CMAKE_CURRENT_SOURCE_DIR}/library/scripts/*.lua" - "${CMAKE_CURRENT_SOURCE_DIR}/library/scripts/*.rb" + "${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.lua" + "${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.rb" ) set(SPHINX_DEPS ${SPHINX_DEPS} ${SPHINX_SCRIPT_DEPS} "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.rst" diff --git a/conf.py b/conf.py index 52f715ec5..10df1b551 100644 --- a/conf.py +++ b/conf.py @@ -52,7 +52,7 @@ def document_scripts(): """ # First, we collect the commands and paths to include in our docs scripts = [] - for root, _, files in os.walk('library/scripts'): + for root, _, files in os.walk('scripts'): scripts.extend(doc_dir(root, files)) # Next we split by type and create include directives sorted by command kinds = {'base': [], 'devel': [], 'fix': [], 'gui': [], 'modtools': []} @@ -84,7 +84,7 @@ def write_script_docs(): 'modtools': 'Scripts for Modders'} for k in head: title = ('.. _{k}:\n\n{l}\n{t}\n{l}\n\n' - '.. include:: /library/scripts/{a}about.txt\n\n' + '.. include:: /scripts/{a}about.txt\n\n' '.. contents::\n\n').format( k=k, t=head[k], l=len(head[k])*'#', diff --git a/docs/Compile.rst b/docs/Compile.rst index 006c1d263..650abbfca 100644 --- a/docs/Compile.rst +++ b/docs/Compile.rst @@ -35,7 +35,21 @@ To get the latest development code (develop branch), clone as above and then:: You must run ``git submodule update`` every time you change Git branch, for example when switching between master and develop branches and back. - +If a submodule only exists on the newer branch, you also need to run +``git submodule update --init``. Failure to do this may result in strange +build errors or "not a known DF version" errors. + +**Important note regarding very old git versions** + +If you are using git 1.8.0 or older, and cloned DFHack before commit 85a920d +(around DFHack v0.43.03-alpha1), you may run into fatal git errors when updating +submodules after switching branches. This is due to those versions of git being +unable to handle our change from "scripts/3rdparty/name" submodules to a single +"scripts" submodule. This may be fixable by renaming .git/modules/scripts to +something else and re-running ``git submodule update --init`` on the branch with +the single scripts submodule (and running it again when switching back to the +one with multiple submodules, if necessary), but it is usually much simpler to +upgrade your git version. Contributing to DFHack ====================== @@ -47,6 +61,8 @@ and whenever you need help. .. _IRC: https://webchat.freenode.net/?channels=dfhack +(Note: for submodule issues, please see the above instructions first!) + For lots more details on contributing to DFHack, including pull requests, code format, and more, please see `contributing-code`. diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 3a6cd4dc8..116f0c4b3 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -407,13 +407,6 @@ install(DIRECTORY lua/ DESTINATION ${DFHACK_LUA_DESTINATION} FILES_MATCHING PATTERN "*.lua") -#install(DIRECTORY ${dfhack_SOURCE_DIR}/scripts -# DESTINATION ${DFHACK_DATA_DESTINATION} -# FILES_MATCHING PATTERN "*.lua" -# PATTERN "*.rb" -# PATTERN "3rdparty" EXCLUDE -# ) - install(DIRECTORY ${dfhack_SOURCE_DIR}/patches DESTINATION ${DFHACK_DATA_DESTINATION} FILES_MATCHING PATTERN "*.dif") @@ -434,5 +427,3 @@ if(BUILD_DEVEL) add_subdirectory (doc) ENDIF() endif() - -add_subdirectory(scripts) From b196ecf351aebdf860b9475c85f36e60cd9e9d14 Mon Sep 17 00:00:00 2001 From: Japa Date: Thu, 30 Jun 2016 14:33:15 +0530 Subject: [PATCH 05/12] Send over material tissues through RemoteFortressReader --- plugins/proto/RemoteFortressReader.proto | 9 +++++++++ plugins/remotefortressreader.cpp | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/plugins/proto/RemoteFortressReader.proto b/plugins/proto/RemoteFortressReader.proto index b7ca674fb..96007da7a 100644 --- a/plugins/proto/RemoteFortressReader.proto +++ b/plugins/proto/RemoteFortressReader.proto @@ -492,6 +492,14 @@ message BpAppearanceModifier optional int32 mod_max = 3; } +message TissueRaw +{ + optional string id = 1; + optional string name = 2; + optional MatPair material = 3; + optional string subordinate_to_tissue = 4; +} + message CasteRaw { optional int32 index = 1; @@ -524,6 +532,7 @@ message CreatureRaw optional ColorDefinition color = 8; optional int32 adultsize = 9; repeated CasteRaw caste = 10; + repeated TissueRaw tissues = 11; } message CreatureRawList diff --git a/plugins/remotefortressreader.cpp b/plugins/remotefortressreader.cpp index fe8aae53e..9a751102f 100644 --- a/plugins/remotefortressreader.cpp +++ b/plugins/remotefortressreader.cpp @@ -62,6 +62,7 @@ #include "df/unit.h" #include "df/creature_raw.h" #include "df/caste_raw.h" +#include "df/tissue.h" #include "df/enabler.h" #include "df/graphic.h" @@ -2409,7 +2410,22 @@ static command_result GetCreatureRaws(color_ostream &stream, const EmptyMessage send_caste->set_description(orig_caste->description); send_caste->set_adult_size(orig_caste->misc.adult_size); } - } + + for (int j = 0; j < orig_creature->tissue.size(); j++) + { + auto orig_tissue = orig_creature->tissue[j]; + auto send_tissue = send_creature->add_tissues(); + + send_tissue->set_id(orig_tissue->id); + send_tissue->set_name(orig_tissue->tissue_name_singular); + send_tissue->set_subordinate_to_tissue(orig_tissue->subordinate_to_tissue); + + auto send_mat = send_tissue->mutable_material(); + + send_mat->set_mat_index(orig_tissue->mat_index); + send_mat->set_mat_type(orig_tissue->mat_type); + } +} return CR_OK; } From b37afa459118a52fe6fb27ca94f778dc1c0b7744 Mon Sep 17 00:00:00 2001 From: Japa Date: Thu, 30 Jun 2016 15:12:28 +0530 Subject: [PATCH 06/12] Remove tabs --- plugins/proto/RemoteFortressReader.proto | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/proto/RemoteFortressReader.proto b/plugins/proto/RemoteFortressReader.proto index 96007da7a..c5c778b1f 100644 --- a/plugins/proto/RemoteFortressReader.proto +++ b/plugins/proto/RemoteFortressReader.proto @@ -494,10 +494,10 @@ message BpAppearanceModifier message TissueRaw { - optional string id = 1; - optional string name = 2; - optional MatPair material = 3; - optional string subordinate_to_tissue = 4; + optional string id = 1; + optional string name = 2; + optional MatPair material = 3; + optional string subordinate_to_tissue = 4; } message CasteRaw @@ -532,7 +532,7 @@ message CreatureRaw optional ColorDefinition color = 8; optional int32 adultsize = 9; repeated CasteRaw caste = 10; - repeated TissueRaw tissues = 11; + repeated TissueRaw tissues = 11; } message CreatureRawList @@ -623,4 +623,4 @@ message KeyboardEvent optional uint32 mod = 6; optional uint32 unicode = 7; } - \ No newline at end of file + From 13b328beebae8557d1a6da1c3bf73be00b45dbb4 Mon Sep 17 00:00:00 2001 From: Japa Date: Thu, 30 Jun 2016 15:14:20 +0530 Subject: [PATCH 07/12] Remove tabs --- plugins/remotefortressreader.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/remotefortressreader.cpp b/plugins/remotefortressreader.cpp index 9a751102f..7a853db82 100644 --- a/plugins/remotefortressreader.cpp +++ b/plugins/remotefortressreader.cpp @@ -2411,20 +2411,20 @@ static command_result GetCreatureRaws(color_ostream &stream, const EmptyMessage send_caste->set_adult_size(orig_caste->misc.adult_size); } - for (int j = 0; j < orig_creature->tissue.size(); j++) - { - auto orig_tissue = orig_creature->tissue[j]; - auto send_tissue = send_creature->add_tissues(); + for (int j = 0; j < orig_creature->tissue.size(); j++) + { + auto orig_tissue = orig_creature->tissue[j]; + auto send_tissue = send_creature->add_tissues(); - send_tissue->set_id(orig_tissue->id); - send_tissue->set_name(orig_tissue->tissue_name_singular); - send_tissue->set_subordinate_to_tissue(orig_tissue->subordinate_to_tissue); + send_tissue->set_id(orig_tissue->id); + send_tissue->set_name(orig_tissue->tissue_name_singular); + send_tissue->set_subordinate_to_tissue(orig_tissue->subordinate_to_tissue); - auto send_mat = send_tissue->mutable_material(); + auto send_mat = send_tissue->mutable_material(); - send_mat->set_mat_index(orig_tissue->mat_index); - send_mat->set_mat_type(orig_tissue->mat_type); - } + send_mat->set_mat_index(orig_tissue->mat_index); + send_mat->set_mat_type(orig_tissue->mat_type); + } } return CR_OK; From 163207e362dbd850e356d9e21051cc049958c5fb Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 30 Jun 2016 20:42:27 -0400 Subject: [PATCH 08/12] Give more feedback for DF detection failures with mismatched XML versions This may help address issues where people forget to read the documentation, don't run "git submodule update", and end up with a df-structures version that's too old (which is somewhat common, it turns out). --- library/Core.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/library/Core.cpp b/library/Core.cpp index f5bc9d4e7..fb1dd80bb 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -1485,7 +1485,34 @@ bool Core::Init() if(!vinfo || !p->isIdentified()) { - fatal("Not a known DF version.\n"); + if (!Version::git_xml_match()) + { + const char *msg = ( + "*******************************************************\n" + "* BIG, UGLY ERROR MESSAGE *\n" + "*******************************************************\n" + "\n" + "This DF version is missing from hack/symbols.xml, and\n" + "you have compiled DFHack with a df-structures (xml)\n" + "version that does *not* match the version tracked in git.\n" + "\n" + "If you are not actively working on df-structures and you\n" + "expected DFHack to work, you probably forgot to run\n" + "\n" + " git submodule update\n" + "\n" + "If this does not sound familiar, read Compile.rst and \n" + "recompile.\n" + "More details can be found in stderr.log in this folder.\n" + ); + cout << msg << endl; + cerr << msg << endl; + fatal("Not a known DF version - XML version mismatch (see console or stderr.log)"); + } + else + { + fatal("Not a known DF version.\n"); + } errorstate = true; delete p; p = NULL; From 233a5e9c10d3838110f4b2db912bef54d6edbec7 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sun, 3 Jul 2016 23:30:03 -0400 Subject: [PATCH 09/12] Update scripts --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index b67885c0c..022cb9ef7 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit b67885c0c07931a402a3b642a4e2468f14782058 +Subproject commit 022cb9ef78f13786a3ff6122c49b16090edf8aa5 From 2de2e6a983964cbfd81455b63e9a6b4e9722acd3 Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 6 Jul 2016 20:30:28 -0400 Subject: [PATCH 10/12] Update CMakeLists and submodules --- CMakeLists.txt | 2 +- library/xml | 2 +- scripts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b9b985c2..3f3e24fee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,7 +106,7 @@ endif() # set up versioning. set(DF_VERSION "0.43.03") -SET(DFHACK_RELEASE "alpha1") +SET(DFHACK_RELEASE "r1") SET(DFHACK_PRERELEASE TRUE) set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") diff --git a/library/xml b/library/xml index b9178de68..68d8a108b 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit b9178de68bd67442ff720f18b04d222302ce9f8c +Subproject commit 68d8a108bdb3d0f38b4a8862bc9d8c9d9362645a diff --git a/scripts b/scripts index 022cb9ef7..7574e08b9 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 022cb9ef78f13786a3ff6122c49b16090edf8aa5 +Subproject commit 7574e08b9af0397d6830949c49a344cd5d0134de From 39aa143cfac00dcfa87abd7af7ff1aaafdd48d58 Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 6 Jul 2016 20:59:49 -0400 Subject: [PATCH 11/12] Update NEWS and submodules --- NEWS.rst | 23 ++++++++++++++++++++--- library/xml | 2 +- scripts | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/NEWS.rst b/NEWS.rst index 7d9630c32..dcc87b04a 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -30,8 +30,8 @@ Changelog .. contents:: :depth: 2 -DFHack future -============= +DFHack 0.43.03-r1 +================= Lua --- @@ -39,18 +39,35 @@ Lua New Features ------------ -- `gui/gm-editor` it's now possible to insert default types to containers. For primitive types leave the type entry empty, for references use ``*``. +- `add-thought`: allow syndrome name as ``-thought`` argument +- `gui/gm-editor` + + - Added ability to insert default types into containers. For primitive types leave the type entry empty, and for references use ``*``. + - Added ``shift-esc`` binding to fully exit from editor + - Added ``gui/gm-editor toggle`` command to toggle editor visibility (saving position) + +- `modtools/create-unit`: + + - Added an option to attach units to an existing wild animal population + - Added an option to attach units to a map feature Fixes ----- +- `autofarm`: Can now handle crops that grow for more than a season +- `combine-plants`: Fixed recursion into sub-containers - `createitem`: Now moves multiple created items to cursor correctly - `exportlegends`: Improved handling of unknown enum items (fixes many errors) - `gui/create-item`: Fixed quality when creating multiple items - `gui/mod-manager`: Fixed error when mods folder doesn't exist - `modtools/item-trigger`: Fixed handling of items with subtypes +- `stockflow`: + + - Can order metal mechanisms + - Fixed material category of thread-spinning jobs Misc Improvements ----------------- +- The built-in ``ls`` command now wraps the descriptions of commands - `catsplosion`: now a lua script instead of a plugin - `fix/diplomats`: replaces ``fixdiplomats`` - `fix/merchants`: replaces ``fixmerchants`` diff --git a/library/xml b/library/xml index 68d8a108b..7d312334c 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 68d8a108bdb3d0f38b4a8862bc9d8c9d9362645a +Subproject commit 7d312334c320022cd6275cddcdb8a64d4ed8d722 diff --git a/scripts b/scripts index 7574e08b9..b9f223612 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 7574e08b9af0397d6830949c49a344cd5d0134de +Subproject commit b9f223612bbcebfa8aa3de368fd5deadc1d4589d From 98893793bd19d359b75771279d694bff7dd34ede Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 6 Jul 2016 21:27:54 -0400 Subject: [PATCH 12/12] Turn off prerelease flag --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d12c27179..10a831c28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,7 @@ endif() # set up versioning. set(DF_VERSION "0.43.03") SET(DFHACK_RELEASE "r1") -SET(DFHACK_PRERELEASE TRUE) +SET(DFHACK_PRERELEASE FALSE) set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}")