Crossfire Client, Trunk
|
Go to the source code of this file.
Functions | |
void | AccountPlayersCmd (char *buf, int len) |
void | AddMeFail (char *data, int len) |
void | AddMeSuccess (char *data, int len) |
void | AddspellCmd (unsigned char *data, int len) |
void | animate_objects (void) |
void | AnimCmd (unsigned char *data, int len) |
int | can_write_spell_on (item *it) |
void | clear_fire (void) |
void | clear_run (void) |
void | client_init (void) |
void | client_reset (void) |
void | client_send_apply (int tag) |
void | client_send_examine (int tag) |
void | client_send_move (int loc, int tag, int nrof) |
void | command_take (const char *command, const char *cpnext) |
void | CompleteCmd (unsigned char *data, int len) |
int | cs_print_string (GSocketConnection *c, const char *str,...) |
void | DeleteInventory (unsigned char *data, int len) |
void | DeleteItem (unsigned char *data, int len) |
void | DeleteSpell (unsigned char *data, int len) |
void | display_newpng (int face, guint8 *buf, int buflen, int setnum) |
void | DrawExtInfoCmd (char *data, int len) |
void | DrawInfoCmd (char *data, int len) |
void | error_dialog (char *error, char *message) |
void | ExtendedInfoSetCmd (char *data, int len) |
int | ExtSmooth (unsigned char *data, int len, int x, int y, int layer) |
void | Face2Cmd (guint8 *data, int len) |
void | FailureCmd (char *buf, int len) |
void | finish_face_cmd (int pnum, guint32 checksum, int has_sum, char *face, int faceset) |
void | fire_dir (int dir) |
void | free_all_items (item *op) |
void | free_all_race_class_info (Race_Class_Info *data, int num_entries) |
void | get_image_info (guint8 *data, int len) |
void | get_image_sums (char *data, int len) |
const char * | get_number (guint32 i) |
guint8 | get_type_from_name (const char *name) |
char | GetChar_String (const unsigned char *data) |
gint64 | GetInt64_String (const unsigned char *data) |
int | GetInt_String (const unsigned char *data) |
short | GetShort_String (const unsigned char *data) |
void | GoodbyeCmd (char *data, int len) |
void | handle_query (char *data, int len) |
void | Image2Cmd (guint8 *data, int len) |
void | init_common_cache_data (void) |
void | inscribe_magical_scroll (item *scroll, Spell *spell) |
void | Item2Cmd (unsigned char *data, int len) |
void | item_actions (item *op) |
item * | locate_item (gint32 tag) |
void | LOG (LogLevel level, const char *origin, const char *format,...) |
void | look_at (int x, int y) |
void | MagicMapCmd (unsigned char *data, int len) |
int | make_path_to_file (char *filename) |
void | Map2Cmd (unsigned char *data, int len) |
item * | map_item (void) |
void | map_scrollCmd (char *data, int len) |
void | MapExtendedCmd (unsigned char *data, int len) |
void | new_player (long tag, char *name, long weight, long face) |
void | NewmapCmd (unsigned char *data, int len) |
void | PickupCmd (guint8 *data, int len) |
item * | player_item (void) |
void | PlayerCmd (unsigned char *data, int len) |
void | print_inventory (item *op) |
void | remove_item (item *op) |
void | remove_item_inventory (item *op) |
void | ReplyInfoCmd (guint8 *buf, int len) |
void | requestface (int pnum, char *facename) |
void | reset_image_cache_data (void) |
void | reset_player_data (void) |
void | run_dir (int dir) |
int | script_lua_command (const char *command, const char *param) |
void | script_lua_kill (const char *param) |
void | script_lua_list (const char *param) |
void | script_lua_load (const char *name) |
void | script_lua_stats (void) |
int | send_command (const char *command, int repeat, int must_send) |
void | send_mark_obj (item *op) |
void | send_reply (const char *text) |
void | SendAddMe (ClientSocket csock) |
void | SendVersion (ClientSocket csock) |
void | set_item_values (item *op, char *name, gint32 weight, guint16 face, guint16 flags, guint16 anim, guint16 animspeed, guint32 nrof, guint16 type) |
void | setTextManager (int type, ExtTextManager callback) |
void | SetupCmd (char *buf, int len) |
void | SinkCmd (unsigned char *data, int len) |
void | SmoothCmd (unsigned char *data, int len) |
void | SockList_AddChar (SockList *sl, char c) |
void | SockList_AddInt (SockList *sl, guint32 data) |
void | SockList_AddShort (SockList *sl, guint16 data) |
void | SockList_AddString (SockList *sl, const char *str) |
void | SockList_Init (SockList *sl, guint8 *buf) |
bool | SockList_ReadPacket (GSocketConnection c[static 1], SockList sl[static 1], size_t len, GError **error) |
int | SockList_Send (SockList *sl, GSocketConnection *c) |
void | StatsCmd (unsigned char *data, int len) |
void | stop_fire (void) |
void | stop_run (void) |
void | TickCmd (guint8 *data, int len) |
void | toggle_locked (item *op) |
void | update_item (int tag, int loc, char *name, int weight, int face, int flags, int anim, int animspeed, guint32 nrof, int type) |
void | update_item_sort (item *it) |
void | UpdateItemCmd (unsigned char *data, int len) |
void | UpdspellCmd (unsigned char *data, int len) |
void | use_skill (int skill_id) |
void | VersionCmd (char *data, int len) |
void | walk_dir (int dir) |
void AccountPlayersCmd | ( | char * | buf, |
int | len | ||
) |
This handles the accountplayers command
Definition at line 2462 of file commands.c.
References ACL_CLASS, ACL_FACE, ACL_FACE_NUM, ACL_LEVEL, ACL_MAP, ACL_NAME, ACL_PARTY, ACL_RACE, choose_character_init(), GetShort_String(), LOG(), LOG_ERROR, map, MAX_BUF, and update_character_choose().
void AddMeFail | ( | char * | data, |
int | len | ||
) |
Handles when the server says we can't be added. In reality, we need to close the connection and quit out, because the client is going to close us down anyways.
data | |
len |
Definition at line 1110 of file commands.c.
References LOG(), and LOG_INFO.
void AddMeSuccess | ( | char * | data, |
int | len | ||
) |
This is really a throwaway command - there really isn't any reason to send addme_success commands.
data | |
len |
Definition at line 1126 of file commands.c.
References hide_all_login_windows(), LOG(), LOG_DEBUG, and show_main_client().
void animate_objects | ( | void | ) |
Definition at line 654 of file item.c.
References item_struct::anim_speed, item_struct::anim_state, item_struct::animation_id, animations, Player_Struct::below, Player_Struct::container, cpl, item_struct::face, Animations::faces, item_struct::inv, item_struct::inv_updated, item_struct::last_anim, item_struct::next, Animations::num_animations, and player.
void AnimCmd | ( | unsigned char * | data, |
int | len | ||
) |
data | |
len |
Definition at line 1162 of file commands.c.
References animations, Animations::faces, Animations::flags, GetShort_String(), LOG(), LOG_DEBUG, LOG_WARNING, MAXANIM, Animations::num_animations, Animations::phase, Animations::speed, and Animations::speed_left.
int can_write_spell_on | ( | item * | it | ) |
Definition at line 720 of file item.c.
References item_struct::type.
void clear_fire | ( | void | ) |
Definition at line 115 of file player.c.
References dfire, SC_FIRERUN, and send_command().
Referenced by focusoutfunc(), map_button_event(), and parse_key_release().
void clear_run | ( | void | ) |
Definition at line 122 of file player.c.
References drun, SC_FIRERUN, and send_command().
Referenced by focusoutfunc(), and parse_key_release().
void client_init | ( | ) |
Called ONCE during client startup to initialize configuration and other variables to reasonable defaults. Future resets (i.e. after a connection) should use client_reset() instead.
Definition at line 187 of file init.c.
References Player_Struct::below, FaceSets_struct::comment, cpl, exp_table, exp_table_max, FaceSets_struct::extension, face_info, Face_Information_struct::facesets, FaceSets_struct::fallback, FaceSets_struct::fullname, init_commands(), init_config(), init_paths(), last_used_skills, map_item(), MAX_FACE_SETS, MAX_SKILL, ms_init(), Player_Struct::ob, Face_Information_struct::old_bmaps_checksum, player_item(), FaceSets_struct::prefix, reset_vars_common(), FaceSets_struct::size, skill_names, and Face_Information_struct::want_faceset.
Referenced by main().
void client_reset | ( | ) |
Clear client variables between connections to different servers. This MUST be called AFTER client_init() because that performs some allocations.
Definition at line 242 of file init.c.
References Face_Information_struct::bmaps_checksum, classes, FaceSets_struct::comment, FaceSets_struct::extension, face_info, Face_Information_struct::facesets, FaceSets_struct::fallback, free_all_race_class_info(), FREE_AND_CLEAR, FaceSets_struct::fullname, MAX_FACE_SETS, MAX_SKILL, motd, news, num_classes, num_races, Face_Information_struct::old_bmaps_checksum, FaceSets_struct::prefix, races, reset_vars_common(), rules, serverloginmethod, FaceSets_struct::size, skill_names, used_classes, and used_races.
Referenced by main().
void client_send_apply | ( | int | tag | ) |
Definition at line 86 of file player.c.
References cs_print_string(), csocket, and ClientSocket::fd.
Referenced by list_item_action(), list_row_collapse(), ma_apply(), and script_process_cmd().
void client_send_examine | ( | int | tag | ) |
Definition at line 90 of file player.c.
References cs_print_string(), csocket, and ClientSocket::fd.
Referenced by list_item_action(), and ma_examine().
void client_send_move | ( | int | loc, |
int | tag, | ||
int | nrof | ||
) |
Request to move 'nrof' objects with 'tag' to 'loc'.
Definition at line 97 of file player.c.
References cs_print_string(), csocket, and ClientSocket::fd.
Referenced by list_item_drop(), and script_process_cmd().
void command_take | ( | const char * | command, |
const char * | cpnext | ||
) |
Definition at line 351 of file player.c.
References Player_Struct::container, Player_Struct::count, cpl, cs_print_string(), csocket, draw_ext_info(), ClientSocket::fd, item_struct::inv, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, NDI_BLACK, Player_Struct::ob, send_command(), and item_struct::tag.
Referenced by do_take().
void CompleteCmd | ( | unsigned char * | data, |
int | len | ||
) |
Definition at line 319 of file player.c.
References ClientSocket::command_received, ClientSocket::command_sent, ClientSocket::command_time, csocket, ClientSocket::dir, drun, GetInt_String(), GetShort_String(), LOG(), LOG_ERROR, predict_scroll(), profile_latency, profile_time, and script_sync().
int cs_print_string | ( | GSocketConnection * | fd, |
const char * | str, | ||
... | |||
) |
Send a printf-formatted packet to the socket.
fd | The socket to send to. |
str | The printf format string. |
... | An optional list of values to fulfill the format string. |
Definition at line 252 of file newsocket.c.
References SockList::buf, SockList::len, MAX_BUF, script_monitor_str(), SockList_Init(), and SockList_Send().
Referenced by client_mapsize(), client_negotiate(), client_send_apply(), client_send_examine(), client_send_move(), cmd_raw(), command_take(), config_check(), create_character_window_show(), get_image_info(), get_new_char_info(), look_at(), ReplyInfoCmd(), requestface(), script_process_cmd(), send_command(), send_reply(), SendAddMe(), SendVersion(), and SetupCmd().
void DeleteInventory | ( | unsigned char * | data, |
int | len | ||
) |
data | |
len |
Definition at line 1837 of file commands.c.
References locate_item(), LOG(), LOG_WARNING, and remove_item_inventory().
void DeleteItem | ( | unsigned char * | data, |
int | len | ||
) |
data | |
len |
Definition at line 1811 of file commands.c.
References GetInt_String(), locate_item(), LOG(), LOG_WARNING, and remove_item().
void display_newpng | ( | int | face, |
guint8 * | buf, | ||
int | buflen, | ||
int | setnum | ||
) |
This function is called when the server has sent us the actual png data for an image. If caching, we need to write this data to disk (this is handled in the function cache_newpng).
Definition at line 669 of file image.c.
References cache_newpng(), CONFIG_CACHE, create_and_rescale_image_from_data(), facetoname, height, LOG(), LOG_ERROR, LOG_WARNING, png_to_data(), use_config, and width.
Referenced by Image2Cmd().
void DrawExtInfoCmd | ( | char * | data, |
int | len | ||
) |
We must extract color, type, subtype and dispatch to callback
data | |
len |
Definition at line 1291 of file commands.c.
References getTextManager(), LOG(), and LOG_WARNING.
void DrawInfoCmd | ( | char * | data, |
int | len | ||
) |
Draws a string in the info window.
data | |
len |
Definition at line 1227 of file commands.c.
References draw_ext_info(), LOG(), LOG_WARNING, MSG_TYPE_CLIENT, and MSG_TYPE_CLIENT_COMMAND.
void error_dialog | ( | char * | error, |
char * | message | ||
) |
Display an error message dialog. The dialog contains a multi-line, bolded heading that includes the client version information, an error description, and information relevant to the error condition.
Definition at line 314 of file main.c.
Referenced by client_run().
void ExtendedInfoSetCmd | ( | char * | data, |
int | len | ||
) |
void Face2Cmd | ( | guint8 * | data, |
int | len | ||
) |
We only get here if the server believes we are caching images. We rely on the fact that the server will only send a face command for a particular number once - at current time, we have no way of knowing if we have already received a face for a particular number.
Definition at line 526 of file image.c.
References Cache_Entry::checksum, CONFIG_CACHE, finish_face_cmd(), GetInt_String(), GetShort_String(), LOG(), LOG_WARNING, and use_config.
void FailureCmd | ( | char * | buf, |
int | len | ||
) |
Handles a failure return from the server.
buf | buffer sent by server. |
len | length of data. |
Definition at line 2416 of file commands.c.
References account_add_character_failure(), account_change_password_failure(), account_creation_failure(), account_login_failure(), create_new_character_failure(), LOG(), and LOG_ERROR.
void finish_face_cmd | ( | int | pnum, |
guint32 | checksum, | ||
int | has_sum, | ||
char * | face, | ||
int | faceset | ||
) |
This is common for all the face commands (face2, face1, face). For face1 and face commands, faceset should always be zero. for face commands, has_sum and checksum will be zero. pnum is the face number, while face is the name. We actually don't care what the set it - it could be useful right now, but in the current caching scheme, we look through all the facesets for the image and if the checksum matches, we assume we have match. This approach makes sure that we don't have to store the same image multiple times simply because the set number may be different.
Definition at line 429 of file image.c.
References associate_cache_entry(), cache_dir, Cache_Entry::checksum, create_and_rescale_image_from_data(), Cache_Entry::filename, Cache_Entry::image_data, image_find_cache_entry(), image_remove_hash(), Cache_Entry::ispublic, load_image(), LOG(), LOG_WARNING, png_to_data(), and requestface().
Referenced by Face2Cmd(), and get_image_sums().
void fire_dir | ( | int | dir | ) |
Definition at line 129 of file player.c.
References Player_Struct::count, cpl, dfire, Player_Struct::input_state, MAX_BUF, Playing, SC_NORMAL, and send_command().
Referenced by map_button_event(), and parse_key().
void free_all_items | ( | item * | op | ) |
Definition at line 242 of file item.c.
References free_all_items(), item_struct::inv, and item_struct::next.
Referenced by free_all_items().
void free_all_race_class_info | ( | Race_Class_Info * | data, |
int | num_entries | ||
) |
This function clears the data from the Race_Class_Info array. Because the structure itself contains data that is allocated, some work needs to be done to clear that data.
data | array to clear |
num_entries | size of the array. |
Definition at line 420 of file commands.c.
References Race_Class_Info::num_rc_choice, RC_Choice::num_values, and Race_Class_Info::rc_choice.
Referenced by client_reset(), and ReplyInfoCmd().
void get_image_info | ( | guint8 * | data, |
int | len | ||
) |
Takes the data from a replyinfo image_info and breaks it down. The info contained is the checkums, number of images, and faceset information. It stores this data into the face_info structure. Since we know data is null terminated, we can use the strchr operations with safety. In each block, we find the newline - if we find one, we presume the data is good, and update the face_info accordingly. if we don't find a newline, we return.
Definition at line 706 of file image.c.
References Face_Information_struct::bmaps_checksum, FaceSets_struct::comment, cs_print_string(), csocket, draw_ext_info(), FaceSets_struct::extension, face_info, Face_Information_struct::faceset, Face_Information_struct::facesets, FaceSets_struct::fallback, ClientSocket::fd, FaceSets_struct::fullname, Face_Information_struct::have_faceset_info, LOG(), LOG_WARNING, MAX_BUF, MAX_FACE_SETS, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_CONFIG, NDI_RED, Face_Information_struct::num_images, FaceSets_struct::prefix, replyinfo_status, RI_IMAGE_INFO, FaceSets_struct::size, and Face_Information_struct::want_faceset.
Referenced by ReplyInfoCmd().
void get_image_sums | ( | char * | data, |
int | len | ||
) |
This gets a block of checksums from the server. This lets it prebuild the images or what not. It would probably be nice to add a gui callback someplace that gives a little status display (18% done or whatever) - that probably needs to be done further up.
The start and stop values are not meaningful - they are here because the semantics of the requestinfo/replyinfo is that replyinfo includes the same request data as the requestinfo (thus, if the request failed for some reason, the client would know which one failed and then try again). Currently, we don't have any logic in the function below to deal with failures.
Definition at line 802 of file image.c.
References Cache_Entry::checksum, finish_face_cmd(), GetInt_String(), GetShort_String(), LOG(), LOG_WARNING, and replyinfo_last_face.
Referenced by ReplyInfoCmd().
const char* get_number | ( | guint32 | i | ) |
Definition at line 186 of file item.c.
References MAX_BUF.
Referenced by set_item_values().
guint8 get_type_from_name | ( | const char * | name | ) |
Definition at line 38 of file item.c.
References item_types, LOG(), LOG_WARNING, and NUM_ITEM_TYPES.
Referenced by set_item_values().
char GetChar_String | ( | const unsigned char * | data | ) |
data |
Definition at line 137 of file newsocket.c.
Referenced by AddspellCmd(), ExtSmooth(), get_new_char_info(), MapExtendedCmd(), process_race_class_info(), and UpdspellCmd().
gint64 GetInt64_String | ( | const unsigned char * | data | ) |
The reverse of SockList_AddInt, but on strings instead. Same for the GetShort, but for 64 bits
data |
Definition at line 161 of file newsocket.c.
Referenced by get_exp_info(), script_watch(), and StatsCmd().
int GetInt_String | ( | const unsigned char * | data | ) |
The reverse of SockList_AddInt, but on strings instead. Same for the GetShort, but for 16 bits.
data |
Definition at line 149 of file newsocket.c.
Referenced by AddspellCmd(), CompleteCmd(), DeleteItem(), DeleteSpell(), Face2Cmd(), get_image_sums(), Image2Cmd(), Item2Cmd(), PickupCmd(), PlayerCmd(), script_watch(), StatsCmd(), TickCmd(), UpdateItemCmd(), and UpdspellCmd().
short GetShort_String | ( | const unsigned char * | data | ) |
data |
Definition at line 179 of file newsocket.c.
Referenced by AccountPlayersCmd(), AddspellCmd(), AnimCmd(), CompleteCmd(), Face2Cmd(), get_exp_info(), get_image_sums(), get_starting_map_info(), Item2Cmd(), Map2Cmd(), MapExtendedCmd(), process_race_class_info(), script_watch(), SmoothCmd(), StatsCmd(), UpdateItemCmd(), and UpdspellCmd().
void GoodbyeCmd | ( | char * | data, |
int | len | ||
) |
data | |
len |
Definition at line 1142 of file commands.c.
References LOG(), and LOG_WARNING.
void handle_query | ( | char * | data, |
int | len | ||
) |
Prompts the user for input.
data | |
len |
Definition at line 1556 of file commands.c.
References cpl, CS_QUERY_HIDEINPUT, CS_QUERY_SINGLECHAR, CS_QUERY_YESNO, draw_ext_info(), draw_prompt(), Player_Struct::input_state, LOG(), LOG_DEBUG, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_QUERY, NDI_BLACK, Player_Struct::no_echo, Reply_Many, Reply_One, and x_set_echo().
void Image2Cmd | ( | guint8 * | data, |
int | len | ||
) |
Definition at line 552 of file image.c.
References display_newpng(), GetInt_String(), LOG(), and LOG_WARNING.
void init_common_cache_data | ( | void | ) |
Definition at line 359 of file image.c.
References cache_dir, CONFIG_CACHE, draw_ext_info(), facetoname, FD_Cache::fd, fd_cache, image_cache, IMAGE_HASH, image_process_line(), MAX_BUF, MAX_FACE_SETS, MAXPIXMAPNUM, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, FD_Cache::name, NDI_RED, and want_config.
Referenced by init_image_cache_data().
Definition at line 725 of file item.c.
References csocket, ClientSocket::fd, MAX_BUF, script_monitor_str(), SockList_AddChar(), SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Send(), item_struct::tag, and Spell_struct::tag.
void Item2Cmd | ( | unsigned char * | data, |
int | len | ||
) |
Parses the data sent to us from the server. revision is what item command the data came from - newer ones have addition fields.
data | |
len |
Definition at line 1677 of file commands.c.
References GetInt_String(), GetShort_String(), item_actions(), locate_item(), LOG(), LOG_WARNING, MAX_BUF, and update_item().
void item_actions | ( | item * | op | ) |
op |
Definition at line 1656 of file commands.c.
References close_container(), Player_Struct::container, cpl, item_struct::open, open_container(), and item_struct::was_open.
Referenced by Item2Cmd(), and UpdateItemCmd().
item* locate_item | ( | gint32 | tag | ) |
Definition at line 278 of file item.c.
References Player_Struct::container, cpl, item_struct::inv, locate_item_from_item(), map, player, and item_struct::tag.
Referenced by DeleteInventory(), DeleteItem(), hide_main_client(), Item2Cmd(), update_item(), and UpdateItemCmd().
void LOG | ( | LogLevel | level, |
const char * | origin, | ||
const char * | format, | ||
... | |||
) |
Log messages of a certain importance to stderr. See 'client.h' for a full list of possible log levels.
Definition at line 111 of file misc.c.
References getLogLevelText(), global_time, and MINLOG.
Referenced by AccountPlayersCmd(), add_marked_text_to_pane(), add_to_textbuf(), AddMeFail(), AddMeSuccess(), AddspellCmd(), AnimCmd(), cache_newpng(), cf_play_music(), cf_play_sound(), client_disconnect(), client_negotiate(), client_run(), CompleteCmd(), config_check(), config_load(), config_load_legacy(), DeleteInventory(), DeleteItem(), DeleteSpell(), display_newpng(), do_network(), draw_ext_info(), draw_inv_table(), draw_magic_map(), draw_map(), DrawExtInfoCmd(), DrawInfoCmd(), event_loop(), Face2Cmd(), FailureCmd(), finish_face_cmd(), get_class_info(), get_exp_info(), get_image_info(), get_image_sums(), get_new_char_info(), get_race_info(), get_skill_info(), get_starting_map_info(), get_type_from_name(), GoodbyeCmd(), handle_query(), Image2Cmd(), image_add_hash(), image_find_hash(), image_process_line(), image_remove_hash(), info_get_styles(), init_default_keybindings(), init_ui(), inventory_get_styles(), inventory_init(), Item2Cmd(), keybind_insert(), keybinding_get_data(), keybinding_selection_func(), keybindings_init(), keyfunc(), launch_mapedit(), list_selection_func(), load_image(), load_msgctrl_configuration(), load_theme(), MagicMapCmd(), main(), Map2Cmd(), map_init(), map_scrollCmd(), mapdata_set_anim_layer(), menu_quit_program(), message_callback(), metaserver_connect_to(), MusicCmd(), on_combobox_rcs_changed(), on_keybinding_button_remove_clicked(), on_keybinding_button_update_clicked(), on_spell_cast_clicked(), on_spell_invoke_clicked(), on_window_destroy_event(), parse_args(), parse_keybind_line(), pickup_init(), PlayerCmd(), png_to_data(), process_race_class_info(), read_config_dialog(), ReplyInfoCmd(), rescale_rgba_data(), save_keys(), save_msgctrl_configuration(), script_init(), send_command(), SetupCmd(), SockList_AddChar(), SockList_AddInt(), SockList_AddShort(), SockList_Send(), Sound2Cmd(), spell_get_styles(), stats_get_styles(), StatsCmd(), trigger_skill(), unbind_key(), UpdateItemCmd(), UpdspellCmd(), and VersionCmd().
void look_at | ( | int | x, |
int | y | ||
) |
Definition at line 82 of file player.c.
References cs_print_string(), csocket, and ClientSocket::fd.
Referenced by map_button_event().
int make_path_to_file | ( | char * | filename | ) |
If any directories in the given path doesn't exist, they are created.
Definition at line 87 of file misc.c.
Referenced by save_keys(), and save_msgctrl_configuration().
item* map_item | ( | void | ) |
Definition at line 571 of file item.c.
References map, new_item(), and item_struct::weight.
Referenced by client_init().
void new_player | ( | long | tag, |
char * | name, | ||
long | weight, | ||
long | face | ||
) |
Initialize player object using information from the server.
Definition at line 54 of file player.c.
References copy_name, cpl, item_struct::d_name, item_struct::face, is_afk, keybindings_init(), last_command_sent, Spell_struct::next, item_struct::nrof, Player_Struct::ob, Player_Struct::spelldata, item_struct::tag, and item_struct::weight.
Referenced by PlayerCmd().
void PickupCmd | ( | guint8 * | data, |
int | len | ||
) |
Server gives us current player's pickup.
data | buffer sent by server. |
len | length of data. |
Definition at line 2402 of file commands.c.
References client_pickup(), and GetInt_String().
item* player_item | ( | void | ) |
Definition at line 565 of file item.c.
References new_item(), and player.
Referenced by client_init().
void PlayerCmd | ( | unsigned char * | data, |
int | len | ||
) |
Gets the player information. This function copies relevant data from the archetype to the object. Only copies data that was not set in the object structure.
data | |
len |
Definition at line 1629 of file commands.c.
References GetInt_String(), LOG(), LOG_WARNING, MAX_BUF, new_player(), and reset_player_data().
void print_inventory | ( | item * | op | ) |
Definition at line 620 of file item.c.
References item_struct::d_name, draw_ext_info(), item_struct::flags, get_info_width(), item_struct::inv, MAX_BUF, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_DEBUG, NDI_BLACK, item_struct::next, item_struct::nrof, print_inventory(), item_struct::tag, and item_struct::weight.
Referenced by do_inv(), and print_inventory().
void remove_item | ( | item * | op | ) |
Definition at line 309 of file item.c.
References Player_Struct::container, cpl, item_struct::env, item_struct::inv, item_struct::inv_updated, item_event_item_deleting(), map, item_struct::next, player, item_struct::prev, and remove_item_inventory().
Referenced by DeleteItem(), remove_item_inventory(), and update_item().
void remove_item_inventory | ( | item * | op | ) |
Definition at line 344 of file item.c.
References item_struct::inv, item_struct::inv_updated, item_event_container_clearing(), and remove_item().
Referenced by DeleteInventory(), hide_main_client(), and remove_item().
void ReplyInfoCmd | ( | guint8 * | buf, |
int | len | ||
) |
void requestface | ( | int | pnum, |
char * | facename | ||
) |
Definition at line 412 of file image.c.
References Face_Information_struct::cache_misses, cs_print_string(), csocket, face_info, facetoname, and ClientSocket::fd.
Referenced by finish_face_cmd().
void reset_image_cache_data | ( | void | ) |
We can now connect to different servers, so we need to clear out any old images. We try to free the data also to prevent memory leaks. Note that we don't touch our hashed entries - so that when we connect to a new server, we still have all that information.
Definition at line 509 of file image.c.
References CONFIG_CACHE, facetoname, MAXPIXMAPNUM, and want_config.
Referenced by reset_image_data().
void reset_player_data | ( | ) |
Reset player experience data.
Definition at line 229 of file init.c.
References cpl, MAX_SKILL, Stat_struct::skill_exp, Stat_struct::skill_level, and Player_Struct::stats.
Referenced by PlayerCmd(), and reset_vars_common().
void run_dir | ( | int | dir | ) |
Definition at line 150 of file player.c.
References drun, MAX_BUF, SC_NORMAL, and send_command().
Referenced by parse_key(), and run_move_to().
int script_lua_command | ( | const char * | command, |
const char * | param | ||
) |
void script_lua_kill | ( | const char * | param | ) |
void script_lua_list | ( | const char * | param | ) |
void script_lua_load | ( | const char * | name | ) |
void script_lua_stats | ( | void | ) |
int send_command | ( | const char * | command, |
int | repeat, | ||
int | must_send | ||
) |
Definition at line 235 of file player.c.
References clear_move_to(), COMMAND_MAX, ClientSocket::command_received, ClientSocket::command_sent, command_to_direction(), CONFIG_CWINDOW, CONFIG_ECHO, Player_Struct::count, cpl, cs_print_string(), ClientSocket::cs_version, csocket, ClientSocket::dir, draw_ext_info(), drun, ClientSocket::fd, Player_Struct::input_state, is_afk, last_command_sent, LOG(), LOG_ERROR, MAX_BUF, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, NDI_BLACK, predict_scroll(), profile_latency, profile_time, Reply_One, SC_MOVETO, script_monitor(), SockList_AddInt(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Send(), starts_with(), and use_config.
Referenced by auto_afk(), clear_fire(), clear_run(), command_help(), command_take(), do_mapedit(), extended_command(), fire_dir(), new_menu_pickup(), on_auto_afk_response(), on_spell_cast_clicked(), on_spell_invoke_clicked(), run_dir(), script_process_cmd(), stop_run(), trigger_skill(), and walk_dir().
void send_mark_obj | ( | item * | op | ) |
Definition at line 548 of file item.c.
References csocket, item_struct::env, ClientSocket::fd, MAX_BUF, script_monitor_str(), SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Send(), and item_struct::tag.
Referenced by list_item_action(), and ma_mark().
void send_reply | ( | const char * | text | ) |
Sends a reply to the server. This function basically just packs the stuff up.
text | contains the null terminated string of text to send. |
Definition at line 1612 of file commands.c.
References cpl, cs_print_string(), csocket, ClientSocket::fd, Player_Struct::no_echo, and x_set_echo().
Referenced by keyfunc(), and on_entry_commands_activate().
void SendAddMe | ( | ClientSocket | csock | ) |
Definition at line 76 of file init.c.
References cs_print_string(), and ClientSocket::fd.
Referenced by client_negotiate().
void SendVersion | ( | ClientSocket | csock | ) |
Definition at line 71 of file init.c.
References cs_print_string(), ClientSocket::fd, VERSION_CS, VERSION_INFO, and VERSION_SC.
Referenced by client_negotiate().
void set_item_values | ( | item * | op, |
char * | name, | ||
gint32 | weight, | ||
guint16 | face, | ||
guint16 | flags, | ||
guint16 | anim, | ||
guint16 | animspeed, | ||
guint32 | nrof, | ||
guint16 | type | ||
) |
Definition at line 461 of file item.c.
References item_struct::anim_speed, item_struct::animation_id, copy_name, csocket, item_struct::d_name, item_struct::env, item_struct::face, get_flags(), get_number(), get_type_from_name(), item_struct::inv_updated, item_event_item_changed(), map, NO_ITEM_TYPE, item_struct::nrof, item_struct::p_name, item_struct::s_name, ClientSocket::sc_version, item_struct::type, update_item_sort(), and item_struct::weight.
Referenced by update_item().
void setTextManager | ( | int | type, |
ExtTextManager | callback | ||
) |
type | |
callback |
Definition at line 1251 of file commands.c.
References TextManager::callback, firstTextManager, TextManager::next, and TextManager::type.
Referenced by info_init().
void SetupCmd | ( | char * | buf, |
int | len | ||
) |
Received a response to a setup from the server. This function is basically the same as the server side function - we just do some different processing on the data.
buf | |
len |
Definition at line 901 of file commands.c.
References client_disconnect(), client_mapsize(), CONFIG_CACHE, CONFIG_MAPHEIGHT, CONFIG_MAPWIDTH, cs_print_string(), ClientSocket::cs_version, csocket, draw_ext_info(), face_info, Face_Information_struct::faceset, ClientSocket::fd, LOG(), LOG_DEBUG, LOG_INFO, LOG_WARNING, mapdata_set_size(), MAX_BUF, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_SERVER, NDI_RED, resize_map_window(), spellmon_level, start_login(), use_config, and want_config.
void SinkCmd | ( | unsigned char * | data, |
int | len | ||
) |
data | |
len |
Definition at line 2377 of file commands.c.
void SmoothCmd | ( | unsigned char * | data, |
int | len | ||
) |
Receives the smooth mapping from the server. Because this information is reference a lot, the smoothing face is stored in the pixmap data - this makes access much faster than searching an array of data for the face to use.
data | |
len |
Definition at line 1207 of file commands.c.
References addsmooth(), and GetShort_String().
void SockList_AddChar | ( | SockList * | sl, |
char | c | ||
) |
sl | |
c |
Definition at line 43 of file newsocket.c.
References SockList::buf, SockList::len, LOG(), LOG_ERROR, and MAX_BUF.
Referenced by add_character_to_account(), create_new_character(), do_account_change(), do_account_create(), do_account_login(), inscribe_magical_scroll(), script_process_cmd(), send_create_player_to_server(), and toggle_locked().
void SockList_AddInt | ( | SockList * | sl, |
guint32 | data | ||
) |
sl | |
data |
Definition at line 80 of file newsocket.c.
References SockList::buf, SockList::len, LOG(), LOG_ERROR, and MAX_BUF.
Referenced by inscribe_magical_scroll(), script_process_cmd(), send_command(), send_mark_obj(), and toggle_locked().
void SockList_AddShort | ( | SockList * | sl, |
guint16 | data | ||
) |
sl | |
data |
Definition at line 64 of file newsocket.c.
References SockList::buf, SockList::len, LOG(), LOG_ERROR, and MAX_BUF.
Referenced by send_command().
void SockList_AddString | ( | SockList * | sl, |
const char * | str | ||
) |
sl | |
str |
Definition at line 98 of file newsocket.c.
References SockList::buf, SockList::len, and MAX_BUF.
Referenced by add_character_to_account(), create_new_character(), do_account_change(), do_account_create(), do_account_login(), inscribe_magical_scroll(), play_character(), script_process_cmd(), send_command(), send_create_player_to_server(), send_mark_obj(), and toggle_locked().
void SockList_Init | ( | SockList * | sl, |
guint8 * | buf | ||
) |
sl | |
buf |
Definition at line 32 of file newsocket.c.
References SockList::buf, and SockList::len.
Referenced by add_character_to_account(), create_new_character(), cs_print_string(), do_account_change(), do_account_create(), do_account_login(), inscribe_magical_scroll(), play_character(), script_process_cmd(), send_command(), send_create_player_to_server(), send_mark_obj(), and toggle_locked().
bool SockList_ReadPacket | ( | GSocketConnection | c[static 1], |
SockList | sl[static 1], | ||
size_t | len, | ||
GError ** | error | ||
) |
Reads from the socket and puts data into a socklist. The only processing done is to remove the initial size value. An assumption made is that the buffer is at least 2 bytes long.
fd | Socket to read from. |
sl | Pointer to a buffer to put the read data. |
len | Size of the buffer allocated to accept data. |
Definition at line 213 of file newsocket.c.
References SockList::buf, CLIENT_ERROR, CLIENT_ERROR_TOOBIG, csocket, cst_lst, cst_tot, ClientSocket::fd, GetUShort_String(), CS_Stats::ibytes, in, and SockList::len.
Referenced by client_run().
int SockList_Send | ( | SockList * | sl, |
GSocketConnection * | c | ||
) |
Send data from a socklist to the socket.
Definition at line 112 of file newsocket.c.
References SockList::buf, debug_protocol, SockList::len, LOG(), LOG_INFO, LOG_WARNING, and printable().
Referenced by add_character_to_account(), create_new_character(), cs_print_string(), do_account_change(), do_account_create(), do_account_login(), inscribe_magical_scroll(), play_character(), script_process_cmd(), send_command(), send_create_player_to_server(), send_mark_obj(), and toggle_locked().
void StatsCmd | ( | unsigned char * | data, |
int | len | ||
) |
Updates the local copy of the stats and displays it.
data | |
len |
Definition at line 1368 of file commands.c.
References Stat_struct::ac, Stat_struct::attuned, Stat_struct::Cha, Stat_struct::Con, cpl, CS_NUM_SKILLS, CS_STAT_AC, CS_STAT_ARMOUR, CS_STAT_CHA, CS_STAT_CON, CS_STAT_DAM, CS_STAT_DEX, CS_STAT_EXP, CS_STAT_EXP64, CS_STAT_FLAGS, CS_STAT_FOOD, CS_STAT_GRACE, CS_STAT_HP, CS_STAT_INT, CS_STAT_LEVEL, CS_STAT_MAXGRACE, CS_STAT_MAXHP, CS_STAT_MAXSP, CS_STAT_POW, CS_STAT_RANGE, CS_STAT_RESIST_END, CS_STAT_RESIST_START, CS_STAT_SKILLINFO, CS_STAT_SP, CS_STAT_SPEED, CS_STAT_SPELL_ATTUNE, CS_STAT_SPELL_DENY, CS_STAT_SPELL_REPEL, CS_STAT_STR, CS_STAT_TITLE, CS_STAT_WC, CS_STAT_WEAP_SP, CS_STAT_WEIGHT_LIM, CS_STAT_WIS, Stat_struct::dam, Stat_struct::denied, Stat_struct::Dex, draw_message_window(), draw_stats(), Stat_struct::exp, Stat_struct::flags, Stat_struct::food, GetInt64_String(), GetInt_String(), GetShort_String(), Stat_struct::grace, Stat_struct::hp, Stat_struct::Int, item_struct::inv_updated, Stat_struct::level, LOG(), LOG_WARNING, Stat_struct::maxgrace, Stat_struct::maxhp, Stat_struct::maxsp, Player_Struct::ob, Stat_struct::Pow, Player_Struct::range, redraw(), Stat_struct::repelled, Stat_struct::resist_change, Stat_struct::resists, script_lua_stats(), set_weight_limit(), Stat_struct::skill_exp, Stat_struct::skill_level, Stat_struct::sp, Stat_struct::speed, Player_Struct::spells_updated, Player_Struct::stats, Stat_struct::Str, Player_Struct::title, use_skill(), Stat_struct::wc, Stat_struct::weapon_sp, Stat_struct::weight_limit, and Stat_struct::Wis.
void stop_fire | ( | void | ) |
void stop_run | ( | void | ) |
Definition at line 145 of file player.c.
References drun, SC_FIRERUN, and send_command().
Referenced by keyfunc(), and run_move_to().
void TickCmd | ( | guint8 * | data, |
int | len | ||
) |
Got a tick from the server. We currently don't care what tick number it is, but just have the code in case at some time we do.
data | |
len |
Definition at line 2388 of file commands.c.
References client_tick(), and GetInt_String().
void toggle_locked | ( | item * | op | ) |
Definition at line 530 of file item.c.
References csocket, item_struct::env, ClientSocket::fd, item_struct::locked, MAX_BUF, script_monitor_str(), SockList_AddChar(), SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Send(), and item_struct::tag.
Referenced by list_item_action(), and ma_lock().
void update_item | ( | int | tag, |
int | loc, | ||
char * | name, | ||
int | weight, | ||
int | face, | ||
int | flags, | ||
int | anim, | ||
int | animspeed, | ||
guint32 | nrof, | ||
int | type | ||
) |
Definition at line 579 of file item.c.
References item_struct::anim_speed, item_struct::animation_id, copy_name, create_new_item(), item_struct::d_name, item_struct::env, item_struct::face, get_flags(), item_struct::inv, item_struct::inv_updated, locate_item(), item_struct::nrof, player, remove_item(), set_item_values(), item_struct::tag, and item_struct::weight.
Referenced by Item2Cmd(), and UpdateItemCmd().
void update_item_sort | ( | item * | it | ) |
Definition at line 87 of file item.c.
References item_struct::applied, item_struct::env, insert_item_before_item(), item_struct::inv, item_struct::locked, map, item_struct::next, item_struct::prev, item_struct::s_name, and item_struct::type.
Referenced by set_item_values().
void UpdateItemCmd | ( | unsigned char * | data, |
int | len | ||
) |
Updates some attributes of an item
data | |
len |
Definition at line 1727 of file commands.c.
References item_struct::anim_speed, item_struct::animation_id, item_struct::env, item_struct::face, item_struct::flagsval, GetInt_String(), GetShort_String(), item_actions(), locate_item(), LOG(), LOG_WARNING, MAX_BUF, item_struct::nrof, item_struct::tag, item_struct::type, UPD_ANIM, UPD_ANIMSPEED, UPD_FACE, UPD_FLAGS, UPD_LOCATION, UPD_NAME, UPD_NROF, UPD_WEIGHT, update_item(), and item_struct::weight.
void use_skill | ( | int | skill_id | ) |
Maintain the last_used_skills LRU list for displaying the recently used skills first.
skill_id |
Definition at line 1343 of file commands.c.
References last_used_skills.
Referenced by StatsCmd(), and trigger_skill().
void VersionCmd | ( | char * | data, |
int | len | ||
) |
Definition at line 45 of file init.c.
References ClientSocket::cs_version, csocket, LOG(), LOG_DEBUG, LOG_WARNING, ClientSocket::sc_version, VERSION_CS, and VERSION_SC.
void walk_dir | ( | int | dir | ) |
Definition at line 177 of file player.c.
References dir_to_command(), SC_MOVETO, and send_command().
Referenced by run_move_to().