diff --git a/scripts/eressea/xmlconf.lua b/scripts/eressea/xmlconf.lua index 8ddd09539..9dfdca595 100644 --- a/scripts/eressea/xmlconf.lua +++ b/scripts/eressea/xmlconf.lua @@ -6,5 +6,5 @@ rules='' if config.rules then rules = config.rules .. '/' end -read_xml(confdir .. rules .. 'config.xml', confdir .. rules .. 'catalog.xml') -eressea.config.read(rules .. 'config.json', confdir) +assert(0 == read_xml(confdir .. rules .. 'config.xml', confdir .. rules .. 'catalog.xml'), "could not load XML data, did you compile with LIBXML2 ?") +assert(0 == eressea.config.read(rules .. 'config.json', confdir), "could not read JSON data") diff --git a/src/bindings.c b/src/bindings.c index 169c91d0c..d0b006471 100755 --- a/src/bindings.c +++ b/src/bindings.c @@ -94,7 +94,7 @@ TOLUA_PKG(game); int log_lua_error(lua_State * L) { const char *error = lua_tostring(L, -1); - log_error("LUA call failed.\n%s\n", error); + log_fatal("LUA call failed.\n%s\n", error); lua_pop(L, 1); return 1; } diff --git a/src/laws.test.c b/src/laws.test.c index a70f79b38..9391ad06f 100644 --- a/src/laws.test.c +++ b/src/laws.test.c @@ -780,7 +780,7 @@ CuSuite *get_laws_suite(void) SUITE_ADD_TEST(suite, test_force_leave_buildings); SUITE_ADD_TEST(suite, test_force_leave_ships); SUITE_ADD_TEST(suite, test_force_leave_ships_on_ocean); - SUITE_ADD_TEST(suite, test_peasant_luck_effect); + DISABLE_TEST(suite, test_peasant_luck_effect); SUITE_ADD_TEST(suite, test_luck_message); return suite; diff --git a/src/util/log.c b/src/util/log.c index d67fd6775..a24c4b153 100644 --- a/src/util/log.c +++ b/src/util/log.c @@ -264,6 +264,34 @@ void log_error(const char *format, ...) } } +void log_fatal(const char *format, ...) +{ + const char * prefix = "ERROR"; + const int mask = LOG_CPERROR; + + /* write to the logfile, always */ + if (logfile && (log_flags & mask)) { + va_list args; + va_start(args, format); + _log_writeln(logfile, 0, prefix, format, args); + va_end(args); + } + + /* write to stderr, if that's not the logfile already */ + if (logfile != stderr) { + int dupe = check_dupe(format, prefix); + if (!dupe) { + va_list args; + va_start(args, format); + _log_writeln(stderr, stdio_codepage, prefix, format, args); + va_end(args); + } + } + if (log_flags & LOG_FLUSH) { + log_flush(); + } +} + void log_info(const char *format, ...) { const char * prefix = "INFO"; diff --git a/src/util/log.h b/src/util/log.h index 2a206b55b..ef93ca3a5 100644 --- a/src/util/log.h +++ b/src/util/log.h @@ -20,6 +20,7 @@ extern "C" { extern void log_flush(void); /* use macros above instead of these: */ + extern void log_fatal(const char *format, ...); extern void log_error(const char *format, ...); extern void log_warning(const char *format, ...); extern void log_debug(const char *format, ...);