Created the skeleton of the world loading routines
Signed-off-by: Gergely Polonkai (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
parent
027359eb85
commit
0d427d3f93
@ -25,6 +25,7 @@
|
||||
<xi:include href="xml/interpreter.xml"/>
|
||||
<xi:include href="xml/db.xml"/>
|
||||
<xi:include href="xml/player.xml"/>
|
||||
<xi:include href="xml/world.xml"/>
|
||||
|
||||
</chapter>
|
||||
<!--chapter id="object-tree">
|
||||
|
@ -79,3 +79,7 @@ wmud_player_auth
|
||||
wmud_player_exists
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE></TITLE>
|
||||
<FILE>world</FILE>
|
||||
</SECTION>
|
||||
|
@ -1,5 +1,5 @@
|
||||
bin_PROGRAMS = wmud
|
||||
AM_CPPFLAGS = -DWMUD_STATEDIR=\""$(localstatedir)"\" -DWMUD_CONFDIR=\""$(sysconfdir)"\" $(MEMCACHED_CFLAGS) $(GLIB_CFLAGS) $(GIO_CFLAGS) $(GTHREAD_CFLAGS) $(SQLITE3_CFLAGS)
|
||||
|
||||
wmud_SOURCES = main.c game-networking.c interpreter.c db.c players.c maintenance.c game.c configuration.c
|
||||
wmud_SOURCES = main.c game-networking.c interpreter.c db.c players.c maintenance.c game.c configuration.c world.c
|
||||
wmud_LDADD = $(MEMCACHED_LIBS) $(GLIB_LIBS) $(GIO_LIBS) $(GTHREAD_LIBS) $(SQLITE3_LIBS)
|
||||
|
36
src/db.c
36
src/db.c
@ -178,3 +178,39 @@ wmud_db_save_player(wmudPlayer *player, GError **err)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_db_load_planes(GSList **planes, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_db_load_planets(GSList **planets, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_db_load_directions(GSList **directions, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_db_load_areas(GSList **areas, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_db_load_rooms(GSList **rooms, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_db_load_exits(GSList **exits, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
6
src/db.h
6
src/db.h
@ -28,6 +28,12 @@ extern GQuark WMUD_DB_ERROR;
|
||||
gboolean wmud_db_init(GError **err);
|
||||
gboolean wmud_db_players_load(GError **err);
|
||||
gboolean wmud_db_save_player(wmudPlayer *player, GError **err);
|
||||
gboolean wmud_db_load_planes(GSList **planes, GError **err);
|
||||
gboolean wmud_db_load_planets(GSList **planets, GError **err);
|
||||
gboolean wmud_db_load_directions(GSList **directions, GError **err);
|
||||
gboolean wmud_db_load_areas(GSList **areas, GError **err);
|
||||
gboolean wmud_db_load_rooms(GSList **rooms, GError **err);
|
||||
gboolean wmud_db_load_exits(GSList **exits, GError **err);
|
||||
|
||||
#endif /* __WMUD__DB_H__ */
|
||||
|
||||
|
155
src/world.c
Normal file
155
src/world.c
Normal file
@ -0,0 +1,155 @@
|
||||
/* wMUD - Yet another MUD codebase by W00d5t0ck
|
||||
* Copyright (C) 2012 - Gergely POLONKAI
|
||||
*
|
||||
* world.c: world loading and building functions
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "world.h"
|
||||
#include "db.h"
|
||||
|
||||
/**
|
||||
* SECTION:world
|
||||
* @short_description: World loading and building functions
|
||||
* @title: Game world manipulation
|
||||
*
|
||||
*/
|
||||
|
||||
gboolean
|
||||
wmud_world_check_planes(GSList *planes, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_world_check_planets(GSList *planets, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_world_check_areas(GSList *areas, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_world_check_exits(GSList *exits, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_world_assoc_planets_planes(GSList *planets, GSList *planes, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_world_assoc_rooms_areas(GSList *rooms, GSList *areas, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_world_assoc_rooms_planets(GSList *rooms, GSList *planets, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wmud_world_assoc_exits_rooms(GSList *exits, GSList *rooms, GError **err)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wmud_world_load:
|
||||
* @err: a #GError to put error messages into
|
||||
*
|
||||
* Load the world from the database backend without activating it.
|
||||
*/
|
||||
gboolean
|
||||
wmud_world_load(GError **err)
|
||||
{
|
||||
GSList *planes = NULL,
|
||||
*planets = NULL,
|
||||
*directions = NULL,
|
||||
*areas = NULL,
|
||||
*rooms = NULL,
|
||||
*exits = NULL;
|
||||
GError *in_err = NULL;
|
||||
|
||||
/* Load directions from the database */
|
||||
wmud_db_load_directions(&directions, &in_err);
|
||||
|
||||
/* Load planes from the database */
|
||||
wmud_db_load_planes(&planes, &in_err);
|
||||
|
||||
/* Check if the loaded planes conform to the rules */
|
||||
g_clear_error(&in_err);
|
||||
wmud_world_check_planes(planes, &in_err);
|
||||
|
||||
/* Load planets from the database */
|
||||
g_clear_error(&in_err);
|
||||
wmud_db_load_planets(&planets, &in_err);
|
||||
|
||||
/* Check if the planets conform to the rules */
|
||||
g_clear_error(&in_err);
|
||||
wmud_world_check_planets(planets, &in_err);
|
||||
|
||||
/* Put the planets on the planes */
|
||||
g_clear_error(&in_err);
|
||||
wmud_world_assoc_planets_planes(planets, planes, &in_err);
|
||||
|
||||
/* Load areas from the database */
|
||||
g_clear_error(&in_err);
|
||||
wmud_db_load_areas(&areas, &in_err);
|
||||
|
||||
/* Check if the areas conform to the rules */
|
||||
g_clear_error(&in_err);
|
||||
wmud_world_check_areas(areas, &in_err);
|
||||
|
||||
/* Load rooms from the database */
|
||||
g_clear_error(&in_err);
|
||||
wmud_db_load_rooms(&rooms, &in_err);
|
||||
|
||||
/* Associate rooms with the areas */
|
||||
g_clear_error(&in_err);
|
||||
wmud_world_assoc_rooms_areas(rooms, areas, &in_err);
|
||||
|
||||
/* Associate rooms with planets */
|
||||
g_clear_error(&in_err);
|
||||
wmud_world_assoc_rooms_planets(rooms, planets, &in_err);
|
||||
|
||||
/* Load room exits from the database */
|
||||
g_clear_error(&in_err);
|
||||
wmud_db_load_exits(&exits, &in_err);
|
||||
|
||||
/* Check if the exits conform to the rules */
|
||||
g_clear_error(&in_err);
|
||||
wmud_world_check_exits(exits, &in_err);
|
||||
|
||||
/* Associate exits with rooms */
|
||||
g_clear_error(&in_err);
|
||||
wmud_world_assoc_exits_rooms(exits, rooms, &in_err);
|
||||
|
||||
g_clear_error(&in_err);
|
||||
return TRUE;
|
||||
}
|
||||
|
33
src/world.h
Normal file
33
src/world.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* wMUD - Yet another MUD codebase by W00d5t0ck
|
||||
* Copyright (C) 2012 - Gergely POLONKAI
|
||||
*
|
||||
* world.h: world loading and building functions
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __WMUD_WORLD_H__
|
||||
#define __WMUD_WORLD_H__
|
||||
|
||||
gboolean wmud_world_check_planes(GSList *planes, GError **err);
|
||||
gboolean wmud_world_check_planets(GSList *planets, GError **err);
|
||||
gboolean wmud_world_check_areas(GSList *areas, GError **err);
|
||||
gboolean wmud_world_check_exits(GSList *exits, GError **err);
|
||||
|
||||
gboolean wmud_world_assoc_planets_planes(GSList *planets, GSList *planes, GError **err);
|
||||
gboolean wmud_world_assoc_rooms_areas(GSList *rooms, GSList *areas, GError **err);
|
||||
gboolean wmud_world_assoc_rooms_planets(GSList *rooms, GSList *planets, GError **err);
|
||||
gboolean wmud_world_assoc_exits_rooms(GSList *exits, GSList *rooms, GError **err);
|
||||
|
||||
#endif /* __WMUD_WORLD_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user