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

/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * Gnome Nibbles: Gnome Worm Game
 * Copyright (C) 2015 Iulian-Gabriel Radu <iulian.radu67@gmail.com>
 * Copyright (C) 2022-24 Ben Corby <bcorby@new-ms.com>
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 */
/*
 * Coding style.
 *
 * To help you comply with the coding style in this project use the
 * following greps. Any lines returned should be adjusted so they
 * don't match. The convoluted regular expressions are so they don't
 * match them self.
 *
 * grep -ne '[^][)(_!$ "](' *.vala
 * grep -ne '[(] ' *.vala
 * grep -ne '[ ])' *.vala
 * grep -ne ' $' *.vala
 *
 */

#include <glib-object.h>
#include <glib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_BONUS (bonus_get_type ())
#define BONUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BONUS, Bonus))
#define BONUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BONUS, BonusClass))
#define IS_BONUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BONUS))
#define IS_BONUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BONUS))
#define BONUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BONUS, BonusClass))

typedef struct _Bonus Bonus;
typedef struct _BonusClass BonusClass;
typedef struct _BonusPrivate BonusPrivate;
typedef enum  {
	BONUS_ETYPE_REGULAR,
	BONUS_ETYPE_HALF,
	BONUS_ETYPE_DOUBLE,
	BONUS_ETYPE_LIFE,
	BONUS_ETYPE_REVERSE,
	BONUS_ETYPE_WARP
} BonuseType;

#define BONUS_TYPE_ETYPE (bonus_etype_get_type ())
enum  {
	BONUS_0_PROPERTY,
	BONUS_ETYPE_PROPERTY,
	BONUS_FAKE_PROPERTY,
	BONUS_X_PROPERTY,
	BONUS_Y_PROPERTY,
	BONUS_COUNTDOWN_PROPERTY,
	BONUS_NUM_PROPERTIES
};
static GParamSpec* bonus_properties[BONUS_NUM_PROPERTIES];

struct _Bonus {
	GObject parent_instance;
	BonusPrivate * priv;
};

struct _BonusClass {
	GObjectClass parent_class;
};

struct _BonusPrivate {
	BonuseType _etype;
	gboolean _fake;
	guint8 _x;
	guint8 _y;
	guint16 _countdown;
};

static gint Bonus_private_offset;
static gpointer bonus_parent_class = NULL;

VALA_EXTERN GType bonus_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bonus, g_object_unref)
VALA_EXTERN GType bonus_etype_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Bonus* bonus_new (guint8 x,
                  guint8 y,
                  GType type,
                  gboolean fake,
                  guint16 countdown);
VALA_EXTERN Bonus* bonus_construct (GType object_type,
                        guint8 x,
                        guint8 y,
                        GType type,
                        gboolean fake,
                        guint16 countdown);
VALA_EXTERN BonuseType bonus_get_etype (Bonus* self);
static void bonus_set_etype (Bonus* self,
                      BonuseType value);
VALA_EXTERN gboolean bonus_get_fake (Bonus* self);
static void bonus_set_fake (Bonus* self,
                     gboolean value);
VALA_EXTERN guint8 bonus_get_x (Bonus* self);
static void bonus_set_x (Bonus* self,
                  guint8 value);
VALA_EXTERN guint8 bonus_get_y (Bonus* self);
static void bonus_set_y (Bonus* self,
                  guint8 value);
VALA_EXTERN guint16 bonus_get_countdown (Bonus* self);
VALA_EXTERN void bonus_set_countdown (Bonus* self,
                          guint16 value);
static void bonus_finalize (GObject * obj);
static GType bonus_get_type_once (void);
static void _vala_bonus_get_property (GObject * object,
                               guint property_id,
                               GValue * value,
                               GParamSpec * pspec);
static void _vala_bonus_set_property (GObject * object,
                               guint property_id,
                               const GValue * value,
                               GParamSpec * pspec);

static inline gpointer
bonus_get_instance_private (Bonus* self)
{
	return G_STRUCT_MEMBER_P (self, Bonus_private_offset);
}

 G_GNUC_NO_INLINE static GType
