Added GtkDoc style comments to main.h and players.c

This commit is contained in:
Polonkai Gergely 2012-03-23 16:06:01 +00:00
parent 486d5bdba6
commit cc8d1868cd
2 changed files with 45 additions and 1 deletions

View File

@ -10,7 +10,14 @@ extern gchar *database_file;
extern GQuark WMUD_DB_ERROR; extern GQuark WMUD_DB_ERROR;
extern gchar *admin_email; extern gchar *admin_email;
#define random_number(a, b) g_rand_int_range(main_rand, (a), (b) + 1) /**
* random_number:
* @min: Minimum value for random number
* @max: Maximum value for random number
*
* Generates a random number between min and max
*/
#define random_number(min, max) g_rand_int_range(main_rand, (min), (max) + 1)
#endif /* __WMUD_MAIN_H__ */ #endif /* __WMUD_MAIN_H__ */

View File

@ -28,8 +28,21 @@
#include "networking.h" #include "networking.h"
#include "players.h" #include "players.h"
/**
* @players: GSList of all loaded players. Stores #wmudPlayer structures.
*/
GSList *players = NULL; GSList *players = NULL;
/**
* wmud_player_auth:
* @client: The client to be authenticated. The authentication password comes
* from the client's buffer.
*
* Tries to authenticate a client based on the associated player structure, and
* the password stored in the client's buffer.
*
* Return value: %TRUE if the password is valid, %FALSE otherwise.
*/
gboolean gboolean
wmud_player_auth(wmudClient *client) wmud_player_auth(wmudClient *client)
{ {
@ -47,6 +60,15 @@ find_player_by_name(wmudPlayer *player, gchar *player_name)
return g_ascii_strcasecmp(player->player_name, player_name); return g_ascii_strcasecmp(player->player_name, player_name);
} }
/**
* wmud_player_exists:
* @player_name: The login name of the player to check
*
* Check if the player with the given name already exists.
*
* Return value: the wmudPlayer structure for the given player name, or %NULL
* if it can not be found.
*/
wmudPlayer * wmudPlayer *
wmud_player_exists(gchar *player_name) wmud_player_exists(gchar *player_name)
{ {
@ -59,6 +81,14 @@ wmud_player_exists(gchar *player_name)
} }
/**
* wmud_player_dup:
* @player: the player structure to duplicate
*
* Duplicates a #wmudPlayer structure.
*
* Return value: the new, duplicated player structure. It must be freed with wmud_player_free().
*/
wmudPlayer * wmudPlayer *
wmud_player_dup(wmudPlayer *player) wmud_player_dup(wmudPlayer *player)
{ {
@ -76,6 +106,13 @@ wmud_player_dup(wmudPlayer *player)
return new_player; return new_player;
} }
/**
* wmud_player_free:
* @player: A pointer to the player structure to be freed
*
* Frees a #wmudPlayer structure with all its fields, and sets the structure
* variable to %NULL.
*/
void void
wmud_player_free(wmudPlayer **player) wmud_player_free(wmudPlayer **player)
{ {