From fbf6e7ca6ac8defd318858709b301e093e31881d Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 21 Jun 2013 13:57:47 +0200 Subject: [PATCH] Created a yet unused WmudWorld object for later world handling --- docs/reference/wmud/wmud-docs.sgml | 1 + docs/reference/wmud/wmud-sections.txt | 13 +++++ wmud/Makefile.am | 4 +- wmud/wmudworld.c | 70 +++++++++++++++++++++++++++ wmud/wmudworld.h | 56 +++++++++++++++++++++ 5 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 wmud/wmudworld.c create mode 100644 wmud/wmudworld.h diff --git a/docs/reference/wmud/wmud-docs.sgml b/docs/reference/wmud/wmud-docs.sgml index 9c9d409..ebba2ff 100644 --- a/docs/reference/wmud/wmud-docs.sgml +++ b/docs/reference/wmud/wmud-docs.sgml @@ -20,6 +20,7 @@ + diff --git a/docs/reference/wmud/wmud-sections.txt b/docs/reference/wmud/wmud-sections.txt index e23a003..ca27f58 100644 --- a/docs/reference/wmud/wmud-sections.txt +++ b/docs/reference/wmud/wmud-sections.txt @@ -67,6 +67,19 @@ wmud_player_set_player_name wmud_player_set_registered +
+WmudWorld +wmudworld +WMUD_IS_WORLD +WMUD_IS_WORLD_CLASS +WMUD_TYPE_WORLD +WMUD_WORLD +WMUD_WORLD_CLASS +WMUD_WORLD_GET_CLASS +WmudWorldPrivate +wmud_world_new +
+
utils diff --git a/wmud/Makefile.am b/wmud/Makefile.am index 871576c..a3cefe5 100644 --- a/wmud/Makefile.am +++ b/wmud/Makefile.am @@ -30,7 +30,9 @@ wmud_SOURCES = \ wmudplayer.h \ wmudclientstate.h \ enumtypes.h \ - enumtypes.c + enumtypes.c \ + wmudworld.c \ + wmudworld.h wmud_LDADD = $(MEMCACHED_LIBS) $(GLIB_LIBS) $(GIO_LIBS) $(GTHREAD_LIBS) $(GDA_LIBS) $(CURL_LIBS) diff --git a/wmud/wmudworld.c b/wmud/wmudworld.c new file mode 100644 index 0000000..878e5f2 --- /dev/null +++ b/wmud/wmudworld.c @@ -0,0 +1,70 @@ +/* wMUD - Yet another MUD codebase by W00d5t0ck + * Copyright (C) 2012 - Gergely POLONKAI + * + * wmudworld.c: the WmudWorld object + * + * 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, see . + */ +#include "wmudworld.h" + +/** + * SECTION:wmudworld + * @short_description: wMUD World + * @include: wmudworld.h + * + * #WmudWorld is for storing an online world + */ + +G_DEFINE_TYPE(WmudWorld, wmud_world, G_TYPE_OBJECT); + +#define WMUD_WORLD_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WMUD_TYPE_WORLD, WmudWorldPrivate)) + +struct _WmudWorldPrivate +{ +}; + +static void +wmud_world_dispose(GObject *gobject) +{ + G_OBJECT_CLASS(wmud_world_parent_class)->dispose(gobject); +} + +static void +wmud_world_finalize(GObject *gobject) +{ + G_OBJECT_CLASS(wmud_world_parent_class)->finalize(gobject); +} + +static void +wmud_world_class_init(WmudWorldClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + + gobject_class->dispose = wmud_world_dispose; + gobject_class->finalize = wmud_world_finalize; + + g_type_class_add_private(klass, sizeof(WmudWorldPrivate)); +} + +static void +wmud_world_init(WmudWorld *self) +{ + self->priv = WMUD_WORLD_GET_PRIVATE(self); +} + +WmudWorld * +wmud_world_new(void) +{ + return g_object_new(WMUD_TYPE_WORLD, NULL, NULL); +} diff --git a/wmud/wmudworld.h b/wmud/wmudworld.h new file mode 100644 index 0000000..9cbb3ef --- /dev/null +++ b/wmud/wmudworld.h @@ -0,0 +1,56 @@ +/* wMUD - Yet another MUD codebase by W00d5t0ck + * Copyright (C) 2012 - Gergely POLONKAI + * + * wmudworld.h: header file for the WmudWorld object + * + * 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, see . + */ + +#ifndef __WMUD_WMUDWORLD_H__ +#define __WMUD_WMUDWORLD_H__ + +#include +#include + +#define WMUD_TYPE_WORLD (wmud_world_get_type()) +#define WMUD_WORLD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WMUD_TYPE_WORLD, WmudWorld)) +#define WMUD_IS_WORLD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WMUD_TYPE_WORLD)) +#define WMUD_WORLD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WMUD_TYPE_WORLD, WmudWorldClass)) +#define WMUD_IS_WORLD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WMUD_TYPE_WORLD)) +#define WMUD_WORLD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WMUT_TYPE_WORLD, WmudWorldClass)) + +/** + * WmudWorld: + * + * An online wMUD world + */ +typedef struct _WmudWorld WmudWorld; +typedef struct _WmudWorldClass WmudWorldClass; +typedef struct _WmudWorldPrivate WmudWorldPrivate; + +struct _WmudWorld +{ + /**/ + GObject parent_instance; + WmudWorldPrivate *priv; +}; + +struct _WmudWorldClass +{ + GObjectClass parent_class; +}; + +WmudWorld *wmud_world_new(void); + +#endif /* __WMUD_WMUDWORLD_H__ */