bonus_etype_get_type_once (void)
{
	static const GEnumValue values[] = {{BONUS_ETYPE_REGULAR, "BONUS_ETYPE_REGULAR", "regular"}, {BONUS_ETYPE_HALF, "BONUS_ETYPE_HALF", "half"}, {BONUS_ETYPE_DOUBLE, "BONUS_ETYPE_DOUBLE", "double"}, {BONUS_ETYPE_LIFE, "BONUS_ETYPE_LIFE", "life"}, {BONUS_ETYPE_REVERSE, "BONUS_ETYPE_REVERSE", "reverse"}, {BONUS_ETYPE_WARP, "BONUS_ETYPE_WARP", "warp"}, {0, NULL, NULL}};
	GType bonus_etype_type_id;
	bonus_etype_type_id = g_enum_register_static ("BonuseType", values);
	return bonus_etype_type_id;
}

GType
bonus_etype_get_type (void)
{
	static GType bonus_etype_type_id__once = 0;
	if (g_once_init_enter_pointer (&bonus_etype_type_id__once)) {
		GType bonus_etype_type_id;
		bonus_etype_type_id = bonus_etype_get_type_once ();
		g_once_init_leave_pointer (&bonus_etype_type_id__once, bonus_etype_type_id);
	}
	return bonus_etype_type_id__once;
}

Bonus*
bonus_construct (GType object_type,
                 guint8 x,
                 guint8 y,
                 GType type,
                 gboolean fake,
                 guint16 countdown)
{
	Bonus * self = NULL;
	self = (Bonus*) g_object_new (object_type, "x", x, "y", y, "etype", type, "fake", fake, "countdown", countdown, NULL);
	return self;
}

Bonus*
bonus_new (guint8 x,
           guint8 y,
           GType type,
           gboolean fake,
           guint16 countdown)
{
	return bonus_construct (TYPE_BONUS, x, y, type, fake, countdown);
}

BonuseType
bonus_get_etype (Bonus* self)
{
	BonuseType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_etype;
	return result;
}

static void
bonus_set_etype (Bonus* self,
                 BonuseType value)
{
	BonuseType old_value;
	g_return_if_fail (self != NULL);
	old_value = bonus_get_etype (self);
	if (old_value != value) {
		self->priv->_etype = value;
		g_object_notify_by_pspec ((GObject *) self, bonus_properties[BONUS_ETYPE_PROPERTY]);
	}
}

gboolean
bonus_get_fake (Bonus* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_fake;
	return result;
}

static void
bonus_set_fake (Bonus* self,
                gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = bonus_get_fake (self);
	if (old_value != value) {
		self->priv->_fake = value;
		g_object_notify_by_pspec ((GObject *) self, bonus_properties[BONUS_FAKE_PROPERTY]);
	}
}

guint8
bonus_get_x (Bonus* self)
{
	guint8 result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_x;
	return result;
}

static void
bonus_set_x (Bonus* self,
             guint8 value)
{
	guint8 old_value;
	g_return_if_fail (self != NULL);
	old_value = bonus_get_x (self);
	if (old_value != value) {
		self->priv->_x = value;
		g_object_notify_by_pspec ((GObject *) self, bonus_properties[BONUS_X_PROPERTY]);
	}
}

guint8
bonus_get_y (Bonus* self)
{
	guint8 result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_y;
	return result;
}

static void
bonus_set_y (Bonus* self,
             guint8 value)
{
	guint8 old_value;
	g_return_if_fail (self != NULL);
	old_value = bonus_get_y (self);
	if (old_value != value) {
		self->priv->_y = value;
		g_object_notify_by_pspec ((GObject *) self, bonus_properties[BONUS_Y_PROPERTY]);
	}
}

guint16
bonus_get_countdown (Bonus* self)
{
	guint16 result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_countdown;
	return result;
}

void
bonus_set_countdown (Bonus* self,
                     guint16 value)
{
	guint16 old_value;
	g_return_if_fail (self != NULL);
	old_value = bonus_get_countdown (self);
	if (old_value != value) {
		self->priv->_countdown = value;
		g_object_notify_by_pspec ((GObject *) self, bonus_properties[BONUS_COUNTDOWN_PROPERTY]);
	}
}

