It has the usual installer wizard. Make sure you let it add its binary folder
to your binary search PATH so the tool can be later run from anywhere.
You'll also need a copy of Microsoft Visual C++ 2010. The Express version is sufficient.
+
You'll need a copy of Microsoft Visual C++ 2010. The Express version is sufficient.
Grab it from Microsoft's site.
For the code generation parts, you'll need perl and XML::LibXML. You can install them like this:
+* download and install strawberry perl from http://strawberryperl.com/
+* reboot so that the system can pick up the new binary path
+* open a cmd.exe window and run "cpan XML::LibXML" (obviously without the quotes). This can take a while to complete.
Open the build folder and double click the batch script there. This will eventually open
diff --git a/Memory.xml b/Memory.xml
index 366dc48ba..b4f7ce1f3 100644
--- a/Memory.xml
+++ b/Memory.xml
@@ -1078,6 +1078,13 @@
+
+
+
+
+
+
+
@@ -2309,6 +2316,13 @@
+
+
+
+
+
+
+
cmake
item vector:
@@ -3174,6 +3188,13 @@
+
+
+
+
+
+
+
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
index 195ffa6e1..9a87db9af 100644
--- a/library/CMakeLists.txt
+++ b/library/CMakeLists.txt
@@ -15,6 +15,10 @@ include_directories (depends/tinyxml)
include_directories (depends/tthread)
include_directories (private)
+execute_process(COMMAND perl xml/list.pl xml include/dfhack/df ";"
+ WORKING_DIRECTORY ${dfapi_SOURCE_DIR}
+ OUTPUT_VARIABLE GENERATED_HDRS)
+
SET(PROJECT_HDRS_INTERNAL
private/ContextShared.h
private/Internal.h
@@ -25,6 +29,7 @@ SET(PROJECT_HDRS
include/DFHack.h
include/dfhack/Console.h
include/dfhack/Core.h
+include/dfhack/DataDefs.h
include/dfhack/Error.h
include/dfhack/Export.h
include/dfhack/FakeSDL.h
@@ -60,6 +65,8 @@ include/dfhack/modules/Graphic.h
SET(PROJECT_SRCS
Core.cpp
+DataDefs.cpp
+DataStatics.cpp
PluginManager.cpp
TileTypes.cpp
VersionInfo.cpp
@@ -123,6 +130,24 @@ SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
+# Generation
+
+SET_SOURCE_FILES_PROPERTIES(${GENERATED_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE GENERATED TRUE)
+
+FILE(GLOB GENERATE_INPUT_XMLS ${dfapi_SOURCE_DIR}/xml/*.xml)
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${dfapi_SOURCE_DIR}/include/dfhack/df/static.inc
+ COMMAND perl xml/codegen.pl xml include/dfhack/df
+ WORKING_DIRECTORY ${dfapi_SOURCE_DIR}
+ MAIN_DEPENDENCY ${dfapi_SOURCE_DIR}/xml/codegen.pl
+ DEPENDS ${GENERATE_INPUT_XMLS}
+)
+
+ADD_CUSTOM_TARGET(generate_headers DEPENDS ${dfapi_SOURCE_DIR}/include/dfhack/df/static.inc)
+
+# Compilation
+
ADD_DEFINITIONS(-DBUILD_DFHACK_LIB)
IF(UNIX)
@@ -142,6 +167,7 @@ ELSE(WIN32)
ENDIF()
ADD_LIBRARY(dfhack SHARED ${PROJECT_SRCS})
+ADD_DEPENDENCIES(dfhack generate_headers)
IF(WIN32)
SET_TARGET_PROPERTIES(dfhack PROPERTIES OUTPUT_NAME "SDL" )
diff --git a/library/Core.cpp b/library/Core.cpp
index f218f2756..5296a057e 100644
--- a/library/Core.cpp
+++ b/library/Core.cpp
@@ -37,6 +37,7 @@ using namespace std;
#include "dfhack/Error.h"
#include "dfhack/Process.h"
#include "dfhack/Core.h"
+#include "dfhack/DataDefs.h"
#include "dfhack/Console.h"
#include "dfhack/Module.h"
#include "dfhack/VersionInfoFactory.h"
@@ -494,6 +495,10 @@ bool Core::Init()
dump << vinfo->PrintOffsets();
dump.close();
}
+
+ // initialize data defs
+ virtual_identity::Init();
+ InitDataDefGlobals(this);
// create mutex for syncing with interactive tasks
StackMutex = new mutex();
diff --git a/library/DataDefs.cpp b/library/DataDefs.cpp
new file mode 100644
index 000000000..2f1f9c238
--- /dev/null
+++ b/library/DataDefs.cpp
@@ -0,0 +1,137 @@
+/*
+https://github.com/peterix/dfhack
+Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include "Internal.h"
+
+#include
+#include
+#include