/* map.c generated by valac 0.15.1, the Vala compiler
 * generated from map.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <glib/gstdio.h>
#include <float.h>
#include <math.h>
#include <gobject/gvaluecollector.h>


#define TYPE_SLOT (slot_get_type ())
#define SLOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SLOT, Slot))
#define SLOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SLOT, SlotClass))
#define IS_SLOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SLOT))
#define IS_SLOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SLOT))
#define SLOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SLOT, SlotClass))

typedef struct _Slot Slot;
typedef struct _SlotClass SlotClass;
typedef struct _SlotPrivate SlotPrivate;
typedef struct _ParamSpecSlot ParamSpecSlot;

#define TYPE_MAP (map_get_type ())
#define MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP, Map))
#define MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP, MapClass))
#define IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP))
#define IS_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP))
#define MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP, MapClass))

typedef struct _Map Map;
typedef struct _MapClass MapClass;
typedef struct _MapPrivate MapPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define __g_list_free__slot_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__slot_unref0_ (var), NULL)))
#define _slot_unref0(var) ((var == NULL) ? NULL : (var = (slot_unref (var), NULL)))
typedef struct _ParamSpecMap ParamSpecMap;

#define TYPE_MAP_LOADER (map_loader_get_type ())
#define MAP_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_LOADER, MapLoader))
#define MAP_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_LOADER, MapLoaderClass))
#define IS_MAP_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_LOADER))
#define IS_MAP_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_LOADER))
#define MAP_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_LOADER, MapLoaderClass))

typedef struct _MapLoader MapLoader;
typedef struct _MapLoaderClass MapLoaderClass;
typedef struct _MapLoaderPrivate MapLoaderPrivate;
#define __g_list_free__map_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__map_unref0_ (var), NULL)))
#define _map_unref0(var) ((var == NULL) ? NULL : (var = (map_unref (var), NULL)))
#define _g_markup_parse_context_free0(var) ((var == NULL) ? NULL : (var = (g_markup_parse_context_free (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ParamSpecMapLoader ParamSpecMapLoader;

struct _Slot {
	GTypeInstance parent_instance;
	volatile int ref_count;
	SlotPrivate * priv;
	gint x;
	gint y;
	gint layer;
};

struct _SlotClass {
	GTypeClass parent_class;
	void (*finalize) (Slot *self);
};

struct _ParamSpecSlot {
	GParamSpec parent_instance;
};

struct _Map {
	GTypeInstance parent_instance;
	volatile int ref_count;
	MapPrivate * priv;
	gchar* name;
	gchar* score_name;
	GList* slots;
};

struct _MapClass {
	GTypeClass parent_class;
	void (*finalize) (Map *self);
};

struct _ParamSpecMap {
	GParamSpec parent_instance;
};

struct _MapLoader {
	GTypeInstance parent_instance;
	volatile int ref_count;
	MapLoaderPrivate * priv;
	GList* maps;
};

struct _MapLoaderClass {
	GTypeClass parent_class;
	void (*finalize) (MapLoader *self);
};

struct _MapLoaderPrivate {
	Map* map;
	gint layer_z;
};

struct _ParamSpecMapLoader {
	GParamSpec parent_instance;
};


static gpointer slot_parent_class = NULL;
static gpointer map_parent_class = NULL;
static gpointer map_loader_parent_class = NULL;

gpointer slot_ref (gpointer instance);
void slot_unref (gpointer instance);
GParamSpec* param_spec_slot (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_slot (GValue* value, gpointer v_object);
void value_take_slot (GValue* value, gpointer v_object);
gpointer value_get_slot (const GValue* value);
GType slot_get_type (void) G_GNUC_CONST;
enum  {
	SLOT_DUMMY_PROPERTY
};
Slot* slot_new (gint x, gint y, gint layer);
Slot* slot_construct (GType object_type, gint x, gint y, gint layer);
static void slot_finalize (Slot* obj);
gint compare_slots (Slot* a, Slot* b);
gpointer map_ref (gpointer instance);
void map_unref (gpointer instance);
GParamSpec* param_spec_map (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_map (GValue* value, gpointer v_object);
void value_take_map (GValue* value, gpointer v_object);
gpointer value_get_map (const GValue* value);
GType map_get_type (void) G_GNUC_CONST;
enum  {
	MAP_DUMMY_PROPERTY
};
static void _slot_unref0_ (gpointer var);
static void _g_list_free__slot_unref0_ (GList* self);
Map* map_new_test (void);
Map* map_construct_test (GType object_type);
Map* map_new_builtin (void);
Map* map_construct_builtin (GType object_type);
Map* map_new (void);
Map* map_construct (GType object_type);
guint map_get_width (Map* self);
guint map_get_height (Map* self);
static void map_finalize (Map* obj);
gpointer map_loader_ref (gpointer instance);
void map_loader_unref (gpointer instance);
GParamSpec* param_spec_map_loader (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_map_loader (GValue* value, gpointer v_object);
void value_take_map_loader (GValue* value, gpointer v_object);
gpointer value_get_map_loader (const GValue* value);
GType map_loader_get_type (void) G_GNUC_CONST;
#define MAP_LOADER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MAP_LOADER, MapLoaderPrivate))
enum  {
	MAP_LOADER_DUMMY_PROPERTY
};
static void _map_unref0_ (gpointer var);
static void _g_list_free__map_unref0_ (GList* self);
void map_loader_load (MapLoader* self, const gchar* filename, GError** error);
static void map_loader_start_element_cb (MapLoader* self, GMarkupParseContext* context, const gchar* element_name, gchar** attribute_names, int attribute_names_length1, gchar** attribute_values, int attribute_values_length1, GError** error);
static void _map_loader_start_element_cb_gmarkup_parser_start_element_func (GMarkupParseContext* context, const gchar* element_name, gchar** attribute_names, gchar** attribute_values, gpointer self, GError** error);
static void map_loader_end_element_cb (MapLoader* self, GMarkupParseContext* context, const gchar* element_name, GError** error);
static void _map_loader_end_element_cb_gmarkup_parser_end_element_func (GMarkupParseContext* context, const gchar* element_name, gpointer self, GError** error);
static gchar* map_loader_get_attribute (MapLoader* self, gchar** attribute_names, int attribute_names_length1, gchar** attribute_values, int attribute_values_length1, const gchar* name, const gchar* _default_);
static gdouble map_loader_get_attribute_d (MapLoader* self, gchar** attribute_names, int attribute_names_length1, gchar** attribute_values, int attribute_values_length1, const gchar* name, gdouble _default_);
MapLoader* map_loader_new (void);
MapLoader* map_loader_construct (GType object_type);
static void map_loader_finalize (MapLoader* obj);
static gint _vala_array_length (gpointer array);


Slot* slot_construct (GType object_type, gint x, gint y, gint layer) {
	Slot* self = NULL;
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	self = (Slot*) g_type_create_instance (object_type);
	_tmp0_ = x;
	self->x = _tmp0_;
	_tmp1_ = y;
	self->y = _tmp1_;
	_tmp2_ = layer;
	self->layer = _tmp2_;
	return self;
}


Slot* slot_new (gint x, gint y, gint layer) {
	return slot_construct (TYPE_SLOT, x, y, layer);
}


static void value_slot_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void value_slot_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		slot_unref (value->data[0].v_pointer);
	}
}


static void value_slot_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = slot_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer value_slot_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* value_slot_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		Slot* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = slot_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* value_slot_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	Slot** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = slot_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* param_spec_slot (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ParamSpecSlot* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_SLOT), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer value_get_slot (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SLOT), NULL);
	return value->data[0].v_pointer;
}


void value_set_slot (GValue* value, gpointer v_object) {
	Slot* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SLOT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SLOT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		slot_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		slot_unref (old);
	}
}


void value_take_slot (GValue* value, gpointer v_object) {
	Slot* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SLOT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SLOT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		slot_unref (old);
	}
}


static void slot_class_init (SlotClass * klass) {
	slot_parent_class = g_type_class_peek_parent (klass);
	SLOT_CLASS (klass)->finalize = slot_finalize;
}


static void slot_instance_init (Slot * self) {
	self->ref_count = 1;
}


static void slot_finalize (Slot* obj) {
	Slot * self;
	self = SLOT (obj);
}


GType slot_get_type (void) {
	static volatile gsize slot_type_id__volatile = 0;
	if (g_once_init_enter (&slot_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { value_slot_init, value_slot_free_value, value_slot_copy_value, value_slot_peek_pointer, "p", value_slot_collect_value, "p", value_slot_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (SlotClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) slot_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Slot), 0, (GInstanceInitFunc) slot_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType slot_type_id;
		slot_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Slot", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&slot_type_id__volatile, slot_type_id);
	}
	return slot_type_id__volatile;
}


gpointer slot_ref (gpointer instance) {
	Slot* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void slot_unref (gpointer instance) {
	Slot* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		SLOT_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


gint compare_slots (Slot* a, Slot* b) {
	gint result = 0;
	Slot* _tmp0_;
	gint _tmp1_;
	Slot* _tmp2_;
	gint _tmp3_;
	gint dl;
	gint _tmp4_;
	Slot* _tmp5_;
	gint _tmp6_;
	Slot* _tmp7_;
	gint _tmp8_;
	gint dx;
	Slot* _tmp9_;
	gint _tmp10_;
	Slot* _tmp11_;
	gint _tmp12_;
	gint dy;
	gint _tmp13_;
	gint _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	g_return_val_if_fail (a != NULL, 0);
	g_return_val_if_fail (b != NULL, 0);
	_tmp0_ = a;
	_tmp1_ = _tmp0_->layer;
	_tmp2_ = b;
	_tmp3_ = _tmp2_->layer;
	dl = _tmp1_ - _tmp3_;
	_tmp4_ = dl;
	if (_tmp4_ != 0) {
		result = dl;
		return result;
	}
	_tmp5_ = a;
	_tmp6_ = _tmp5_->x;
	_tmp7_ = b;
	_tmp8_ = _tmp7_->x;
	dx = _tmp6_ - _tmp8_;
	_tmp9_ = a;
	_tmp10_ = _tmp9_->y;
	_tmp11_ = b;
	_tmp12_ = _tmp11_->y;
	dy = _tmp10_ - _tmp12_;
	_tmp13_ = dx;
	_tmp14_ = dy;
	if (_tmp13_ > _tmp14_) {
		result = -1;
		return result;
	}
	_tmp15_ = dx;
	_tmp16_ = dy;
	if (_tmp15_ < _tmp16_) {
		result = 1;
		return result;
	}
	result = 0;
	return result;
}


static void _slot_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (slot_unref (var), NULL));
}


static void _g_list_free__slot_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _slot_unref0_, NULL);
	g_list_free (self);
}


Map* map_construct_test (GType object_type) {
	Map* self = NULL;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	Slot* _tmp3_;
	Slot* _tmp4_;
	Slot* _tmp5_;
	Slot* _tmp6_;
	Slot* _tmp7_;
	Slot* _tmp8_;
	Slot* _tmp9_;
	Slot* _tmp10_;
	self = (Map*) g_type_create_instance (object_type);
	_tmp0_ = g_dpgettext2 (NULL, "mahjongg map name", "Test");
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->name);
	self->name = _tmp1_;
	_tmp2_ = g_strdup ("test");
	_g_free0 (self->score_name);
	self->score_name = _tmp2_;
	_tmp3_ = slot_new (0, 0, 0);
	self->slots = g_list_append (self->slots, _tmp3_);
	_tmp4_ = slot_new (2, 0, 0);
	self->slots = g_list_append (self->slots, _tmp4_);
	_tmp5_ = slot_new (2, 0, 1);
	self->slots = g_list_append (self->slots, _tmp5_);
	_tmp6_ = slot_new (4, 0, 0);
	self->slots = g_list_append (self->slots, _tmp6_);
	_tmp7_ = slot_new (0, 2, 0);
	self->slots = g_list_append (self->slots, _tmp7_);
	_tmp8_ = slot_new (2, 2, 0);
	self->slots = g_list_append (self->slots, _tmp8_);
	_tmp9_ = slot_new (2, 2, 1);
	self->slots = g_list_append (self->slots, _tmp9_);
	_tmp10_ = slot_new (4, 2, 0);
	self->slots = g_list_append (self->slots, _tmp10_);
	return self;
}


Map* map_new_test (void) {
	return map_construct_test (TYPE_MAP);
}


Map* map_construct_builtin (GType object_type) {
	Map* self = NULL;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	Slot* _tmp3_;
	Slot* _tmp4_;
	Slot* _tmp5_;
	Slot* _tmp6_;
	Slot* _tmp7_;
	Slot* _tmp8_;
	Slot* _tmp9_;
	Slot* _tmp10_;
	Slot* _tmp11_;
	Slot* _tmp12_;
	Slot* _tmp13_;
	Slot* _tmp14_;
	Slot* _tmp15_;
	Slot* _tmp16_;
	Slot* _tmp17_;
	Slot* _tmp18_;
	Slot* _tmp19_;
	Slot* _tmp20_;
	Slot* _tmp21_;
	Slot* _tmp22_;
	Slot* _tmp23_;
	Slot* _tmp24_;
	Slot* _tmp25_;
	Slot* _tmp26_;
	Slot* _tmp27_;
	Slot* _tmp28_;
	Slot* _tmp29_;
	Slot* _tmp30_;
	Slot* _tmp31_;
	Slot* _tmp32_;
	Slot* _tmp33_;
	Slot* _tmp34_;
	Slot* _tmp35_;
	Slot* _tmp36_;
	Slot* _tmp37_;
	Slot* _tmp38_;
	Slot* _tmp39_;
	Slot* _tmp40_;
	Slot* _tmp41_;
	Slot* _tmp42_;
	Slot* _tmp43_;
	Slot* _tmp44_;
	Slot* _tmp45_;
	Slot* _tmp46_;
	Slot* _tmp47_;
	Slot* _tmp48_;
	Slot* _tmp49_;
	Slot* _tmp50_;
	Slot* _tmp51_;
	Slot* _tmp52_;
	Slot* _tmp53_;
	Slot* _tmp54_;
	Slot* _tmp55_;
	Slot* _tmp56_;
	Slot* _tmp57_;
	Slot* _tmp58_;
	Slot* _tmp59_;
	Slot* _tmp60_;
	Slot* _tmp61_;
	Slot* _tmp62_;
	Slot* _tmp63_;
	Slot* _tmp64_;
	Slot* _tmp65_;
	Slot* _tmp66_;
	Slot* _tmp67_;
	Slot* _tmp68_;
	Slot* _tmp69_;
	Slot* _tmp70_;
	Slot* _tmp71_;
	Slot* _tmp72_;
	Slot* _tmp73_;
	Slot* _tmp74_;
	Slot* _tmp75_;
	Slot* _tmp76_;
	Slot* _tmp77_;
	Slot* _tmp78_;
	Slot* _tmp79_;
	Slot* _tmp80_;
	Slot* _tmp81_;
	Slot* _tmp82_;
	Slot* _tmp83_;
	Slot* _tmp84_;
	Slot* _tmp85_;
	Slot* _tmp86_;
	Slot* _tmp87_;
	Slot* _tmp88_;
	Slot* _tmp89_;
	Slot* _tmp90_;
	Slot* _tmp91_;
	Slot* _tmp92_;
	Slot* _tmp93_;
	Slot* _tmp94_;
	Slot* _tmp95_;
	Slot* _tmp96_;
	Slot* _tmp97_;
	Slot* _tmp98_;
	Slot* _tmp99_;
	Slot* _tmp100_;
	Slot* _tmp101_;
	Slot* _tmp102_;
	Slot* _tmp103_;
	Slot* _tmp104_;
	Slot* _tmp105_;
	Slot* _tmp106_;
	Slot* _tmp107_;
	Slot* _tmp108_;
	Slot* _tmp109_;
	Slot* _tmp110_;
	Slot* _tmp111_;
	Slot* _tmp112_;
	Slot* _tmp113_;
	Slot* _tmp114_;
	Slot* _tmp115_;
	Slot* _tmp116_;
	Slot* _tmp117_;
	Slot* _tmp118_;
	Slot* _tmp119_;
	Slot* _tmp120_;
	Slot* _tmp121_;
	Slot* _tmp122_;
	Slot* _tmp123_;
	Slot* _tmp124_;
	Slot* _tmp125_;
	Slot* _tmp126_;
	Slot* _tmp127_;
	Slot* _tmp128_;
	Slot* _tmp129_;
	Slot* _tmp130_;
	Slot* _tmp131_;
	Slot* _tmp132_;
	Slot* _tmp133_;
	Slot* _tmp134_;
	Slot* _tmp135_;
	Slot* _tmp136_;
	Slot* _tmp137_;
	Slot* _tmp138_;
	Slot* _tmp139_;
	Slot* _tmp140_;
	Slot* _tmp141_;
	Slot* _tmp142_;
	Slot* _tmp143_;
	Slot* _tmp144_;
	Slot* _tmp145_;
	Slot* _tmp146_;
	self = (Map*) g_type_create_instance (object_type);
	_tmp0_ = g_dpgettext2 (NULL, "mahjongg map name", "Easy");
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->name);
	self->name = _tmp1_;
	_tmp2_ = g_strdup ("easy");
	_g_free0 (self->score_name);
	self->score_name = _tmp2_;
	_tmp3_ = slot_new (13, 7, 4);
	self->slots = g_list_append (self->slots, _tmp3_);
	_tmp4_ = slot_new (12, 8, 3);
	self->slots = g_list_append (self->slots, _tmp4_);
	_tmp5_ = slot_new (14, 8, 3);
	self->slots = g_list_append (self->slots, _tmp5_);
	_tmp6_ = slot_new (12, 6, 3);
	self->slots = g_list_append (self->slots, _tmp6_);
	_tmp7_ = slot_new (14, 6, 3);
	self->slots = g_list_append (self->slots, _tmp7_);
	_tmp8_ = slot_new (10, 10, 2);
	self->slots = g_list_append (self->slots, _tmp8_);
	_tmp9_ = slot_new (12, 10, 2);
	self->slots = g_list_append (self->slots, _tmp9_);
	_tmp10_ = slot_new (14, 10, 2);
	self->slots = g_list_append (self->slots, _tmp10_);
	_tmp11_ = slot_new (16, 10, 2);
	self->slots = g_list_append (self->slots, _tmp11_);
	_tmp12_ = slot_new (10, 8, 2);
	self->slots = g_list_append (self->slots, _tmp12_);
	_tmp13_ = slot_new (12, 8, 2);
	self->slots = g_list_append (self->slots, _tmp13_);
	_tmp14_ = slot_new (14, 8, 2);
	self->slots = g_list_append (self->slots, _tmp14_);
	_tmp15_ = slot_new (16, 8, 2);
	self->slots = g_list_append (self->slots, _tmp15_);
	_tmp16_ = slot_new (10, 6, 2);
	self->slots = g_list_append (self->slots, _tmp16_);
	_tmp17_ = slot_new (12, 6, 2);
	self->slots = g_list_append (self->slots, _tmp17_);
	_tmp18_ = slot_new (14, 6, 2);
	self->slots = g_list_append (self->slots, _tmp18_);
	_tmp19_ = slot_new (16, 6, 2);
	self->slots = g_list_append (self->slots, _tmp19_);
	_tmp20_ = slot_new (10, 4, 2);
	self->slots = g_list_append (self->slots, _tmp20_);
	_tmp21_ = slot_new (12, 4, 2);
	self->slots = g_list_append (self->slots, _tmp21_);
	_tmp22_ = slot_new (14, 4, 2);
	self->slots = g_list_append (self->slots, _tmp22_);
	_tmp23_ = slot_new (16, 4, 2);
	self->slots = g_list_append (self->slots, _tmp23_);
	_tmp24_ = slot_new (8, 12, 1);
	self->slots = g_list_append (self->slots, _tmp24_);
	_tmp25_ = slot_new (10, 12, 1);
	self->slots = g_list_append (self->slots, _tmp25_);
	_tmp26_ = slot_new (12, 12, 1);
	self->slots = g_list_append (self->slots, _tmp26_);
	_tmp27_ = slot_new (14, 12, 1);
	self->slots = g_list_append (self->slots, _tmp27_);
	_tmp28_ = slot_new (16, 12, 1);
	self->slots = g_list_append (self->slots, _tmp28_);
	_tmp29_ = slot_new (18, 12, 1);
	self->slots = g_list_append (self->slots, _tmp29_);
	_tmp30_ = slot_new (8, 10, 1);
	self->slots = g_list_append (self->slots, _tmp30_);
	_tmp31_ = slot_new (10, 10, 1);
	self->slots = g_list_append (self->slots, _tmp31_);
	_tmp32_ = slot_new (12, 10, 1);
	self->slots = g_list_append (self->slots, _tmp32_);
	_tmp33_ = slot_new (14, 10, 1);
	self->slots = g_list_append (self->slots, _tmp33_);
	_tmp34_ = slot_new (16, 10, 1);
	self->slots = g_list_append (self->slots, _tmp34_);
	_tmp35_ = slot_new (18, 10, 1);
	self->slots = g_list_append (self->slots, _tmp35_);
	_tmp36_ = slot_new (8, 8, 1);
	self->slots = g_list_append (self->slots, _tmp36_);
	_tmp37_ = slot_new (10, 8, 1);
	self->slots = g_list_append (self->slots, _tmp37_);
	_tmp38_ = slot_new (12, 8, 1);
	self->slots = g_list_append (self->slots, _tmp38_);
	_tmp39_ = slot_new (14, 8, 1);
	self->slots = g_list_append (self->slots, _tmp39_);
	_tmp40_ = slot_new (16, 8, 1);
	self->slots = g_list_append (self->slots, _tmp40_);
	_tmp41_ = slot_new (18, 8, 1);
	self->slots = g_list_append (self->slots, _tmp41_);
	_tmp42_ = slot_new (8, 6, 1);
	self->slots = g_list_append (self->slots, _tmp42_);
	_tmp43_ = slot_new (10, 6, 1);
	self->slots = g_list_append (self->slots, _tmp43_);
	_tmp44_ = slot_new (12, 6, 1);
	self->slots = g_list_append (self->slots, _tmp44_);
	_tmp45_ = slot_new (14, 6, 1);
	self->slots = g_list_append (self->slots, _tmp45_);
	_tmp46_ = slot_new (16, 6, 1);
	self->slots = g_list_append (self->slots, _tmp46_);
	_tmp47_ = slot_new (18, 6, 1);
	self->slots = g_list_append (self->slots, _tmp47_);
	_tmp48_ = slot_new (8, 4, 1);
	self->slots = g_list_append (self->slots, _tmp48_);
	_tmp49_ = slot_new (10, 4, 1);
	self->slots = g_list_append (self->slots, _tmp49_);
	_tmp50_ = slot_new (12, 4, 1);
	self->slots = g_list_append (self->slots, _tmp50_);
	_tmp51_ = slot_new (14, 4, 1);
	self->slots = g_list_append (self->slots, _tmp51_);
	_tmp52_ = slot_new (16, 4, 1);
	self->slots = g_list_append (self->slots, _tmp52_);
	_tmp53_ = slot_new (18, 4, 1);
	self->slots = g_list_append (self->slots, _tmp53_);
	_tmp54_ = slot_new (8, 2, 1);
	self->slots = g_list_append (self->slots, _tmp54_);
	_tmp55_ = slot_new (10, 2, 1);
	self->slots = g_list_append (self->slots, _tmp55_);
	_tmp56_ = slot_new (12, 2, 1);
	self->slots = g_list_append (self->slots, _tmp56_);
	_tmp57_ = slot_new (14, 2, 1);
	self->slots = g_list_append (self->slots, _tmp57_);
	_tmp58_ = slot_new (16, 2, 1);
	self->slots = g_list_append (self->slots, _tmp58_);
	_tmp59_ = slot_new (18, 2, 1);
	self->slots = g_list_append (self->slots, _tmp59_);
	_tmp60_ = slot_new (2, 14, 0);
	self->slots = g_list_append (self->slots, _tmp60_);
	_tmp61_ = slot_new (4, 14, 0);
	self->slots = g_list_append (self->slots, _tmp61_);
	_tmp62_ = slot_new (6, 14, 0);
	self->slots = g_list_append (self->slots, _tmp62_);
	_tmp63_ = slot_new (8, 14, 0);
	self->slots = g_list_append (self->slots, _tmp63_);
	_tmp64_ = slot_new (10, 14, 0);
	self->slots = g_list_append (self->slots, _tmp64_);
	_tmp65_ = slot_new (12, 14, 0);
	self->slots = g_list_append (self->slots, _tmp65_);
	_tmp66_ = slot_new (14, 14, 0);
	self->slots = g_list_append (self->slots, _tmp66_);
	_tmp67_ = slot_new (16, 14, 0);
	self->slots = g_list_append (self->slots, _tmp67_);
	_tmp68_ = slot_new (18, 14, 0);
	self->slots = g_list_append (self->slots, _tmp68_);
	_tmp69_ = slot_new (20, 14, 0);
	self->slots = g_list_append (self->slots, _tmp69_);
	_tmp70_ = slot_new (22, 14, 0);
	self->slots = g_list_append (self->slots, _tmp70_);
	_tmp71_ = slot_new (24, 14, 0);
	self->slots = g_list_append (self->slots, _tmp71_);
	_tmp72_ = slot_new (6, 12, 0);
	self->slots = g_list_append (self->slots, _tmp72_);
	_tmp73_ = slot_new (8, 12, 0);
	self->slots = g_list_append (self->slots, _tmp73_);
	_tmp74_ = slot_new (10, 12, 0);
	self->slots = g_list_append (self->slots, _tmp74_);
	_tmp75_ = slot_new (12, 12, 0);
	self->slots = g_list_append (self->slots, _tmp75_);
	_tmp76_ = slot_new (14, 12, 0);
	self->slots = g_list_append (self->slots, _tmp76_);
	_tmp77_ = slot_new (16, 12, 0);
	self->slots = g_list_append (self->slots, _tmp77_);
	_tmp78_ = slot_new (18, 12, 0);
	self->slots = g_list_append (self->slots, _tmp78_);
	_tmp79_ = slot_new (20, 12, 0);
	self->slots = g_list_append (self->slots, _tmp79_);
	_tmp80_ = slot_new (4, 10, 0);
	self->slots = g_list_append (self->slots, _tmp80_);
	_tmp81_ = slot_new (6, 10, 0);
	self->slots = g_list_append (self->slots, _tmp81_);
	_tmp82_ = slot_new (8, 10, 0);
	self->slots = g_list_append (self->slots, _tmp82_);
	_tmp83_ = slot_new (10, 10, 0);
	self->slots = g_list_append (self->slots, _tmp83_);
	_tmp84_ = slot_new (12, 10, 0);
	self->slots = g_list_append (self->slots, _tmp84_);
	_tmp85_ = slot_new (14, 10, 0);
	self->slots = g_list_append (self->slots, _tmp85_);
	_tmp86_ = slot_new (16, 10, 0);
	self->slots = g_list_append (self->slots, _tmp86_);
	_tmp87_ = slot_new (18, 10, 0);
	self->slots = g_list_append (self->slots, _tmp87_);
	_tmp88_ = slot_new (20, 10, 0);
	self->slots = g_list_append (self->slots, _tmp88_);
	_tmp89_ = slot_new (22, 10, 0);
	self->slots = g_list_append (self->slots, _tmp89_);
	_tmp90_ = slot_new (0, 7, 0);
	self->slots = g_list_append (self->slots, _tmp90_);
	_tmp91_ = slot_new (2, 8, 0);
	self->slots = g_list_append (self->slots, _tmp91_);
	_tmp92_ = slot_new (4, 8, 0);
	self->slots = g_list_append (self->slots, _tmp92_);
	_tmp93_ = slot_new (6, 8, 0);
	self->slots = g_list_append (self->slots, _tmp93_);
	_tmp94_ = slot_new (8, 8, 0);
	self->slots = g_list_append (self->slots, _tmp94_);
	_tmp95_ = slot_new (10, 8, 0);
	self->slots = g_list_append (self->slots, _tmp95_);
	_tmp96_ = slot_new (12, 8, 0);
	self->slots = g_list_append (self->slots, _tmp96_);
	_tmp97_ = slot_new (14, 8, 0);
	self->slots = g_list_append (self->slots, _tmp97_);
	_tmp98_ = slot_new (16, 8, 0);
	self->slots = g_list_append (self->slots, _tmp98_);
	_tmp99_ = slot_new (18, 8, 0);
	self->slots = g_list_append (self->slots, _tmp99_);
	_tmp100_ = slot_new (20, 8, 0);
	self->slots = g_list_append (self->slots, _tmp100_);
	_tmp101_ = slot_new (22, 8, 0);
	self->slots = g_list_append (self->slots, _tmp101_);
	_tmp102_ = slot_new (24, 8, 0);
	self->slots = g_list_append (self->slots, _tmp102_);
	_tmp103_ = slot_new (2, 6, 0);
	self->slots = g_list_append (self->slots, _tmp103_);
	_tmp104_ = slot_new (4, 6, 0);
	self->slots = g_list_append (self->slots, _tmp104_);
	_tmp105_ = slot_new (6, 6, 0);
	self->slots = g_list_append (self->slots, _tmp105_);
	_tmp106_ = slot_new (8, 6, 0);
	self->slots = g_list_append (self->slots, _tmp106_);
	_tmp107_ = slot_new (10, 6, 0);
	self->slots = g_list_append (self->slots, _tmp107_);
	_tmp108_ = slot_new (12, 6, 0);
	self->slots = g_list_append (self->slots, _tmp108_);
	_tmp109_ = slot_new (14, 6, 0);
	self->slots = g_list_append (self->slots, _tmp109_);
	_tmp110_ = slot_new (16, 6, 0);
	self->slots = g_list_append (self->slots, _tmp110_);
	_tmp111_ = slot_new (18, 6, 0);
	self->slots = g_list_append (self->slots, _tmp111_);
	_tmp112_ = slot_new (20, 6, 0);
	self->slots = g_list_append (self->slots, _tmp112_);
	_tmp113_ = slot_new (22, 6, 0);
	self->slots = g_list_append (self->slots, _tmp113_);
	_tmp114_ = slot_new (24, 6, 0);
	self->slots = g_list_append (self->slots, _tmp114_);
	_tmp115_ = slot_new (4, 4, 0);
	self->slots = g_list_append (self->slots, _tmp115_);
	_tmp116_ = slot_new (6, 4, 0);
	self->slots = g_list_append (self->slots, _tmp116_);
	_tmp117_ = slot_new (8, 4, 0);
	self->slots = g_list_append (self->slots, _tmp117_);
	_tmp118_ = slot_new (10, 4, 0);
	self->slots = g_list_append (self->slots, _tmp118_);
	_tmp119_ = slot_new (12, 4, 0);
	self->slots = g_list_append (self->slots, _tmp119_);
	_tmp120_ = slot_new (14, 4, 0);
	self->slots = g_list_append (self->slots, _tmp120_);
	_tmp121_ = slot_new (16, 4, 0);
	self->slots = g_list_append (self->slots, _tmp121_);
	_tmp122_ = slot_new (18, 4, 0);
	self->slots = g_list_append (self->slots, _tmp122_);
	_tmp123_ = slot_new (20, 4, 0);
	self->slots = g_list_append (self->slots, _tmp123_);
	_tmp124_ = slot_new (22, 4, 0);
	self->slots = g_list_append (self->slots, _tmp124_);
	_tmp125_ = slot_new (6, 2, 0);
	self->slots = g_list_append (self->slots, _tmp125_);
	_tmp126_ = slot_new (8, 2, 0);
	self->slots = g_list_append (self->slots, _tmp126_);
	_tmp127_ = slot_new (10, 2, 0);
	self->slots = g_list_append (self->slots, _tmp127_);
	_tmp128_ = slot_new (12, 2, 0);
	self->slots = g_list_append (self->slots, _tmp128_);
	_tmp129_ = slot_new (14, 2, 0);
	self->slots = g_list_append (self->slots, _tmp129_);
	_tmp130_ = slot_new (16, 2, 0);
	self->slots = g_list_append (self->slots, _tmp130_);
	_tmp131_ = slot_new (18, 2, 0);
	self->slots = g_list_append (self->slots, _tmp131_);
	_tmp132_ = slot_new (20, 2, 0);
	self->slots = g_list_append (self->slots, _tmp132_);
	_tmp133_ = slot_new (2, 0, 0);
	self->slots = g_list_append (self->slots, _tmp133_);
	_tmp134_ = slot_new (4, 0, 0);
	self->slots = g_list_append (self->slots, _tmp134_);
	_tmp135_ = slot_new (6, 0, 0);
	self->slots = g_list_append (self->slots, _tmp135_);
	_tmp136_ = slot_new (8, 0, 0);
	self->slots = g_list_append (self->slots, _tmp136_);
	_tmp137_ = slot_new (10, 0, 0);
	self->slots = g_list_append (self->slots, _tmp137_);
	_tmp138_ = slot_new (12, 0, 0);
	self->slots = g_list_append (self->slots, _tmp138_);
	_tmp139_ = slot_new (14, 0, 0);
	self->slots = g_list_append (self->slots, _tmp139_);
	_tmp140_ = slot_new (16, 0, 0);
	self->slots = g_list_append (self->slots, _tmp140_);
	_tmp141_ = slot_new (18, 0, 0);
	self->slots = g_list_append (self->slots, _tmp141_);
	_tmp142_ = slot_new (20, 0, 0);
	self->slots = g_list_append (self->slots, _tmp142_);
	_tmp143_ = slot_new (22, 0, 0);
	self->slots = g_list_append (self->slots, _tmp143_);
	_tmp144_ = slot_new (24, 0, 0);
	self->slots = g_list_append (self->slots, _tmp144_);
	_tmp145_ = slot_new (26, 7, 0);
	self->slots = g_list_append (self->slots, _tmp145_);
	_tmp146_ = slot_new (28, 7, 0);
	self->slots = g_list_append (self->slots, _tmp146_);
	return self;
}


Map* map_new_builtin (void) {
	return map_construct_builtin (TYPE_MAP);
}


Map* map_construct (GType object_type) {
	Map* self = NULL;
	self = (Map*) g_type_create_instance (object_type);
	return self;
}


Map* map_new (void) {
	return map_construct (TYPE_MAP);
}


static gpointer _slot_ref0 (gpointer self) {
	return self ? slot_ref (self) : NULL;
}


guint map_get_width (Map* self) {
	guint result;
	gint w;
	GList* _tmp0_;
	gint _tmp7_;
	g_return_val_if_fail (self != NULL, 0U);
	w = 0;
	_tmp0_ = self->slots;
	{
		GList* slot_collection = NULL;
		GList* slot_it = NULL;
		slot_collection = _tmp0_;
		for (slot_it = slot_collection; slot_it != NULL; slot_it = slot_it->next) {
			Slot* _tmp1_;
			Slot* slot = NULL;
			_tmp1_ = _slot_ref0 ((Slot*) slot_it->data);
			slot = _tmp1_;
			{
				Slot* _tmp2_;
				gint _tmp3_;
				gint _tmp4_;
				_tmp2_ = slot;
				_tmp3_ = _tmp2_->x;
				_tmp4_ = w;
				if (_tmp3_ > _tmp4_) {
					Slot* _tmp5_;
					gint _tmp6_;
					_tmp5_ = slot;
					_tmp6_ = _tmp5_->x;
					w = _tmp6_;
				}
				_slot_unref0 (slot);
			}
		}
	}
	_tmp7_ = w;
	result = (guint) (_tmp7_ + 2);
	return result;
}


guint map_get_height (Map* self) {
	guint result;
	gint h;
	GList* _tmp0_;
	gint _tmp7_;
	g_return_val_if_fail (self != NULL, 0U);
	h = 0;
	_tmp0_ = self->slots;
	{
		GList* slot_collection = NULL;
		GList* slot_it = NULL;
		slot_collection = _tmp0_;
		for (slot_it = slot_collection; slot_it != NULL; slot_it = slot_it->next) {
			Slot* _tmp1_;
			Slot* slot = NULL;
			_tmp1_ = _slot_ref0 ((Slot*) slot_it->data);
			slot = _tmp1_;
			{
				Slot* _tmp2_;
				gint _tmp3_;
				gint _tmp4_;
				_tmp2_ = slot;
				_tmp3_ = _tmp2_->y;
				_tmp4_ = h;
				if (_tmp3_ > _tmp4_) {
					Slot* _tmp5_;
					gint _tmp6_;
					_tmp5_ = slot;
					_tmp6_ = _tmp5_->y;
					h = _tmp6_;
				}
				_slot_unref0 (slot);
			}
		}
	}
	_tmp7_ = h;
	result = (guint) (_tmp7_ + 2);
	return result;
}


static void value_map_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void value_map_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		map_unref (value->data[0].v_pointer);
	}
}


static void value_map_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = map_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer value_map_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* value_map_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		Map* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = map_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* value_map_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	Map** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = map_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* param_spec_map (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ParamSpecMap* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_MAP), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer value_get_map (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAP), NULL);
	return value->data[0].v_pointer;
}


void value_set_map (GValue* value, gpointer v_object) {
	Map* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAP));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAP));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		map_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		map_unref (old);
	}
}


void value_take_map (GValue* value, gpointer v_object) {
	Map* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAP));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAP));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		map_unref (old);
	}
}


static void map_class_init (MapClass * klass) {
	map_parent_class = g_type_class_peek_parent (klass);
	MAP_CLASS (klass)->finalize = map_finalize;
}


static void map_instance_init (Map * self) {
	self->name = NULL;
	self->score_name = NULL;
	self->slots = NULL;
	self->ref_count = 1;
}


static void map_finalize (Map* obj) {
	Map * self;
	self = MAP (obj);
	_g_free0 (self->name);
	_g_free0 (self->score_name);
	__g_list_free__slot_unref0_0 (self->slots);
}


GType map_get_type (void) {
	static volatile gsize map_type_id__volatile = 0;
	if (g_once_init_enter (&map_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { value_map_init, value_map_free_value, value_map_copy_value, value_map_peek_pointer, "p", value_map_collect_value, "p", value_map_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (MapClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) map_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Map), 0, (GInstanceInitFunc) map_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType map_type_id;
		map_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Map", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&map_type_id__volatile, map_type_id);
	}
	return map_type_id__volatile;
}


gpointer map_ref (gpointer instance) {
	Map* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void map_unref (gpointer instance) {
	Map* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		MAP_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static void _map_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (map_unref (var), NULL));
}


static void _g_list_free__map_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _map_unref0_, NULL);
	g_list_free (self);
}


static void _map_loader_start_element_cb_gmarkup_parser_start_element_func (GMarkupParseContext* context, const gchar* element_name, gchar** attribute_names, gchar** attribute_values, gpointer self, GError** error) {
	map_loader_start_element_cb (self, context, element_name, attribute_names, _vala_array_length (attribute_names), attribute_values, _vala_array_length (attribute_values), error);
}


static void _map_loader_end_element_cb_gmarkup_parser_end_element_func (GMarkupParseContext* context, const gchar* element_name, gpointer self, GError** error) {
	map_loader_end_element_cb (self, context, element_name, error);
}


void map_loader_load (MapLoader* self, const gchar* filename, GError** error) {
	gchar* data = NULL;
	gsize length = 0UL;
	const gchar* _tmp0_;
	gchar* _tmp1_ = NULL;
	gsize _tmp2_ = 0UL;
	GMarkupParser parser = {0};
	GMarkupParser _tmp3_;
	GMarkupParseContext* _tmp4_;
	GMarkupParseContext* parse_context;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (filename != NULL);
	_tmp0_ = filename;
	g_file_get_contents (_tmp0_, &_tmp1_, &_tmp2_, &_inner_error_);
	_g_free0 (data);
	data = _tmp1_;
	length = _tmp2_;
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		_g_free0 (data);
		return;
	}
	memset (&parser, 0, sizeof (GMarkupParser));
	parser.start_element = _map_loader_start_element_cb_gmarkup_parser_start_element_func;
	parser.end_element = _map_loader_end_element_cb_gmarkup_parser_end_element_func;
	parser.text = NULL;
	parser.passthrough = NULL;
	parser.error = NULL;
	_tmp3_ = parser;
	_tmp4_ = g_markup_parse_context_new (&_tmp3_, 0, self, NULL);
	parse_context = _tmp4_;
	{
		GMarkupParseContext* _tmp5_;
		_tmp5_ = parse_context;
		g_markup_parse_context_parse (_tmp5_, data, (gssize) length, &_inner_error_);
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_MARKUP_ERROR) {
				goto __catch6_g_markup_error;
			}
			_g_markup_parse_context_free0 (parse_context);
			_g_free0 (data);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	goto __finally6;
	__catch6_g_markup_error:
	{
		GError* e = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_g_error_free0 (e);
	}
	__finally6:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		_g_markup_parse_context_free0 (parse_context);
		_g_free0 (data);
		return;
	}
	_g_markup_parse_context_free0 (parse_context);
	_g_free0 (data);
}


static gchar* map_loader_get_attribute (MapLoader* self, gchar** attribute_names, int attribute_names_length1, gchar** attribute_values, int attribute_values_length1, const gchar* name, const gchar* _default_) {
	gchar* result = NULL;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	{
		gint i;
		i = 0;
		{
			gboolean _tmp0_;
			_tmp0_ = TRUE;
			while (TRUE) {
				gboolean _tmp1_;
				gchar** _tmp3_;
				gint _tmp3__length1;
				gint _tmp4_;
				const gchar* _tmp5_;
				gchar** _tmp6_;
				gint _tmp6__length1;
				gint _tmp7_;
				const gchar* _tmp8_;
				gchar* _tmp9_ = NULL;
				gchar* _tmp10_;
				const gchar* _tmp11_;
				gboolean _tmp12_;
				_tmp1_ = _tmp0_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp3_ = attribute_names;
				_tmp3__length1 = attribute_names_length1;
				_tmp4_ = i;
				_tmp5_ = _tmp3_[_tmp4_];
				if (!(_tmp5_ != NULL)) {
					break;
				}
				_tmp6_ = attribute_names;
				_tmp6__length1 = attribute_names_length1;
				_tmp7_ = i;
				_tmp8_ = _tmp6_[_tmp7_];
				_tmp9_ = g_utf8_strdown (_tmp8_, (gssize) (-1));
				_tmp10_ = _tmp9_;
				_tmp11_ = name;
				_tmp12_ = g_strcmp0 (_tmp10_, _tmp11_) == 0;
				_g_free0 (_tmp10_);
				if (_tmp12_) {
					gchar** _tmp13_;
					gint _tmp13__length1;
					gint _tmp14_;
					const gchar* _tmp15_;
					gchar* _tmp16_;
					_tmp13_ = attribute_values;
					_tmp13__length1 = attribute_values_length1;
					_tmp14_ = i;
					_tmp15_ = _tmp13_[_tmp14_];
					_tmp16_ = g_strdup (_tmp15_);
					result = _tmp16_;
					return result;
				}
			}
		}
	}
	_tmp17_ = _default_;
	_tmp18_ = g_strdup (_tmp17_);
	result = _tmp18_;
	return result;
}


static gdouble double_parse (const gchar* str) {
	gdouble result = 0.0;
	const gchar* _tmp0_;
	gdouble _tmp1_ = 0.0;
	g_return_val_if_fail (str != NULL, 0.0);
	_tmp0_ = str;
	_tmp1_ = g_ascii_strtod (_tmp0_, NULL);
	result = _tmp1_;
	return result;
}


static gdouble map_loader_get_attribute_d (MapLoader* self, gchar** attribute_names, int attribute_names_length1, gchar** attribute_values, int attribute_values_length1, const gchar* name, gdouble _default_) {
	gdouble result = 0.0;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	const gchar* _tmp2_;
	gchar* _tmp3_ = NULL;
	gchar* a;
	const gchar* _tmp4_;
	g_return_val_if_fail (self != NULL, 0.0);
	g_return_val_if_fail (name != NULL, 0.0);
	_tmp0_ = attribute_names;
	_tmp0__length1 = attribute_names_length1;
	_tmp1_ = attribute_values;
	_tmp1__length1 = attribute_values_length1;
	_tmp2_ = name;
	_tmp3_ = map_loader_get_attribute (self, _tmp0_, _tmp0__length1, _tmp1_, _tmp1__length1, _tmp2_, NULL);
	a = _tmp3_;
	_tmp4_ = a;
	if (_tmp4_ == NULL) {
		gdouble _tmp5_;
		_tmp5_ = _default_;
		result = _tmp5_;
		_g_free0 (a);
		return result;
	} else {
		const gchar* _tmp6_;
		gdouble _tmp7_ = 0.0;
		_tmp6_ = a;
		_tmp7_ = double_parse (_tmp6_);
		result = _tmp7_;
		_g_free0 (a);
		return result;
	}
	_g_free0 (a);
}


static void map_loader_start_element_cb (MapLoader* self, GMarkupParseContext* context, const gchar* element_name, gchar** attribute_names, int attribute_names_length1, gchar** attribute_values, int attribute_values_length1, GError** error) {
	const gchar* _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_;
	GQuark _tmp4_ = 0U;
	static GQuark _tmp3_label0 = 0;
	static GQuark _tmp3_label1 = 0;
	static GQuark _tmp3_label2 = 0;
	static GQuark _tmp3_label3 = 0;
	static GQuark _tmp3_label4 = 0;
	static GQuark _tmp3_label5 = 0;
	static GQuark _tmp3_label6 = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (context != NULL);
	g_return_if_fail (element_name != NULL);
	_tmp0_ = element_name;
	_tmp1_ = g_utf8_strdown (_tmp0_, (gssize) (-1));
	_tmp2_ = _tmp1_;
	_tmp4_ = (NULL == _tmp2_) ? 0 : g_quark_from_string (_tmp2_);
	g_free (_tmp2_);
	if (_tmp4_ == ((0 != _tmp3_label0) ? _tmp3_label0 : (_tmp3_label0 = g_quark_from_static_string ("mahjongg")))) {
		switch (0) {
			default:
			{
				break;
			}
		}
	} else if (_tmp4_ == ((0 != _tmp3_label1) ? _tmp3_label1 : (_tmp3_label1 = g_quark_from_static_string ("map")))) {
		switch (0) {
			default:
			{
				Map* _tmp5_;
				Map* _tmp6_;
				gchar** _tmp7_;
				gint _tmp7__length1;
				gchar** _tmp8_;
				gint _tmp8__length1;
				gchar* _tmp9_ = NULL;
				Map* _tmp10_;
				gchar** _tmp11_;
				gint _tmp11__length1;
				gchar** _tmp12_;
				gint _tmp12__length1;
				gchar* _tmp13_ = NULL;
				_tmp5_ = map_new ();
				_map_unref0 (self->priv->map);
				self->priv->map = _tmp5_;
				_tmp6_ = self->priv->map;
				_tmp7_ = attribute_names;
				_tmp7__length1 = attribute_names_length1;
				_tmp8_ = attribute_values;
				_tmp8__length1 = attribute_values_length1;
				_tmp9_ = map_loader_get_attribute (self, _tmp7_, _tmp7__length1, _tmp8_, _tmp8__length1, "name", "");
				_g_free0 (_tmp6_->name);
				_tmp6_->name = _tmp9_;
				_tmp10_ = self->priv->map;
				_tmp11_ = attribute_names;
				_tmp11__length1 = attribute_names_length1;
				_tmp12_ = attribute_values;
				_tmp12__length1 = attribute_values_length1;
				_tmp13_ = map_loader_get_attribute (self, _tmp11_, _tmp11__length1, _tmp12_, _tmp12__length1, "scorename", "");
				_g_free0 (_tmp10_->score_name);
				_tmp10_->score_name = _tmp13_;
				break;
			}
		}
	} else if (_tmp4_ == ((0 != _tmp3_label2) ? _tmp3_label2 : (_tmp3_label2 = g_quark_from_static_string ("layer")))) {
		switch (0) {
			default:
			{
				gchar** _tmp14_;
				gint _tmp14__length1;
				gchar** _tmp15_;
				gint _tmp15__length1;
				gdouble _tmp16_ = 0.0;
				_tmp14_ = attribute_names;
				_tmp14__length1 = attribute_names_length1;
				_tmp15_ = attribute_values;
				_tmp15__length1 = attribute_values_length1;
				_tmp16_ = map_loader_get_attribute_d (self, _tmp14_, _tmp14__length1, _tmp15_, _tmp15__length1, "z", 0.0);
				self->priv->layer_z = (gint) _tmp16_;
				break;
			}
		}
	} else if (_tmp4_ == ((0 != _tmp3_label3) ? _tmp3_label3 : (_tmp3_label3 = g_quark_from_static_string ("row")))) {
		switch (0) {
			default:
			{
				gchar** _tmp17_;
				gint _tmp17__length1;
				gchar** _tmp18_;
				gint _tmp18__length1;
				gdouble _tmp19_ = 0.0;
				gint x1;
				gchar** _tmp20_;
				gint _tmp20__length1;
				gchar** _tmp21_;
				gint _tmp21__length1;
				gdouble _tmp22_ = 0.0;
				gint x2;
				gchar** _tmp23_;
				gint _tmp23__length1;
				gchar** _tmp24_;
				gint _tmp24__length1;
				gdouble _tmp25_ = 0.0;
				gint y;
				gchar** _tmp26_;
				gint _tmp26__length1;
				gchar** _tmp27_;
				gint _tmp27__length1;
				gint _tmp28_;
				gdouble _tmp29_ = 0.0;
				gint z;
				_tmp17_ = attribute_names;
				_tmp17__length1 = attribute_names_length1;
				_tmp18_ = attribute_values;
				_tmp18__length1 = attribute_values_length1;
				_tmp19_ = map_loader_get_attribute_d (self, _tmp17_, _tmp17__length1, _tmp18_, _tmp18__length1, "left", 0.0);
				x1 = (gint) (_tmp19_ * 2);
				_tmp20_ = attribute_names;
				_tmp20__length1 = attribute_names_length1;
				_tmp21_ = attribute_values;
				_tmp21__length1 = attribute_values_length1;
				_tmp22_ = map_loader_get_attribute_d (self, _tmp20_, _tmp20__length1, _tmp21_, _tmp21__length1, "right", 0.0);
				x2 = (gint) (_tmp22_ * 2);
				_tmp23_ = attribute_names;
				_tmp23__length1 = attribute_names_length1;
				_tmp24_ = attribute_values;
				_tmp24__length1 = attribute_values_length1;
				_tmp25_ = map_loader_get_attribute_d (self, _tmp23_, _tmp23__length1, _tmp24_, _tmp24__length1, "y", 0.0);
				y = (gint) (_tmp25_ * 2);
				_tmp26_ = attribute_names;
				_tmp26__length1 = attribute_names_length1;
				_tmp27_ = attribute_values;
				_tmp27__length1 = attribute_values_length1;
				_tmp28_ = self->priv->layer_z;
				_tmp29_ = map_loader_get_attribute_d (self, _tmp26_, _tmp26__length1, _tmp27_, _tmp27__length1, "z", (gdouble) _tmp28_);
				z = (gint) _tmp29_;
				{
					gboolean _tmp30_;
					_tmp30_ = TRUE;
					while (TRUE) {
						gboolean _tmp31_;
						gint _tmp33_;
						gint _tmp34_;
						Map* _tmp35_;
						gint _tmp36_;
						gint _tmp37_;
						gint _tmp38_;
						Slot* _tmp39_;
						_tmp31_ = _tmp30_;
						if (!_tmp31_) {
							gint _tmp32_;
							_tmp32_ = x1;
							x1 = _tmp32_ + 2;
						}
						_tmp30_ = FALSE;
						_tmp33_ = x1;
						_tmp34_ = x2;
						if (!(_tmp33_ <= _tmp34_)) {
							break;
						}
						_tmp35_ = self->priv->map;
						_tmp36_ = x1;
						_tmp37_ = y;
						_tmp38_ = z;
						_tmp39_ = slot_new (_tmp36_, _tmp37_, _tmp38_);
						_tmp35_->slots = g_list_append (_tmp35_->slots, _tmp39_);
					}
				}
				break;
			}
		}
	} else if (_tmp4_ == ((0 != _tmp3_label4) ? _tmp3_label4 : (_tmp3_label4 = g_quark_from_static_string ("column")))) {
		switch (0) {
			default:
			{
				gchar** _tmp40_;
				gint _tmp40__length1;
				gchar** _tmp41_;
				gint _tmp41__length1;
				gdouble _tmp42_ = 0.0;
				gint x;
				gchar** _tmp43_;
				gint _tmp43__length1;
				gchar** _tmp44_;
				gint _tmp44__length1;
				gdouble _tmp45_ = 0.0;
				gint y1;
				gchar** _tmp46_;
				gint _tmp46__length1;
				gchar** _tmp47_;
				gint _tmp47__length1;
				gdouble _tmp48_ = 0.0;
				gint y2;
				gchar** _tmp49_;
				gint _tmp49__length1;
				gchar** _tmp50_;
				gint _tmp50__length1;
				gint _tmp51_;
				gdouble _tmp52_ = 0.0;
				gint z;
				_tmp40_ = attribute_names;
				_tmp40__length1 = attribute_names_length1;
				_tmp41_ = attribute_values;
				_tmp41__length1 = attribute_values_length1;
				_tmp42_ = map_loader_get_attribute_d (self, _tmp40_, _tmp40__length1, _tmp41_, _tmp41__length1, "x", 0.0);
				x = (gint) (_tmp42_ * 2);
				_tmp43_ = attribute_names;
				_tmp43__length1 = attribute_names_length1;
				_tmp44_ = attribute_values;
				_tmp44__length1 = attribute_values_length1;
				_tmp45_ = map_loader_get_attribute_d (self, _tmp43_, _tmp43__length1, _tmp44_, _tmp44__length1, "top", 0.0);
				y1 = (gint) (_tmp45_ * 2);
				_tmp46_ = attribute_names;
				_tmp46__length1 = attribute_names_length1;
				_tmp47_ = attribute_values;
				_tmp47__length1 = attribute_values_length1;
				_tmp48_ = map_loader_get_attribute_d (self, _tmp46_, _tmp46__length1, _tmp47_, _tmp47__length1, "bottom", 0.0);
				y2 = (gint) (_tmp48_ * 2);
				_tmp49_ = attribute_names;
				_tmp49__length1 = attribute_names_length1;
				_tmp50_ = attribute_values;
				_tmp50__length1 = attribute_values_length1;
				_tmp51_ = self->priv->layer_z;
				_tmp52_ = map_loader_get_attribute_d (self, _tmp49_, _tmp49__length1, _tmp50_, _tmp50__length1, "z", (gdouble) _tmp51_);
				z = (gint) _tmp52_;
				{
					gboolean _tmp53_;
					_tmp53_ = TRUE;
					while (TRUE) {
						gboolean _tmp54_;
						gint _tmp56_;
						gint _tmp57_;
						Map* _tmp58_;
						gint _tmp59_;
						gint _tmp60_;
						gint _tmp61_;
						Slot* _tmp62_;
						_tmp54_ = _tmp53_;
						if (!_tmp54_) {
							gint _tmp55_;
							_tmp55_ = y1;
							y1 = _tmp55_ + 2;
						}
						_tmp53_ = FALSE;
						_tmp56_ = y1;
						_tmp57_ = y2;
						if (!(_tmp56_ <= _tmp57_)) {
							break;
						}
						_tmp58_ = self->priv->map;
						_tmp59_ = x;
						_tmp60_ = y1;
						_tmp61_ = z;
						_tmp62_ = slot_new (_tmp59_, _tmp60_, _tmp61_);
						_tmp58_->slots = g_list_append (_tmp58_->slots, _tmp62_);
					}
				}
				break;
			}
		}
	} else if (_tmp4_ == ((0 != _tmp3_label5) ? _tmp3_label5 : (_tmp3_label5 = g_quark_from_static_string ("block")))) {
		switch (0) {
			default:
			{
				gchar** _tmp63_;
				gint _tmp63__length1;
				gchar** _tmp64_;
				gint _tmp64__length1;
				gdouble _tmp65_ = 0.0;
				gint x1;
				gchar** _tmp66_;
				gint _tmp66__length1;
				gchar** _tmp67_;
				gint _tmp67__length1;
				gdouble _tmp68_ = 0.0;
				gint x2;
				gchar** _tmp69_;
				gint _tmp69__length1;
				gchar** _tmp70_;
				gint _tmp70__length1;
				gdouble _tmp71_ = 0.0;
				gint y1;
				gchar** _tmp72_;
				gint _tmp72__length1;
				gchar** _tmp73_;
				gint _tmp73__length1;
				gdouble _tmp74_ = 0.0;
				gint y2;
				gchar** _tmp75_;
				gint _tmp75__length1;
				gchar** _tmp76_;
				gint _tmp76__length1;
				gint _tmp77_;
				gdouble _tmp78_ = 0.0;
				gint z;
				_tmp63_ = attribute_names;
				_tmp63__length1 = attribute_names_length1;
				_tmp64_ = attribute_values;
				_tmp64__length1 = attribute_values_length1;
				_tmp65_ = map_loader_get_attribute_d (self, _tmp63_, _tmp63__length1, _tmp64_, _tmp64__length1, "left", 0.0);
				x1 = (gint) (_tmp65_ * 2);
				_tmp66_ = attribute_names;
				_tmp66__length1 = attribute_names_length1;
				_tmp67_ = attribute_values;
				_tmp67__length1 = attribute_values_length1;
				_tmp68_ = map_loader_get_attribute_d (self, _tmp66_, _tmp66__length1, _tmp67_, _tmp67__length1, "right", 0.0);
				x2 = (gint) (_tmp68_ * 2);
				_tmp69_ = attribute_names;
				_tmp69__length1 = attribute_names_length1;
				_tmp70_ = attribute_values;
				_tmp70__length1 = attribute_values_length1;
				_tmp71_ = map_loader_get_attribute_d (self, _tmp69_, _tmp69__length1, _tmp70_, _tmp70__length1, "top", 0.0);
				y1 = (gint) (_tmp71_ * 2);
				_tmp72_ = attribute_names;
				_tmp72__length1 = attribute_names_length1;
				_tmp73_ = attribute_values;
				_tmp73__length1 = attribute_values_length1;
				_tmp74_ = map_loader_get_attribute_d (self, _tmp72_, _tmp72__length1, _tmp73_, _tmp73__length1, "bottom", 0.0);
				y2 = (gint) (_tmp74_ * 2);
				_tmp75_ = attribute_names;
				_tmp75__length1 = attribute_names_length1;
				_tmp76_ = attribute_values;
				_tmp76__length1 = attribute_values_length1;
				_tmp77_ = self->priv->layer_z;
				_tmp78_ = map_loader_get_attribute_d (self, _tmp75_, _tmp75__length1, _tmp76_, _tmp76__length1, "z", (gdouble) _tmp77_);
				z = (gint) _tmp78_;
				{
					gboolean _tmp79_;
					_tmp79_ = TRUE;
					while (TRUE) {
						gboolean _tmp80_;
						gint _tmp82_;
						gint _tmp83_;
						_tmp80_ = _tmp79_;
						if (!_tmp80_) {
							gint _tmp81_;
							_tmp81_ = x1;
							x1 = _tmp81_ + 2;
						}
						_tmp79_ = FALSE;
						_tmp82_ = x1;
						_tmp83_ = x2;
						if (!(_tmp82_ <= _tmp83_)) {
							break;
						}
						{
							gint _tmp84_;
							gint y;
							_tmp84_ = y1;
							y = _tmp84_;
							{
								gboolean _tmp85_;
								_tmp85_ = TRUE;
								while (TRUE) {
									gboolean _tmp86_;
									gint _tmp88_;
									gint _tmp89_;
									Map* _tmp90_;
									gint _tmp91_;
									gint _tmp92_;
									gint _tmp93_;
									Slot* _tmp94_;
									_tmp86_ = _tmp85_;
									if (!_tmp86_) {
										gint _tmp87_;
										_tmp87_ = y;
										y = _tmp87_ + 2;
									}
									_tmp85_ = FALSE;
									_tmp88_ = y;
									_tmp89_ = y2;
									if (!(_tmp88_ <= _tmp89_)) {
										break;
									}
									_tmp90_ = self->priv->map;
									_tmp91_ = x1;
									_tmp92_ = y;
									_tmp93_ = z;
									_tmp94_ = slot_new (_tmp91_, _tmp92_, _tmp93_);
									_tmp90_->slots = g_list_append (_tmp90_->slots, _tmp94_);
								}
							}
						}
					}
				}
				break;
			}
		}
	} else if (_tmp4_ == ((0 != _tmp3_label6) ? _tmp3_label6 : (_tmp3_label6 = g_quark_from_static_string ("tile")))) {
		switch (0) {
			default:
			{
				gchar** _tmp95_;
				gint _tmp95__length1;
				gchar** _tmp96_;
				gint _tmp96__length1;
				gdouble _tmp97_ = 0.0;
				gint x;
				gchar** _tmp98_;
				gint _tmp98__length1;
				gchar** _tmp99_;
				gint _tmp99__length1;
				gdouble _tmp100_ = 0.0;
				gint y;
				gchar** _tmp101_;
				gint _tmp101__length1;
				gchar** _tmp102_;
				gint _tmp102__length1;
				gint _tmp103_;
				gdouble _tmp104_ = 0.0;
				gint z;
				Map* _tmp105_;
				gint _tmp106_;
				gint _tmp107_;
				gint _tmp108_;
				Slot* _tmp109_;
				_tmp95_ = attribute_names;
				_tmp95__length1 = attribute_names_length1;
				_tmp96_ = attribute_values;
				_tmp96__length1 = attribute_values_length1;
				_tmp97_ = map_loader_get_attribute_d (self, _tmp95_, _tmp95__length1, _tmp96_, _tmp96__length1, "x", 0.0);
				x = (gint) (_tmp97_ * 2);
				_tmp98_ = attribute_names;
				_tmp98__length1 = attribute_names_length1;
				_tmp99_ = attribute_values;
				_tmp99__length1 = attribute_values_length1;
				_tmp100_ = map_loader_get_attribute_d (self, _tmp98_, _tmp98__length1, _tmp99_, _tmp99__length1, "y", 0.0);
				y = (gint) (_tmp100_ * 2);
				_tmp101_ = attribute_names;
				_tmp101__length1 = attribute_names_length1;
				_tmp102_ = attribute_values;
				_tmp102__length1 = attribute_values_length1;
				_tmp103_ = self->priv->layer_z;
				_tmp104_ = map_loader_get_attribute_d (self, _tmp101_, _tmp101__length1, _tmp102_, _tmp102__length1, "z", (gdouble) _tmp103_);
				z = (gint) _tmp104_;
				_tmp105_ = self->priv->map;
				_tmp106_ = x;
				_tmp107_ = y;
				_tmp108_ = z;
				_tmp109_ = slot_new (_tmp106_, _tmp107_, _tmp108_);
				_tmp105_->slots = g_list_append (_tmp105_->slots, _tmp109_);
				break;
			}
		}
	}
}


static gpointer _map_ref0 (gpointer self) {
	return self ? map_ref (self) : NULL;
}


static void map_loader_end_element_cb (MapLoader* self, GMarkupParseContext* context, const gchar* element_name, GError** error) {
	const gchar* _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_;
	GQuark _tmp4_ = 0U;
	static GQuark _tmp3_label0 = 0;
	static GQuark _tmp3_label1 = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (context != NULL);
	g_return_if_fail (element_name != NULL);
	_tmp0_ = element_name;
	_tmp1_ = g_utf8_strdown (_tmp0_, (gssize) (-1));
	_tmp2_ = _tmp1_;
	_tmp4_ = (NULL == _tmp2_) ? 0 : g_quark_from_string (_tmp2_);
	g_free (_tmp2_);
	if (_tmp4_ == ((0 != _tmp3_label0) ? _tmp3_label0 : (_tmp3_label0 = g_quark_from_static_string ("map")))) {
		switch (0) {
			default:
			{
				Map* _tmp5_;
				GList* _tmp6_;
				guint _tmp7_ = 0U;
				guint n_slots;
				gboolean _tmp8_ = FALSE;
				gboolean _tmp9_ = FALSE;
				gboolean _tmp10_ = FALSE;
				Map* _tmp11_;
				const gchar* _tmp12_;
				gboolean _tmp15_;
				gboolean _tmp17_;
				gboolean _tmp19_;
				_tmp5_ = self->priv->map;
				_tmp6_ = _tmp5_->slots;
				_tmp7_ = g_list_length (_tmp6_);
				n_slots = _tmp7_;
				_tmp11_ = self->priv->map;
				_tmp12_ = _tmp11_->name;
				if (_tmp12_ != NULL) {
					Map* _tmp13_;
					const gchar* _tmp14_;
					_tmp13_ = self->priv->map;
					_tmp14_ = _tmp13_->score_name;
					_tmp10_ = _tmp14_ != NULL;
				} else {
					_tmp10_ = FALSE;
				}
				_tmp15_ = _tmp10_;
				if (_tmp15_) {
					guint _tmp16_;
					_tmp16_ = n_slots;
					_tmp9_ = _tmp16_ <= ((guint) 144);
				} else {
					_tmp9_ = FALSE;
				}
				_tmp17_ = _tmp9_;
				if (_tmp17_) {
					guint _tmp18_;
					_tmp18_ = n_slots;
					_tmp8_ = (_tmp18_ % 2) == ((guint) 0);
				} else {
					_tmp8_ = FALSE;
				}
				_tmp19_ = _tmp8_;
				if (_tmp19_) {
					Map* _tmp20_;
					Map* _tmp21_;
					_tmp20_ = self->priv->map;
					_tmp21_ = _map_ref0 (_tmp20_);
					self->maps = g_list_append (self->maps, _tmp21_);
				} else {
					g_warning ("map.vala:349: Invalid map");
				}
				_map_unref0 (self->priv->map);
				self->priv->map = NULL;
				break;
			}
		}
	} else if (_tmp4_ == ((0 != _tmp3_label1) ? _tmp3_label1 : (_tmp3_label1 = g_quark_from_static_string ("layer")))) {
		switch (0) {
			default:
			{
				self->priv->layer_z = 0;
				break;
			}
		}
	}
}


MapLoader* map_loader_construct (GType object_type) {
	MapLoader* self = NULL;
	self = (MapLoader*) g_type_create_instance (object_type);
	return self;
}


MapLoader* map_loader_new (void) {
	return map_loader_construct (TYPE_MAP_LOADER);
}


static void value_map_loader_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void value_map_loader_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		map_loader_unref (value->data[0].v_pointer);
	}
}


static void value_map_loader_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = map_loader_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer value_map_loader_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* value_map_loader_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		MapLoader* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = map_loader_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* value_map_loader_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	MapLoader** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = map_loader_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* param_spec_map_loader (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ParamSpecMapLoader* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_MAP_LOADER), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer value_get_map_loader (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAP_LOADER), NULL);
	return value->data[0].v_pointer;
}


void value_set_map_loader (GValue* value, gpointer v_object) {
	MapLoader* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAP_LOADER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAP_LOADER));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		map_loader_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		map_loader_unref (old);
	}
}


void value_take_map_loader (GValue* value, gpointer v_object) {
	MapLoader* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAP_LOADER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAP_LOADER));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		map_loader_unref (old);
	}
}


static void map_loader_class_init (MapLoaderClass * klass) {
	map_loader_parent_class = g_type_class_peek_parent (klass);
	MAP_LOADER_CLASS (klass)->finalize = map_loader_finalize;
	g_type_class_add_private (klass, sizeof (MapLoaderPrivate));
}


static void map_loader_instance_init (MapLoader * self) {
	self->priv = MAP_LOADER_GET_PRIVATE (self);
	self->maps = NULL;
	self->priv->layer_z = 0;
	self->ref_count = 1;
}


static void map_loader_finalize (MapLoader* obj) {
	MapLoader * self;
	self = MAP_LOADER (obj);
	__g_list_free__map_unref0_0 (self->maps);
	_map_unref0 (self->priv->map);
}


GType map_loader_get_type (void) {
	static volatile gsize map_loader_type_id__volatile = 0;
	if (g_once_init_enter (&map_loader_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { value_map_loader_init, value_map_loader_free_value, value_map_loader_copy_value, value_map_loader_peek_pointer, "p", value_map_loader_collect_value, "p", value_map_loader_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (MapLoaderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) map_loader_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MapLoader), 0, (GInstanceInitFunc) map_loader_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType map_loader_type_id;
		map_loader_type_id = g_type_register_fundamental (g_type_fundamental_next (), "MapLoader", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&map_loader_type_id__volatile, map_loader_type_id);
	}
	return map_loader_type_id__volatile;
}


gpointer map_loader_ref (gpointer instance) {
	MapLoader* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void map_loader_unref (gpointer instance) {
	MapLoader* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		MAP_LOADER_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



