Exemplo n.º 1
0
/**************************************************************************
  Do any necessary UI-specific cleanup
**************************************************************************/
void ui_exit()
{

#if defined UNDER_CE && defined SMALL_SCREEN
    /* change back to window mode to restore the title bar */
    set_video_mode(320, 240, SDL_SWSURFACE | SDL_ANYFORMAT);
#endif

    free_mapcanvas_and_overview();

    free_auxiliary_tech_icons();
    free_intro_radar_sprites();

    diplomacy_dialog_done();
    intel_dialog_done();

    callback_list_destroy(callbacks);

    unload_cursors();

    FC_FREE(button_behavior.event);

    meswin_dialog_popdown();

    del_main_list();

    free_font_system();
    theme_free(theme);

    quit_sdl();
}
Exemplo n.º 2
0
void
config_destroy(struct config *this_)
{
	attr_list_free(this_->attrs);
	callback_list_destroy(this_->cbl);
	g_free(config);
	exit(0);
}
Exemplo n.º 3
0
void
bookmarks_destroy(struct bookmarks *this_) {

	bookmarks_clear_hash(this_);

	map_destroy(this_->bookmark);
	callback_list_destroy(this_->attr_cbl);

	g_free(this_->bookmark_file);
	g_free(this_->working_file);

	g_free(this_->clipboard);
	g_free(this_);
}
Exemplo n.º 4
0
struct vehicle *
vehicle_new(struct attr **attrs)
{
	struct vehicle *this_;
	struct attr *source;
	struct vehicle_priv *(*vehicletype_new) (struct vehicle_methods *
						 meth,
						 struct callback_list *
						 cbl,
						 struct attr ** attrs);
	char *type, *colon;

	dbg(1, "enter\n");
	source = attr_search(attrs, NULL, attr_source);
	if (!source) {
		dbg(0, "no source\n");
		return NULL;
	}

	type = g_strdup(source->u.str);
	colon = index(type, ':');
	if (colon)
		*colon = '\0';
	dbg(1, "source='%s' type='%s'\n", source->u.str, type);

	vehicletype_new = plugin_get_vehicle_type(type);
	if (!vehicletype_new) {
		dbg(0, "invalid type\n");
		return NULL;
	}
	this_ = g_new0(struct vehicle, 1);
	this_->cbl = callback_list_new();
	this_->priv = vehicletype_new(&this_->meth, this_->cbl, attrs);
	if (!this_->priv) {
		dbg(0, "vehicletype_new failed\n");
		callback_list_destroy(this_->cbl);
		g_free(this_);
		return NULL;
	}
	dbg(1, "leave\n");

	return this_;
}
Exemplo n.º 5
0
struct vehicle *
vehicle_new(struct attr **attrs)
{
	struct vehicle *v;
	struct attr *name,*update,*follow,*color,*active,*source, *id;
	struct vehicle_priv *(*vehicletype_new) (struct vehicle_methods *
						 meth,
						 struct callback_list *
						 cbl,
						 struct attr ** attrs);
	char *type, *colon;

	dbg(1, "enter\n");
	source = attr_search(attrs, NULL, attr_source);
	if (!source) {
		dbg(0, "no source\n");
		return NULL;
	}

	type = g_strdup(source->u.str);
	colon = index(type, ':');
	if (colon)
		*colon = '\0';
	dbg(1, "source='%s' type='%s'\n", source->u.str, type);

	vehicletype_new = plugin_get_vehicle_type(type);
	if (!vehicletype_new) {
		dbg(0, "invalid type\n");
		return NULL;
	}
	v = g_new0(struct vehicle, 1);
	v->cbl = callback_list_new();
	v->priv = vehicletype_new(&v->meth, v->cbl, attrs);
	if (!v->priv) {
		dbg(0, "vehicletype_new failed\n");
		callback_list_destroy(v->cbl);
		g_free(v);
		return NULL;
	}
	v->update = 1;
	v->follow = 0;
	v->active = 0;
	if ((name=attr_search(attrs, NULL, attr_name)))
		v->name=g_strdup(name->u.str);
	else
		v->name=g_strdup("Noname");

	if ((id=attr_search(attrs, NULL, attr_vehicle_id)))
		v->id=id->u.num;
	if ((update=attr_search(attrs, NULL, attr_update)))
		v->update=update->u.num;
	if ((follow=attr_search(attrs, NULL, attr_follow)))
		v->follow=follow->u.num;
	if ((color=attr_search(attrs, NULL, attr_color))) 
		v->c=*(color->u.color);
	if ((active=attr_search(attrs, NULL, attr_active)) && active->u.num) {
		v->active = 1;
//		navit_set_vehicle(this_, v);
	}

	dbg(1, "leave\n");

	return v;
}
Exemplo n.º 6
0
void
vehicle_destroy(struct vehicle *this_)
{
	callback_list_destroy(this_->cbl);
	g_free(this_);
}