diff --git a/wmud/configuration.c b/wmud/configuration.c index 21a973d..2443dba 100644 --- a/wmud/configuration.c +++ b/wmud/configuration.c @@ -23,7 +23,6 @@ #include -#include "wmud-types.h" #include "configuration.h" /** diff --git a/wmud/db.h b/wmud/db.h index e63fc60..eb89482 100644 --- a/wmud/db.h +++ b/wmud/db.h @@ -22,7 +22,6 @@ #include #include "wmudplayer.h" -#include "wmud-types.h" #define WMUD_DB_ERROR wmud_db_error_quark() GQuark wmud_db_error_quark(); diff --git a/wmud/game-networking.h b/wmud/game-networking.h index fb9c538..213747f 100644 --- a/wmud/game-networking.h +++ b/wmud/game-networking.h @@ -22,7 +22,6 @@ #include #include "wmudclient.h" -#include "wmud-types.h" /** * TELNET_IAC: diff --git a/wmud/main.c b/wmud/main.c index de6a5bb..0052ca8 100644 --- a/wmud/main.c +++ b/wmud/main.c @@ -26,7 +26,6 @@ #include #endif -#include "wmud-types.h" #include "main.h" #include "game-networking.h" #include "interpreter.h" diff --git a/wmud/maintenance.c b/wmud/maintenance.c index 35899c7..8bcfb70 100644 --- a/wmud/maintenance.c +++ b/wmud/maintenance.c @@ -27,7 +27,6 @@ #include #include -#include "wmud-types.h" #include "maintenance.h" #include "main.h" #include "players.h" diff --git a/wmud/players.h b/wmud/players.h index bcc324a..72e61c9 100644 --- a/wmud/players.h +++ b/wmud/players.h @@ -21,7 +21,6 @@ #include -#include "wmud-types.h" #include "wmudclient.h" extern GSList *players; diff --git a/wmud/texts.c b/wmud/texts.c index a377def..318ffa3 100644 --- a/wmud/texts.c +++ b/wmud/texts.c @@ -19,7 +19,6 @@ #include #include -#include "wmud-types.h" #include "game-networking.h" #include "texts.h" diff --git a/wmud/texts.h b/wmud/texts.h index 9c657ad..23b4b46 100644 --- a/wmud/texts.h +++ b/wmud/texts.h @@ -19,7 +19,6 @@ #ifndef __WMUD_TEXTS_H__ #define __WMUD_TEXTS_H__ -#include "wmud-types.h" void wmud_texts_init(void); void wmud_text_send_to_client(gchar *text, WmudClient *client); diff --git a/wmud/wmud-types.h b/wmud/wmud-types.h deleted file mode 100644 index 909379c..0000000 --- a/wmud/wmud-types.h +++ /dev/null @@ -1,66 +0,0 @@ -/* wMUD - Yet another MUD codebase by W00d5t0ck - * Copyright (C) 2012 - Gergely POLONKAI - * - * wmud-types.h: Common wMUD data types - * - * 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_TYPES_H__ -#define __WMUD_TYPES_H__ - -#include -#include - -/** - * SECTION:types - * @short_description: wMUD Data Types - * @title: wMUD's Data Types - * - */ - -/** - * wmudClientState: - * @WMUD_CLIENT_STATE_FRESH: Client is newly connected. Waiting for a login - * player name - * @WMUD_CLIENT_STATE_PASSWAIT: Login player name is entered, waiting for a - * login password - * @WMUD_CLIENT_STATE_MENU: Authentication was successful, player is now in the - * main game menu - * @WMUD_CLIENT_STATE_INGAME: Character login was successful, player is now - * in-game - * @WMUD_CLIENT_STATE_YESNO: Player was asked a yes/no question, and we are - * waiting for the answer. client.yesNoCallback MUST be set at this point! - * TODO: if wmudClient had a prevState field, and there would be some hooks - * that are called before and after the client enters a new state, this - * could be a three-state stuff, in which the player can enter e.g ? as - * the answer, so they would be presented with the question again. - * @WMUD_CLIENT_STATE_REGISTERING: Registering a new player. Waiting for the - * e-mail address to be given - * @WMUD_CLIENT_STATE_REGEMAIL_CONFIRM: E-mail address entered séms valid, - * waiting for confirmation - * - * Game client states. - */ -typedef enum { - WMUD_CLIENT_STATE_FRESH, - WMUD_CLIENT_STATE_PASSWAIT, - WMUD_CLIENT_STATE_MENU, - WMUD_CLIENT_STATE_INGAME, - WMUD_CLIENT_STATE_YESNO, - WMUD_CLIENT_STATE_REGISTERING, - WMUD_CLIENT_STATE_REGEMAIL_CONFIRM -} wmudClientState; - -#endif /* __WMUD_TYPES_H__ */ - diff --git a/wmud/wmudclient.c b/wmud/wmudclient.c index 63d5731..60c143a 100644 --- a/wmud/wmudclient.c +++ b/wmud/wmudclient.c @@ -27,7 +27,7 @@ struct _WmudClientPrivate GSocket *socket; GSource *socket_source; GString *buffer; - wmudClientState state; + WmudClientState state; gboolean authenticated; WmudPlayer *player; gboolean bademail; @@ -167,14 +167,14 @@ wmud_client_get_buffer(WmudClient *self) return self->priv->buffer; } -wmudClientState +WmudClientState wmud_client_get_state(WmudClient *self) { return self->priv->state; } void -wmud_client_set_state(WmudClient *self, wmudClientState state) +wmud_client_set_state(WmudClient *self, WmudClientState state) { self->priv->state = state; } diff --git a/wmud/wmudclient.h b/wmud/wmudclient.h index a50fad6..a932c0e 100644 --- a/wmud/wmudclient.h +++ b/wmud/wmudclient.h @@ -23,7 +23,6 @@ #include #include #include "wmudplayer.h" -#include "wmud-types.h" #define WMUD_TYPE_CLIENT (wmud_client_get_type()) #define WMUD_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WMUD_TYPE_CLIENT, WmudClient)) @@ -50,6 +49,39 @@ struct _WmudClientClass GObjectClass parent_class; }; +/** + * WmudClientState: + * @WMUD_CLIENT_STATE_FRESH: Client is newly connected. Waiting for a login + * player name + * @WMUD_CLIENT_STATE_PASSWAIT: Login player name is entered, waiting for a + * login password + * @WMUD_CLIENT_STATE_MENU: Authentication was successful, player is now in the + * main game menu + * @WMUD_CLIENT_STATE_INGAME: Character login was successful, player is now + * in-game + * @WMUD_CLIENT_STATE_YESNO: Player was asked a yes/no question, and we are + * waiting for the answer. client.yesNoCallback MUST be set at this point! + * TODO: if wmudClient had a prevState field, and there would be some hooks + * that are called before and after the client enters a new state, this + * could be a three-state stuff, in which the player can enter e.g ? as + * the answer, so they would be presented with the question again. + * @WMUD_CLIENT_STATE_REGISTERING: Registering a new player. Waiting for the + * e-mail address to be given + * @WMUD_CLIENT_STATE_REGEMAIL_CONFIRM: E-mail address entered séms valid, + * waiting for confirmation + * + * Game client states. + */ +typedef enum { + WMUD_CLIENT_STATE_FRESH, + WMUD_CLIENT_STATE_PASSWAIT, + WMUD_CLIENT_STATE_MENU, + WMUD_CLIENT_STATE_INGAME, + WMUD_CLIENT_STATE_YESNO, + WMUD_CLIENT_STATE_REGISTERING, + WMUD_CLIENT_STATE_REGEMAIL_CONFIRM +} WmudClientState; + GType wmud_client_get_type(void); WmudClient *wmud_client_new(void); void wmud_client_set_socket(WmudClient *client, GSocket *socket); @@ -59,8 +91,8 @@ void wmud_client_send(WmudClient *client, const gchar *fmt, ...); void wmud_client_close(WmudClient *self, gboolean send_goodbye); GString *wmud_client_get_buffer(WmudClient *client); gsize wmud_client_get_buffer_length(WmudClient *client); -void wmud_client_set_state(WmudClient *client, wmudClientState state); -wmudClientState wmud_client_get_state(WmudClient *client); +void wmud_client_set_state(WmudClient *client, WmudClientState state); +WmudClientState wmud_client_get_state(WmudClient *client); void wmud_client_set_player(WmudClient *client, WmudPlayer *player); WmudPlayer *wmud_client_get_player(WmudClient *client); void wmud_client_set_yesno_callback(WmudClient *client, WmudClientYesnoCallback yesno_callback); diff --git a/wmud/wmudplayer.h b/wmud/wmudplayer.h index b580dcf..83b7e41 100644 --- a/wmud/wmudplayer.h +++ b/wmud/wmudplayer.h @@ -22,7 +22,6 @@ #include #include #include -#include "wmud-types.h" #define WMUD_TYPE_PLAYER (wmud_player_get_type()) #define WMUD_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WMUD_TYPE_PLAYER, WmudPlayer))