diff --git a/src/basic/main.c b/src/basic/main.c index ca8cb5a6c..ad567a8d0 100644 --- a/src/basic/main.c +++ b/src/basic/main.c @@ -30,6 +30,7 @@ int main(int argc, char ** argv) { int err; + log_open("eressea.log"); load_config("eressea.ini"); err = eressea_init(); diff --git a/src/common/eressea.c b/src/common/eressea.c index 38f72b2e8..3c94593ac 100644 --- a/src/common/eressea.c +++ b/src/common/eressea.c @@ -193,10 +193,10 @@ void eressea_done(void) static int log_lua_error(lua_State * L) { - static int s_abort_on_errors = 0; + static int s_abort_on_errors = 1; const char* error = lua_tostring(L, -1); - log_error(("A LUA error occurred: %s\n", error)); + log_error(("LUA call failed.\n%s\n", error)); lua_pop(L, 1); if (s_abort_on_errors) { @@ -207,22 +207,27 @@ log_lua_error(lua_State * L) int eressea_run(const char * luafile, const char * entry_point) { + int err; lua_State * L = (lua_State *)global.vm_state; /* run the main script */ if (luafile) { lua_getglobal(L, "dofile"); lua_pushstring(L, luafile); - if (lua_pcall(L, 1, 0, 0) != 0) { + err = lua_pcall(L, 1, 0, 0); + if (err != 0) { log_lua_error(L); + return err; } } if (entry_point) { lua_getglobal(L, entry_point); - if (lua_pcall(L, 0, 1, 0) != 0) { + err = lua_pcall(L, 0, 1, 0); + if (err != 0) { log_lua_error(L); + return err; } } else { - lua_console(L); + err = lua_console(L); } - return 0; + return err; } diff --git a/src/common/kernel/config.c b/src/common/kernel/config.c index 49026d740..1b688d7b7 100644 --- a/src/common/kernel/config.c +++ b/src/common/kernel/config.c @@ -2226,7 +2226,6 @@ kernel_done(void) * calling it is optional, e.g. a release server will most likely not do it. */ translation_done(); - skill_done(); gc_done(); sql_done(); } @@ -3163,7 +3162,6 @@ void kernel_init(void) { char zBuffer[MAX_PATH]; - skill_init(); attrib_init(); translation_init(); diff --git a/src/common/kernel/skill.c b/src/common/kernel/skill.c index 77674927e..183d55d10 100644 --- a/src/common/kernel/skill.c +++ b/src/common/kernel/skill.c @@ -253,26 +253,6 @@ rc_skillmod(const struct race * rc, const region *r, skill_t sk) return mods; } -void -skill_init(void) -{ -} - -void -skill_done(void) -{ -#ifdef FASTER_SKILLMOD - int i; - for (i = 0;i!=RCMODMAXHASH;++i) { - while (modhash[i]) { - struct skillmods * mods = modhash[i]; - modhash[i] = mods->next; - free(mods); - } - } -#endif -} - int level_days(int level) { diff --git a/src/common/kernel/skill.h b/src/common/kernel/skill.h index e42d87247..1ed5c6ad6 100644 --- a/src/common/kernel/skill.h +++ b/src/common/kernel/skill.h @@ -42,8 +42,6 @@ typedef struct skillmod_data { extern struct attrib_type at_skillmod; extern int rc_skillmod(const struct race * rc, const struct region *r, skill_t sk); extern int skillmod(const struct attrib * a, const struct unit * u, const struct region * r, skill_t sk, int value, int flags); -extern void skill_init(void); -extern void skill_done(void); extern struct attrib * make_skillmod(skill_t sk, unsigned int flags, skillmod_fun special, double multiplier, int bonus); extern const char * skillname(skill_t, const struct locale *);