static void
bonus_class_init (BonusClass * klass,
                  gpointer klass_data)
{
	bonus_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &Bonus_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_bonus_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_bonus_set_property;
	G_OBJECT_CLASS (klass)->finalize = bonus_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BONUS_ETYPE_PROPERTY, bonus_properties[BONUS_ETYPE_PROPERTY] = g_param_spec_enum ("etype", "etype", "etype", BONUS_TYPE_ETYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BONUS_FAKE_PROPERTY, bonus_properties[BONUS_FAKE_PROPERTY] = g_param_spec_boolean ("fake", "fake", "fake", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BONUS_X_PROPERTY, bonus_properties[BONUS_X_PROPERTY] = g_param_spec_uchar ("x", "x", "x", 0, G_MAXUINT8, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BONUS_Y_PROPERTY, bonus_properties[BONUS_Y_PROPERTY] = g_param_spec_uchar ("y", "y", "y", 0, G_MAXUINT8, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BONUS_COUNTDOWN_PROPERTY, bonus_properties[BONUS_COUNTDOWN_PROPERTY] = g_param_spec_uint ("countdown", "countdown", "countdown", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static void
bonus_instance_init (Bonus * self,
                     gpointer klass)
{
	self->priv = bonus_get_instance_private (self);
}

static void
bonus_finalize (GObject * obj)
{
	Bonus * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BONUS, Bonus);
	G_OBJECT_CLASS (bonus_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
bonus_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BonusClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bonus_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bonus), 0, (GInstanceInitFunc) bonus_instance_init, NULL };
	GType bonus_type_id;
	bonus_type_id = g_type_register_static (G_TYPE_OBJECT, "Bonus", &g_define_type_info, G_TYPE_FLAG_NONE);
	Bonus_private_offset = g_type_add_instance_private (bonus_type_id, sizeof (BonusPrivate));
	return bonus_type_id;
}

GType
bonus_get_type (void)
{
	static GType bonus_type_id__once = 0;
	if (g_once_init_enter_pointer (&bonus_type_id__once)) {
		GType bonus_type_id;
		bonus_type_id = bonus_get_type_once ();
		g_once_init_leave_pointer (&bonus_type_id__once, bonus_type_id);
	}
	return bonus_type_id__once;
}

static void
_vala_bonus_get_property (GObject * object,
                          guint property_id,
                          GValue * value,
                          GParamSpec * pspec)
{
	Bonus * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BONUS, Bonus);
	switch (property_id) {
		case BONUS_ETYPE_PROPERTY:
		g_value_set_enum (value, bonus_get_etype (self));
		break;
		case BONUS_FAKE_PROPERTY:
		g_value_set_boolean (value, bonus_get_fake (self));
		break;
		case BONUS_X_PROPERTY:
		g_value_set_uchar (value, bonus_get_x (self));
		break;
		case BONUS_Y_PROPERTY:
		g_value_set_uchar (value, bonus_get_y (self));
		break;
		case BONUS_COUNTDOWN_PROPERTY:
		g_value_set_uint (value, bonus_get_countdown (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_bonus_set_property (GObject * object,
                          guint property_id,
                          const GValue * value,
                          GParamSpec * pspec)
{
	Bonus * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BONUS, Bonus);
	switch (property_id) {
		case BONUS_ETYPE_PROPERTY:
		bonus_set_etype (self, g_value_get_enum (value));
		break;
		case BONUS_FAKE_PROPERTY:
		bonus_set_fake (self, g_value_get_boolean (value));
		break;
		case BONUS_X_PROPERTY:
		bonus_set_x (self, g_value_get_uchar (value));
		break;
		case BONUS_Y_PROPERTY:
		bonus_set_y (self, g_value_get_uchar (value));
		break;
		case BONUS_COUNTDOWN_PROPERTY:
		bonus_set_countdown (self, g_value_get_uint (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

