Crossfire Server, Branches 1.12
R18729
|
Go to the source code of this file.
Functions | |
void | check_login (object *op) |
int | check_name (player *me, const char *name) |
static void | copy_file (const char *filename, FILE *fpout) |
void | delete_character (const char *name) |
void | destroy_object (object *op) |
void | emergency_save (int flag) |
int | save_player (object *op, int flag) |
int | verify_player (const char *name, char *password) |
static void | wrong_password (object *op) |
Player login/logout/save functions.
Definition in file login.c.
void check_login | ( | object * | op | ) |
Actually login a player, load from disk and such.
op | player. |
Definition at line 473 of file login.c.
References obj::arch, pl::bed_x, pl::bed_y, obj::below, pl::bowtype, obj::carrying, liv::Cha, check_password(), check_path(), CLEAR_FLAG, archt::clone, close_and_delete(), liv::Con, confirm_password(), containers, obj::contr, liv::Dex, pl::digestion, draw_ext_info(), draw_ext_info_format(), enter_exit(), esrv_add_spells(), esrv_new_player(), esrv_send_inventory(), esrv_send_pickup(), EVENT_LOGIN, execute_global_event(), pl::explore, final_free_player(), first_map_path, first_player, fix_object(), FLAG_FRIENDLY, FLAG_NO_FIX_PLAYER, FLAG_REMOVED, FLAG_USE_ARMOUR, FLAG_USE_SHIELD, FORCE, form_party(), pl::gen_grace, pl::gen_hp, pl::gen_sp, get_firstparty(), socket_struct::host, liv::hp, liv::Int, obj::inv, is_dragon_pl(), key_inventory, keyrings, kill_player(), pl::language, leave(), legal_range(), pl::levgrace, pl::levhp, pl::levsp, link_player_skills(), pl::listening, llevDebug, llevError, llevInfo, LO_NEWFILE, load_object(), Settings::localdir, LOG(), pl::maplevel, MAX_BUF, pl::mode, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_LOGIN, MSG_TYPE_ADMIN_PLAYER, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, obj::name, archt::name, pl::name_changed, NDI_ALL, NDI_DK_ORANGE, NDI_UNIQUE, party_struct::next, pl::next, pl::no_shout, Ns_Dead, NUM_LANGUAGES, pl::ob, open_and_uncompress(), pl::orig_stats, pl::outputs_count, pl::outputs_sync, pl::own_title, pl::party, party_rejoin_always, party_rejoin_no, party_struct::partyname, party_struct::passwd, pl::peaceful, pl::petmode, PLAYER, Settings::playerdir, liv::Pow, pticks, QUERY_FLAG, range_none, pl::rejoin_party, remove_ob(), remove_unpaid_objects(), Settings::reset_loc_time, reset_object(), save_player(), pl::savebed_map, Settings::search_items, pl::search_str, send_party_message(), set_dragon_name(), SET_FLAG, Settings::set_title, settings, pl::shoottype, snprintf(), pl::socket, obj::speed, pl::spellparam, ST_PLAYING, pl::state, obj::stats, liv::Str, strdup_local(), strtol(), sum_weight(), terminate_all_pets(), pl::title, TRUE, obj::type, pl::unapply, unapply_always, unapply_never, unapply_nochoice, socket_struct::update_look, update_ob_speed(), pl::usekeys, pl::weapon_sp, obj::weight, liv::Wis, pl::write_buf, wrong_password(), obj::x, and obj::y.
Referenced by receive_player_password().
int check_name | ( | player * | me, |
const char * | name | ||
) |
Ensure player's name is valid.
me | player to report to. |
name | name to check. |
0 | invalid name. |
1 | valid name. |
Definition at line 173 of file login.c.
References draw_ext_info(), draw_ext_info_format(), MAX_NAME, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_LOGIN, NDI_UNIQUE, pl::ob, and playername_ok().
Referenced by receive_player_name().
|
static |
void delete_character | ( | const char * | name | ) |
Totally deletes a character. The contents of its directory are effectively totally removed. Used when a player 'quits' the game, or dies on a server with permadeath and no resurrect.
name | player to delete. |
Definition at line 97 of file login.c.
References Settings::localdir, MAX_BUF, Settings::playerdir, remove_directory(), settings, and snprintf().
Referenced by key_confirm_quit(), and kill_player().
void destroy_object | ( | object * | op | ) |
Recursively free_object() op and its inventory.
op | object to totally free_object(). |
Definition at line 201 of file login.c.
References FLAG_REMOVED, free_object(), obj::inv, QUERY_FLAG, and remove_ob().
Referenced by save_player(), and trap_disarm().
void emergency_save | ( | int | flag | ) |
Save all players.
flag | if 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 51 of file login.c.
References check_score(), draw_ext_info(), first_map_path, first_player, llevError, llevInfo, LOG(), obj::map, pl::maplevel, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_LOADSAVE, obj::name, NDI_UNIQUE, pl::next, pl::ob, save_player(), trying_emergency_save, obj::x, and obj::y.
int save_player | ( | object * | op, |
int | flag | ||
) |
Saves a player to disk.
op | player to save. |
flag | if is set, it's only backup, ie dont remove objects from inventory. If BACKUP_SAVE_AT_HOME is set, and the flag is set, then the player will be saved at the emergency save location. |
Definition at line 223 of file login.c.
References pl::bed_x, pl::bed_y, pl::bowtype, liv::Cha, CLEAR_FLAG, liv::Con, obj::container, obj::contr, copy_file(), destroy_object(), liv::Dex, pl::digestion, draw_ext_info(), draw_ext_info_format(), Settings::emergency_mapname, esrv_send_inventory(), liv::exp, pl::explore, FLAG_NO_FIX_PLAYER, FLAG_WIZ, pl::gen_grace, pl::gen_hp, pl::gen_sp, liv::Int, obj::inv, key_inventory, keyrings, pl::language, pl::last_level, obj::level, pl::levgrace, pl::levhp, pl::levsp, pl::listening, llevDebug, Settings::localdir, LOG(), make_path_to_file(), obj::map, MAX_BUF, MIN, pl::mode, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_LOADSAVE, obj::name, pl::name_changed, NDI_ALL_DMS, NDI_RED, NDI_UNIQUE, pl::no_shout, pl::orig_stats, pl::outputs_count, pl::outputs_sync, pl::own_title, pl::party, party_struct::partyname, party_struct::passwd, pl::password, mapdef::path, pl::peaceful, pl::petmode, PLAYER, Settings::playerdir, liv::Pow, QUERY_FLAG, range_none, pl::rejoin_party, SAVE_ERROR_OK, SAVE_FLAG_NO_REMOVE, SAVE_FLAG_SAVE_UNPAID, SAVE_MODE, save_object(), pl::savebed_map, SET_FLAG, Settings::set_title, settings, pl::shoottype, snprintf(), ST_GET_PARTY_PASSWORD, ST_PLAYING, pl::state, obj::stats, liv::Str, tempnam_secure(), terminate_all_pets(), Settings::tmpdir, TRUE, obj::type, pl::unapply, unapply_never, unapply_nochoice, unlink, pl::usekeys, pl::weapon_sp, liv::Wis, obj::x, and obj::y.
Referenced by apply_savebed(), check_login(), command_kick(), command_save(), command_shutdown(), do_server(), drop_object(), emergency_save(), enter_exit(), kill_player(), player_changer_type_process(), and process_players1().
int verify_player | ( | const char * | name, |
char * | password | ||
) |
This verify that a character of name exits, and that it matches password.
name | player name. |
password | player's password, not encrypted. |
0 | there is match. |
1 | no such player. |
2 | incorrect password. |
Definition at line 120 of file login.c.
References check_password(), close_and_delete(), llevDebug, llevError, Settings::localdir, LOG(), MAX_BUF, open_and_uncompress(), Settings::playerdir, settings, and snprintf().
|
static |
Simple function to print errors when password is not correct, and reinitialise the name.
op | player. |
Definition at line 441 of file login.c.
References obj::contr, draw_ext_info(), FREE_AND_COPY, get_name(), socket_struct::host, llevInfo, LOG(), MAX_PASSWORD_FAILURES, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_LOGIN, obj::name, obj::name_pl, NDI_UNIQUE, Ns_Dead, socket_struct::password_fails, pl::socket, and socket_struct::status.
Referenced by check_login().