Finish uncrustifying

This commit is contained in:
Gergely Polonkai 2016-06-22 18:26:02 +02:00
parent bdf518f37f
commit 9bded1b722
13 changed files with 186 additions and 142 deletions

View File

@ -55,18 +55,19 @@ typedef enum {
* @smtp_sender: the sender address who sends the outgoing mails
*/
typedef struct _ConfigData {
guint port;
gchar *database_dsn;
gchar *admin_email;
gchar *smtp_server;
guint port;
gchar *database_dsn;
gchar *admin_email;
gchar *smtp_server;
gboolean smtp_tls;
gchar *smtp_username;
gchar *smtp_password;
gchar *smtp_sender;
gchar *smtp_username;
gchar *smtp_password;
gchar *smtp_sender;
} ConfigData;
extern ConfigData *active_config;
gboolean wmud_config_init(ConfigData **config_data, GError **err);
gboolean wmud_config_init(ConfigData **config_data,
GError **err);
#endif /* __WMUD_CONFIGURATION_H__ */

View File

@ -35,24 +35,34 @@ GQuark wmud_db_error_quark();
* Error codes returned by database handling functions.
*/
typedef enum {
WMUD_DB_ERROR_CANTOPEN,
WMUD_DB_ERROR_NOINIT,
WMUD_DB_ERROR_BADQUERY,
WMUD_DB_ERROR_SELECT_ERROR
WMUD_DB_ERROR_CANTOPEN,
WMUD_DB_ERROR_NOINIT,
WMUD_DB_ERROR_BADQUERY,
WMUD_DB_ERROR_SELECT_ERROR
} wmudDbError;
gboolean wmud_db_init(GError **err);
gboolean wmud_db_load_players(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);
gboolean wmud_db_load_planet_planes(GSList **planet_planes, GError **err);
gboolean wmud_db_load_menu(GSList **menu_items, GError **err);
gboolean wmud_db_update_player_password(WmudPlayer *player, gchar *crypted_password, 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);
gboolean wmud_db_load_planet_planes(GSList **planet_planes,
GError **err);
gboolean wmud_db_load_menu(GSList **menu_items,
GError **err);
gboolean wmud_db_update_player_password(WmudPlayer *player,
gchar *crypted_password,
GError **err);
#endif /* __WMUD__DB_H__ */

View File

@ -62,8 +62,13 @@
extern GSList *clients;
gboolean wmud_networking_init(guint port_number, GMainContext *game_context, GSList *menu_items, GError **err);
void wmud_client_quitanswer(WmudClient *client, gboolean answer);
void wmud_client_newchar_answer(WmudClient *client, gboolean answer);
gboolean wmud_networking_init(guint port_number,
GMainContext *game_context,
GSList *menu_items,
GError **err);
void wmud_client_quitanswer(WmudClient *client,
gboolean answer);
void wmud_client_newchar_answer(WmudClient *client,
gboolean answer);
#endif

View File

@ -19,7 +19,7 @@
#ifndef __WMUD_GAME_H__
#define __WMUD_GAME_H__
gboolean wmud_game_init(GThread **game_thread, GMainContext **game_context);
gboolean wmud_game_init(GThread **game_thread,
GMainContext **game_context);
#endif /* __WMUD_GAME_H__ */

View File

@ -47,19 +47,19 @@ typedef void (*wmudCommandFunc)(WmudClient *client, gchar *command, GSList *toke
* This structure holds the different properties of the in-game commands.
*/
typedef struct _wmudCommand {
gchar *command;
wmudCommandFunc commandFunc;
gchar *command;
wmudCommandFunc commandFunc;
} wmudCommand;
#define WMUD_INTERPRETER_ERROR wmud_interpreter_error_quark()
GQuark wmud_interpreter_error_quark();
typedef enum {
WMUD_INTERPRETER_ERROR_DUPCMD
WMUD_INTERPRETER_ERROR_DUPCMD
} wmudInterpreterError;
gboolean wmud_interpreter_check_directions(GSList *directions, GError **err);
gboolean wmud_interpreter_check_directions(GSList *directions,
GError **err);
void wmud_interpret_game_command(WmudClient *client);
#endif /* __WMUD_INTERPRETER_H__ */

View File

@ -22,7 +22,7 @@
# include <glib.h>
extern GMainContext *game_context;
extern guint32 elapsed_seconds;
extern guint32 elapsed_seconds;
/**
* random_number:

View File

@ -39,14 +39,14 @@
* @func: the menu item's function. See menu.c for the list of possible values.
*/
typedef struct _wmudMenu {
guint id;
gchar menuchar;
gboolean need_active_char;
guint placement;
gchar *text;
gchar *display_text;
gchar *display_text_ansi;
gchar *func;
guint id;
gchar menuchar;
gboolean need_active_char;
guint placement;
gchar *text;
gchar *display_text;
gchar *display_text_ansi;
gchar *func;
} wmudMenu;
typedef void (*wmudMenuCommandFunc)(WmudClient *client);
@ -63,10 +63,13 @@ GSList *game_menu;
#define WMUD_MENU_ERROR wmud_menu_error_quark()
GQuark wmud_menu_error_quark();
gboolean wmud_menu_init(GSList **menu);
gboolean wmud_menu_items_check(GSList *menu_items, GError **err);
gboolean wmud_menu_items_check(GSList *menu_items,
GError **err);
void wmud_menu_items_free(GSList **menu_items);
gchar *wmud_menu_get_command_by_menuchar(gchar menuchar, GSList *game_menu);
void wmud_menu_execute_command(WmudClient *client, gchar *command);
gchar *wmud_menu_get_command_by_menuchar(gchar menuchar,
GSList *game_menu);
void wmud_menu_execute_command(WmudClient *client,
gchar *command);
void wmud_menu_present(WmudClient *client);
#endif /* __WMUD_MENU_H__ */

View File

@ -22,6 +22,7 @@
#include "wmudclient.h"
void wmud_texts_init(void);
void wmud_text_send_to_client(gchar *text, WmudClient *client);
void wmud_text_send_to_client(gchar *text,
WmudClient *client);
#endif /* __WMUD_TEXTS_H__ */

View File

@ -37,8 +37,8 @@
*
* A connected game client
*/
typedef struct _WmudClient WmudClient;
typedef struct _WmudClientClass WmudClientClass;
typedef struct _WmudClient WmudClient;
typedef struct _WmudClientClass WmudClientClass;
typedef struct _WmudClientPrivate WmudClientPrivate;
/**
@ -50,39 +50,47 @@ typedef struct _WmudClientPrivate WmudClientPrivate;
*/
typedef void (*WmudClientYesnoCallback)(WmudClient *client, gboolean answer);
struct _WmudClient
{
/*< private >*/
GObject parent_instance;
WmudClientPrivate *priv;
struct _WmudClient {
/*< private >*/
GObject parent_instance;
WmudClientPrivate *priv;
};
struct _WmudClientClass
{
GObjectClass parent_class;
struct _WmudClientClass {
GObjectClass parent_class;
};
GType wmud_client_get_type(void);
WmudClient *wmud_client_new(void);
void wmud_client_set_socket(WmudClient *client, GSocket *socket);
void wmud_client_set_socket(WmudClient *client,
GSocket *socket);
GSocket *wmud_client_get_socket(WmudClient *client);
GSource *wmud_client_get_socket_source(WmudClient *client);
void wmud_client_send(WmudClient *client, const gchar *fmt, ...);
void wmud_client_close(WmudClient *self, gboolean send_goodbye);
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);
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);
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);
void wmud_client_set_yesno_callback(WmudClient *client,
WmudClientYesnoCallback yesno_callback);
WmudClientYesnoCallback wmud_client_get_yesno_callback(WmudClient *client);
void wmud_client_set_authenticated(WmudClient *client, gboolean authenticated);
void wmud_client_set_authenticated(WmudClient *client,
gboolean authenticated);
void wmud_client_increase_login_fail_count(WmudClient *client);
gint wmud_client_get_login_fail_count(WmudClient *client);
void wmud_client_set_bademail(WmudClient *client, gboolean bademail);
void wmud_client_set_bademail(WmudClient *client,
gboolean bademail);
gboolean wmud_client_get_bademail(WmudClient *client);
guint32 wmud_client_get_last_recv_age(WmudClient *client);
void wmud_client_set_context(WmudClient *client, GMainContext *context);
void wmud_client_set_context(WmudClient *client,
GMainContext *context);
#endif /* __WMUD_WMUDCLIENT_H__ */

View File

@ -27,14 +27,13 @@
* 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
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_CLIENT_STATE_H__ */

View File

@ -30,41 +30,44 @@
#define WMUD_IS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WMUD_TYPE_PLAYER))
#define WMUD_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WMUT_TYPE_PLAYER, WmudPlayerClass))
typedef struct _WmudPlayer WmudPlayer;
typedef struct _WmudPlayerClass WmudPlayerClass;
typedef struct _WmudPlayer WmudPlayer;
typedef struct _WmudPlayerClass WmudPlayerClass;
typedef struct _WmudPlayerPrivate WmudPlayerPrivate;
struct _WmudPlayer
{
/*< private >*/
GObject parent_instance;
struct _WmudPlayer {
/*< private >*/
GObject parent_instance;
/*< private >*/
WmudPlayerPrivate *priv;
/*< private >*/
WmudPlayerPrivate *priv;
};
struct _WmudPlayerClass
{
GObjectClass parent_class;
struct _WmudPlayerClass {
GObjectClass parent_class;
};
GType wmud_player_get_type(void);
WmudPlayer *wmud_player_new(void);
void wmud_player_set_cpassword(WmudPlayer *player, const gchar *cpassword);
void wmud_player_set_cpassword(WmudPlayer *player,
const gchar *cpassword);
gchar *wmud_player_get_cpassword(WmudPlayer *player);
void wmud_player_set_registered(WmudPlayer *player, gboolean registered);
void wmud_player_set_registered(WmudPlayer *player,
gboolean registered);
gboolean wmud_player_get_registered(WmudPlayer *player);
void wmud_player_set_player_name(WmudPlayer *player, const gchar *name);
void wmud_player_set_player_name(WmudPlayer *player,
const gchar *name);
gchar *wmud_player_get_player_name(WmudPlayer *player);
gint wmud_player_get_fail_count(WmudPlayer *player);
void wmud_player_increase_fail_count(WmudPlayer *player);
void wmud_player_reset_fail_count(WmudPlayer *player);
void wmud_player_set_email(WmudPlayer *player, const gchar *email);
void wmud_player_set_email(WmudPlayer *player,
const gchar *email);
gchar *wmud_player_get_email(WmudPlayer *player);
void wmud_player_set_id(WmudPlayer *player, guint32 id);
void wmud_player_set_id(WmudPlayer *player,
guint32 id);
guint32 wmud_player_get_id(WmudPlayer *player);
WmudPlayer *wmud_player_dup(WmudPlayer *player);
gboolean wmud_player_password_valid(WmudPlayer *player, const gchar *password);
gboolean wmud_player_password_valid(WmudPlayer *player,
const gchar *password);
#endif /* __WMUD_WMUDPLAYER_H__ */

View File

@ -35,20 +35,18 @@
*
* An online wMUD world
*/
typedef struct _WmudWorld WmudWorld;
typedef struct _WmudWorldClass WmudWorldClass;
typedef struct _WmudWorld WmudWorld;
typedef struct _WmudWorldClass WmudWorldClass;
typedef struct _WmudWorldPrivate WmudWorldPrivate;
struct _WmudWorld
{
/*<private>*/
GObject parent_instance;
WmudWorldPrivate *priv;
struct _WmudWorld {
/*<private>*/
GObject parent_instance;
WmudWorldPrivate *priv;
};
struct _WmudWorldClass
{
GObjectClass parent_class;
struct _WmudWorldClass {
GObjectClass parent_class;
};
WmudWorld *wmud_world_new(void);

View File

@ -25,12 +25,12 @@
GQuark wmud_world_error_quark();
typedef enum {
WMUD_WORLD_ERROR_DUPPLANE,
WMUD_WORLD_ERROR_DUPPLANET,
WMUD_WORLD_ERROR_DUPAREA,
WMUD_WORLD_ERROR_DUPROOM,
WMUD_WORLD_ERROR_BADASSOC,
WMUD_WORLD_ERROR_BADPLANET
WMUD_WORLD_ERROR_DUPPLANE,
WMUD_WORLD_ERROR_DUPPLANET,
WMUD_WORLD_ERROR_DUPAREA,
WMUD_WORLD_ERROR_DUPROOM,
WMUD_WORLD_ERROR_BADASSOC,
WMUD_WORLD_ERROR_BADPLANET
} wmudWorldError;
/**
@ -39,8 +39,8 @@ typedef enum {
* @name: The name of the plane
*/
typedef struct _wmudPlane {
guint id;
gchar *name;
guint id;
gchar *name;
} wmudPlane;
/**
@ -52,9 +52,9 @@ typedef struct _wmudPlane {
* g_slist_free()
*/
typedef struct _wmudPlanet {
guint id;
gchar *name;
GSList *planes;
guint id;
gchar *name;
GSList *planes;
} wmudPlanet;
/**
@ -64,9 +64,9 @@ typedef struct _wmudPlanet {
* @rooms: a #GSList of rooms in this area
*/
typedef struct _wmudArea {
guint id;
gchar *name;
GSList *rooms;
guint id;
gchar *name;
GSList *rooms;
} wmudArea;
/**
@ -80,13 +80,13 @@ typedef struct _wmudArea {
* when standing in it
*/
typedef struct _wmudRoom {
guint id;
guint area_id;
gchar *name;
gchar *distant_description;
gchar *close_description;
GSList *planes;
GSList *exits;
guint id;
guint area_id;
gchar *name;
gchar *distant_description;
gchar *close_description;
GSList *planes;
GSList *exits;
} wmudRoom;
/**
@ -96,9 +96,9 @@ typedef struct _wmudRoom {
* @name: The normal name of the direction's command
*/
typedef struct _wmudDirection {
guint id;
gchar *short_name;
gchar *name;
guint id;
gchar *short_name;
gchar *name;
} wmudDirection;
/**
@ -109,9 +109,9 @@ typedef struct _wmudDirection {
* opens
*/
typedef struct _wmudExit {
guint source_room_id;
guint direction_id;
guint destination_room_id;
guint source_room_id;
guint direction_id;
guint destination_room_id;
} wmudExit;
/**
@ -120,8 +120,8 @@ typedef struct _wmudExit {
* @other_side: the room to which this exit leads to
*/
typedef struct _wmudRoomExit {
wmudDirection *direction;
wmudRoom *other_side;
wmudDirection *direction;
wmudRoom *other_side;
} wmudRoomExit;
/**
@ -130,22 +130,38 @@ typedef struct _wmudRoomExit {
* @plane_id: The database ID of the plane @planet is on
*/
typedef struct _wmudPlanetPlaneAssoc {
guint planet_id;
guint plane_id;
guint planet_id;
guint plane_id;
} wmudPlanetPlaneAssoc;
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_rooms(GSList *rooms, GError **err);
gboolean wmud_world_check_exits(GSList *exits, GSList *directions, GSList *rooms, GError **err);
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_rooms(GSList *rooms,
GError **err);
gboolean wmud_world_check_exits(GSList *exits,
GSList *directions,
GSList *rooms,
GError **err);
gboolean wmud_world_assoc_planets_planes(GSList *planets, GSList *planes, GSList *planet_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);
void wmud_world_assoc_exits_rooms(GSList *exits, GSList *directions, GSList *rooms, GError **err);
gboolean wmud_world_assoc_planets_planes(GSList *planets,
GSList *planes,
GSList *planet_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);
void wmud_world_assoc_exits_rooms(GSList *exits,
GSList *directions,
GSList *rooms,
GError **err);
gboolean wmud_world_load(GError **err);
#endif /* __WMUD_WORLD_H__ */