diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 43f109fed..7be3dd3b1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -187,6 +187,15 @@ target_link_libraries(eressea ${INIPARSER_LIBRARIES} ) +add_executable(convert convert.c) +target_link_libraries(convert + game + ${LUA_MATH_LIBRARY} + ${STORAGE_LIBRARIES} + ${CLIBS_LIBRARIES} + ${INIPARSER_LIBRARIES} +) + set(TESTS_SRC monsters.test.c names.test.c @@ -268,6 +277,7 @@ endif(CURSES_FOUND) if (LIBXML2_FOUND) include_directories (${LIBXML2_INCLUDE_DIR}) target_link_libraries(eressea ${LIBXML2_LIBRARIES}) +target_link_libraries(convert ${LIBXML2_LIBRARIES}) target_link_libraries(test_eressea ${LIBXML2_LIBRARIES}) add_definitions(-DUSE_LIBXML2) endif (LIBXML2_FOUND) diff --git a/src/convert.c b/src/convert.c new file mode 100644 index 000000000..a67c5a287 --- /dev/null +++ b/src/convert.c @@ -0,0 +1,44 @@ +#include + + +#ifdef USE_LIBXML2 +#include +#include +#endif +#include +#include +#include + +#include + +#include + +static int usage(void) { + return -1; +} + +int main(int argc, char **argv) { + const char *mode; + + register_races(); +#ifdef USE_LIBXML2 + register_xmlreader(); +#endif + if (argc < 2) return usage(); + mode = argv[1]; +#ifdef USE_LIBXML2 + if (strcmp(mode, "rules")==0) { + const char *xmlfile, *catalog; + if (argc < 4) return usage(); + xmlfile = argv[2]; + catalog = argv[3]; + read_xml(xmlfile, catalog); + write_rules("rules.dat"); + return 0; + } +#endif + if (strcmp(mode, "po")==0) { + return 0; + } + return usage(); +} diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt index d3a2e8e56..b8423ae03 100644 --- a/src/kernel/CMakeLists.txt +++ b/src/kernel/CMakeLists.txt @@ -54,6 +54,7 @@ pool.c race.c region.c resources.c +rules.c save.c ship.c skills.c diff --git a/src/kernel/rules.c b/src/kernel/rules.c new file mode 100644 index 000000000..c7499fe0c --- /dev/null +++ b/src/kernel/rules.c @@ -0,0 +1,12 @@ +#include +#include "rules.h" + +int write_rules(const char *filename) { + return -1; +} + +int read_rules(const char *filename) +{ + return -1; +} + diff --git a/src/kernel/rules.h b/src/kernel/rules.h new file mode 100644 index 000000000..98f0bf240 --- /dev/null +++ b/src/kernel/rules.h @@ -0,0 +1,5 @@ +#pragma once + +int read_rules(const char *filename); +int write_rules(const char * filename); +