Esempio n. 1
0
/****************************************************************
  Callback either loading suggested soundset or doing nothing
*****************************************************************/
static void soundset_suggestion_callback(GtkWidget *dlg, gint arg)
{
  if (arg == GTK_RESPONSE_YES) {
    /* User accepted soundset loading */

    audio_stop(); /* Fade down old one */

    sz_strlcpy(sound_set_name, game.control.prefered_soundset);
    audio_real_init(sound_set_name, sound_plugin_name);
  }
}
Esempio n. 2
0
void startClient() {
	char *logfile = "/sdcard/client.out";
	FILE *fp;
	  if((fp=freopen("/sdcard/freeciv_out_client.log", "w" ,stdout))==NULL) {
	    printf("Cannot open file.\n");
	    exit(1);
	  }

	  if((fp=freopen("/sdcard/freeciv_err_client.log", "w" ,stderr))==NULL) {
	    printf("Cannot open file.\n");
	    exit(1);
	  }

	  setenv ("HOME", "/sdcard/FreeCiv", 0);
	  setenv ("USER", "Sparky", 0);

	LOGI("Hello JNI");
	  log_init(logfile, LOG_DEBUG
			  , NULL);
	int i, loglevel;
	int ui_options = 0;
	bool ui_separator = FALSE;
	char *option=NULL;
	bool user_tileset = FALSE;

	  i_am_client(); /* Tell to libfreeciv that we are client */

	  /* Ensure that all AIs are initialized to unused state */
	  ai_type_iterate(ai) {
	    init_ai(ai);
	  } ai_type_iterate_end;




	init_our_capability();


	  (void)user_username(default_user_name, MAX_LEN_NAME);
	  if (!is_valid_username(default_user_name)) {
	    char buf[sizeof(default_user_name)];

	    my_snprintf(buf, sizeof(buf), "_%s", default_user_name);
	    if (is_valid_username(buf)) {
	      sz_strlcpy(default_user_name, buf);
	    } else {
	      my_snprintf(default_user_name, sizeof(default_user_name),
			  "player%d", myrand(10000));
	    }
	  }

	  game.all_connections = conn_list_new();
	  game.est_connections = conn_list_new();

	  ui_init();

	  fc_init_network();

	  init_our_capability();
	  chatline_common_init();
	  init_player_dlg_common();
	  init_themes();

	  options_init();

	  strcpy(default_sound_plugin_name,"none");

	  server_port = 9999;
	  sz_strlcpy(server_host, "localhost");
	  options_load();

	  mysrand(time(NULL));
	  helpdata_init();
	  boot_help_texts(NULL);




	  LOGI("Reading tilespec");
	  tilespec_try_read("amplio2", TRUE);
	  LOGI("Done reading tilespec");
	  overview_size_changed();

	  audio_real_init("stdsounds", "none");
	  //audio_play_music("music_start", NULL);

	  auto_connect = TRUE;

	  init_mapcanvas_and_overview();

	  /* run gui-specific client */
	  ui_main(0, NULL);

	  /* termination */
	  client_exit();

	return;
}