Exemple #1
0
int main(int argc, char **argv)
{
    int err = 0;
    lua_State *L;
    setup_signal_handler();
    /* parse args once to read config file location */
    if (parse_args(argc, argv, &err) != 0) {
        return err;
    }
    /* ini file sets defaults for arguments*/
    parse_config(inifile);
    if (!global.inifile) {
        log_error("could not open ini configuration %s\n", inifile);
    }
    /* parse arguments again, to override ini file */
    parse_args(argc, argv, &err);

    log_open(logfile);
    locale_init();

#ifdef CRTDBG
    init_crtdbg();
#endif

    L = lua_init();
    game_init();
    bind_monsters(L);
    err = eressea_run(L, luafile);
    if (err) {
        log_error("script %s failed with code %d\n", luafile, err);
        return err;
    }
#ifdef MSPACES
    malloc_stats();
#endif

    game_done();
    lua_done(L);
    log_close();
    if (global.inifile) {
        iniparser_freedict(global.inifile);
    }
    return 0;
}
Exemple #2
0
int main(int argc, char **argv)
{
  int err, result = 0;
  lua_State *L;
  setup_signal_handler();
  parse_config(inifile);
  log_open(logfile);

  err = parse_args(argc, argv, &result);
  if (err) {
    return result;
  }

  locale_init();

#ifdef CRTDBG
  init_crtdbg();
#endif

    L = lua_init();
  game_init();
  register_races();
  register_borders();
  register_spells();
  bind_monsters(L);
  err = eressea_run(L, luafile);
  if (err) {
    log_error("server execution failed with code %d\n", err);
    return err;
  }
#ifdef MSPACES
  malloc_stats();
#endif

  game_done();
  lua_done(L);
  log_close();
  if (global.inifile) {
    iniparser_free(global.inifile);
  }
  return 0;
}
Exemple #3
0
int main(int argc, char **argv)
{
    int err = 0;
    lua_State *L;
    dictionary *d = 0;
    setup_signal_handler();
    message_handle_missing(MESSAGE_MISSING_REPLACE);
    /* parse arguments again, to override ini file */
    err = parse_args(argc, argv);
    if (err != 0) {
        return (err > 0) ? 0 : err;
    }
    d = parse_config(inifile);
    if (!d) {
        log_error("could not open ini configuration %s\n", inifile);
    }

    locale_init();

    L = lua_init(d);
    game_init();
    bind_monsters(L);
    err = eressea_run(L, luafile);
    if (err) {
        log_error("script %s failed with code %d\n", luafile, err);
        return err;
    }
    game_done();
    lua_done(L);
    log_close();
    stats_write(stdout, "");
    stats_close();
    if (d) {
        iniparser_freedict(d);
    }
    return 0;
}