Merge branch 'convert' into develop

This commit is contained in:
Enno Rehling 2017-02-26 15:33:57 +01:00
commit e34e71f0f4
5 changed files with 72 additions and 0 deletions

View File

@ -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)

44
src/convert.c Normal file
View File

@ -0,0 +1,44 @@
#include <platform.h>
#ifdef USE_LIBXML2
#include <kernel/xmlreader.h>
#include <util/xml.h>
#endif
#include <kernel/race.h>
#include <kernel/rules.h>
#include <races/races.h>
#include <storage.h>
#include <string.h>
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();
}

View File

@ -54,6 +54,7 @@ pool.c
race.c
region.c
resources.c
rules.c
save.c
ship.c
skills.c

12
src/kernel/rules.c Normal file
View File

@ -0,0 +1,12 @@
#include <platform.h>
#include "rules.h"
int write_rules(const char *filename) {
return -1;
}
int read_rules(const char *filename)
{
return -1;
}

5
src/kernel/rules.h Normal file
View File

@ -0,0 +1,5 @@
#pragma once
int read_rules(const char *filename);
int write_rules(const char * filename);