Atrinik Server 2.5
Functions
server/login.c File Reference
#include <global.h>
#include <loader.h>

Go to the source code of this file.

Functions

void emergency_save (int flag)
int check_name (player *pl, char *name)
int save_player (object *op, int flag)
static int spell_sort (const void *a1, const void *a2)
static void reorder_inventory (object *op)
static void wrong_password (player *pl)
void check_login (object *op)

Detailed Description

Player login/save/logout related functions.

Definition in file login.c.


Function Documentation

void check_login ( object op)

Login a player.

Parameters:
opPlayer.

Definition at line 353 of file login.c.

int check_name ( player pl,
char *  name 
)

Checks to see if the passed player name is valid or not. Does checks like min/max name length, whether there is anyone else playing by that name, and whether there are illegal characters in the player name.

Parameters:
plPlayer.
nameName to check.
Returns:
1 if the name is ok, 0 otherwise.

Definition at line 96 of file login.c.

void emergency_save ( int  flag)

Save all players.

Parameters:
flagIf non zero, it means that we want to try and save everyone, but keep the game running. Thus, we don't want to free any information.

Definition at line 38 of file login.c.

static void reorder_inventory ( object op) [static]

Reorder the inventory of an object (reverses the order of the inventory objects). Helper function to reorder the reverse loaded player inventory.

Note:
This will recursively reorder the container inventories.
Parameters:
opThe object to reorder.

Definition at line 300 of file login.c.

int save_player ( object op,
int  flag 
)

Saves a player to file.

Parameters:
opPlayer to save.
flagIf set, it's only backup, i.e. don't remove objects from inventory.
Returns:
Non zero if successful.

Definition at line 129 of file login.c.

static int spell_sort ( const void *  a1,
const void *  a2 
) [static]

Sort loaded spells by comparing a1 against a2.

Parameters:
a1Spell ID to compare
a2Spell ID to compare
Returns:
Return value of strcmp on the two spell names.

Definition at line 288 of file login.c.

static void wrong_password ( player pl) [static]

Player in login failed to provide a correct password.

After several repeated password failures, kill the socket.

Parameters:
plPlayer.

Definition at line 331 of file login.c.