/* diversity-osm-backend.c - * * Copyright 2008 OpenMoko, Inc. * Authored by Chia-I Wu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include "diversity-osm.h" static struct { DiversityWorld *world; DiversityOsm *osm; } osm; int osm_init(DiversityWorld *world, GError **error) { DiversityBard *self; if (!g_thread_supported()) g_thread_init(NULL); osm.world = world; g_object_ref(world); osm.osm = diversity_osm_new(2, 20); self = diversity_world_get_self(osm.world); diversity_bard_add_equipment(self, DIVERSITY_EQUIPMENT(osm.osm)); return TRUE; } void osm_fini(void) { if (osm.osm) { g_object_unref(G_OBJECT(osm.osm)); osm.osm = NULL; } if (osm.world) { g_object_unref(G_OBJECT(osm.world)); osm.world = NULL; } }