Crossfire Client, Trunk
proto.h
Go to the documentation of this file.
1 /* commands.c */
2 void ReplyInfoCmd(guint8 *buf, int len);
3 void SetupCmd(char *buf, int len);
4 void ExtendedInfoSetCmd(char *data, int len);
5 void AddMeFail(char *data, int len);
6 void AddMeSuccess(char *data, int len);
7 void GoodbyeCmd(char *data, int len);
8 void AnimCmd(unsigned char *data, int len);
9 void SmoothCmd(unsigned char *data, int len);
10 void DrawInfoCmd(char *data, int len);
11 void setTextManager(int type, ExtTextManager callback);
12 void DrawExtInfoCmd(char *data, int len);
13 void use_skill(int skill_id);
14 void StatsCmd(unsigned char *data, int len);
15 void handle_query(char *data, int len);
16 void send_reply(const char *text);
17 void PlayerCmd(unsigned char *data, int len);
18 void item_actions(item *op);
19 void Item2Cmd(unsigned char *data, int len);
20 void UpdateItemCmd(unsigned char *data, int len);
21 void DeleteItem(unsigned char *data, int len);
22 void DeleteInventory(unsigned char *data, int len);
23 void AddspellCmd(unsigned char *data, int len);
24 void UpdspellCmd(unsigned char *data, int len);
25 void DeleteSpell(unsigned char *data, int len);
26 void NewmapCmd(unsigned char *data, int len);
27 void Map2Cmd(unsigned char *data, int len);
28 void map_scrollCmd(char *data, int len);
29 int ExtSmooth(unsigned char *data, int len, int x, int y, int layer);
30 void MapExtendedCmd(unsigned char *data, int len);
31 void MagicMapCmd(unsigned char *data, int len);
32 void SinkCmd(unsigned char *data, int len);
33 void TickCmd(guint8 *data, int len);
34 void PickupCmd(guint8 *data, int len);
35 void FailureCmd(char *buf, int len);
36 void AccountPlayersCmd(char *buf, int len);
37 void free_all_race_class_info(Race_Class_Info *data, int num_entries);
38 /* image.c */
39 void init_common_cache_data(void);
40 void requestface(int pnum, char *facename);
41 void finish_face_cmd(int pnum, guint32 checksum, int has_sum, char *face, int faceset);
42 void reset_image_cache_data(void);
43 void Face2Cmd(guint8 *data, int len);
44 void Image2Cmd(guint8 *data, int len);
45 void display_newpng(int face, guint8 *buf, int buflen, int setnum);
46 void get_image_info(guint8 *data, int len);
47 void get_image_sums(char *data, int len);
48 /* init.c */
49 void VersionCmd(char *data, int len);
50 void SendVersion(ClientSocket csock);
51 void SendAddMe(ClientSocket csock);
52 void client_init(void);
53 void reset_player_data(void);
54 void client_reset(void);
55 /* item.c */
56 guint8 get_type_from_name(const char *name);
57 void update_item_sort(item *it);
58 const char *get_number(guint32 i);
59 void free_all_items(item *op);
60 item *locate_item(gint32 tag);
61 void remove_item(item *op);
62 void remove_item_inventory(item *op);
63 void set_item_values(item *op, char *name, gint32 weight, guint16 face, guint16 flags, guint16 anim, guint16 animspeed, guint32 nrof, guint16 type);
64 void toggle_locked(item *op);
65 void send_mark_obj(item *op);
66 item *player_item(void);
67 item *map_item(void);
68 void update_item(int tag, int loc, char *name, int weight, int face, int flags, int anim, int animspeed, guint32 nrof, int type);
69 void print_inventory(item *op);
70 void animate_objects(void);
71 int can_write_spell_on(item *it);
72 void inscribe_magical_scroll(item *scroll, Spell *spell);
73 /* misc.c */
74 int make_path_to_file(char *filename);
75 void LOG(LogLevel level, const char *origin, const char *format, ...);
76 /* newsocket.c */
77 void SockList_Init(SockList *sl, guint8 *buf);
78 void SockList_AddChar(SockList *sl, char c);
79 void SockList_AddShort(SockList *sl, guint16 data);
80 void SockList_AddInt(SockList *sl, guint32 data);
81 void SockList_AddString(SockList *sl, const char *str);
82 int SockList_Send(SockList *sl, GSocketConnection* c);
83 char GetChar_String(const unsigned char *data);
84 int GetInt_String(const unsigned char *data);
85 gint64 GetInt64_String(const unsigned char *data);
86 short GetShort_String(const unsigned char *data);
87 bool SockList_ReadPacket(GInputStream in[static 1], SockList sl[static 1], size_t len, GError** error);
88 int cs_print_string(GSocketConnection* c, const char *str, ...);
89 /* p_cmd.c */
90 /* player.c */
91 void new_player(long tag, char *name, long weight, long face);
92 void look_at(int x, int y);
93 void client_send_apply(int tag);
94 void client_send_examine(int tag);
95 void client_send_move(int loc, int tag, int nrof);
96 void stop_fire(void);
97 void clear_fire(void);
98 void clear_run(void);
99 void fire_dir(int dir);
100 void stop_run(void);
101 void run_dir(int dir);
102 void walk_dir(int dir);
103 int send_command(const char *command, int repeat, int must_send);
104 void CompleteCmd(unsigned char *data, int len);
105 void command_take(const char *command, const char *cpnext);
106 /* script.c */
107 /* script_lua.c */
108 void script_lua_load(const char *name);
109 void script_lua_list(const char *param);
110 void script_lua_kill(const char *param);
111 void script_lua_stats(void);
112 int script_lua_command(const char *command, const char *param);
113 
114 void error_dialog(char *error, char *message);
DeleteSpell
void DeleteSpell(unsigned char *data, int len)
Definition: commands.c:2002
SockList_AddChar
void SockList_AddChar(SockList *sl, char c)
Definition: newsocket.c:44
reset_image_cache_data
void reset_image_cache_data(void)
We can now connect to different servers, so we need to clear out any old images.
Definition: image.c:509
SinkCmd
void SinkCmd(unsigned char *data, int len)
Definition: commands.c:2418
AnimCmd
void AnimCmd(unsigned char *data, int len)
Definition: commands.c:1163
AddMeFail
void AddMeFail(char *data, int len)
Handles when the server says we can't be added.
Definition: commands.c:1111
SockList_AddShort
void SockList_AddShort(SockList *sl, guint16 data)
Definition: newsocket.c:65
PickupCmd
void PickupCmd(guint8 *data, int len)
Server gives us current player's pickup.
Definition: commands.c:2443
ExtTextManager
void(* ExtTextManager)(int flag, int type, int subtype, char *message)
Definition: client.h:45
Item2Cmd
void Item2Cmd(unsigned char *data, int len)
Parses the data sent to us from the server.
Definition: commands.c:1678
get_number
const char * get_number(guint32 i)
Definition: item.c:186
get_type_from_name
guint8 get_type_from_name(const char *name)
Definition: item.c:38
DeleteInventory
void DeleteInventory(unsigned char *data, int len)
Definition: commands.c:1838
Face2Cmd
void Face2Cmd(guint8 *data, int len)
We only get here if the server believes we are caching images.
Definition: image.c:526
TickCmd
void TickCmd(guint8 *data, int len)
Got a tick from the server.
Definition: commands.c:2429
stop_run
void stop_run(void)
Definition: player.c:141
locate_item
item * locate_item(gint32 tag)
Definition: item.c:278
finish_face_cmd
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).
Definition: image.c:429
script_lua_kill
void script_lua_kill(const char *param)
SockList_AddInt
void SockList_AddInt(SockList *sl, guint32 data)
Definition: newsocket.c:81
walk_dir
void walk_dir(int dir)
Definition: player.c:173
new_player
void new_player(long tag, char *name, long weight, long face)
Initialize player object using information from the server.
Definition: player.c:54
make_path_to_file
int make_path_to_file(char *filename)
If any directories in the given path doesn't exist, they are created.
Definition: misc.c:87
GetChar_String
char GetChar_String(const unsigned char *data)
Definition: newsocket.c:138
script_lua_stats
void script_lua_stats(void)
client_send_move
void client_send_move(int loc, int tag, int nrof)
Request to move 'nrof' objects with 'tag' to 'loc'.
Definition: player.c:93
SmoothCmd
void SmoothCmd(unsigned char *data, int len)
Receives the smooth mapping from the server.
Definition: commands.c:1208
send_mark_obj
void send_mark_obj(item *op)
Definition: item.c:548
remove_item_inventory
void remove_item_inventory(item *op)
Definition: item.c:344
free_all_items
void free_all_items(item *op)
Definition: item.c:242
LogLevel
LogLevel
Definition: client.h:435
player_item
item * player_item(void)
Definition: item.c:565
PlayerCmd
void PlayerCmd(unsigned char *data, int len)
Gets the player information.
Definition: commands.c:1630
DrawInfoCmd
void DrawInfoCmd(char *data, int len)
Draws a string in the info window.
Definition: commands.c:1228
run_dir
void run_dir(int dir)
Definition: player.c:146
StatsCmd
void StatsCmd(unsigned char *data, int len)
Updates the local copy of the stats and displays it.
Definition: commands.c:1369
ExtSmooth
int ExtSmooth(unsigned char *data, int len, int x, int y, int layer)
Extract smoothing infos from an extendedmapinfo packet part data is located at the beginning of the s...
Definition: commands.c:2265
stop_fire
void stop_fire(void)
Definition: player.c:104
MapExtendedCmd
void MapExtendedCmd(unsigned char *data, int len)
Handle MapExtended command Warning! if you add commands to extended, take care that the 'layer' argum...
Definition: commands.c:2303
NewmapCmd
void NewmapCmd(unsigned char *data, int len)
Definition: commands.c:2056
ReplyInfoCmd
void ReplyInfoCmd(guint8 *buf, int len)
in
static GInputStream * in
Definition: client.c:71
set_item_values
void set_item_values(item *op, char *name, gint32 weight, guint16 face, guint16 flags, guint16 anim, guint16 animspeed, guint32 nrof, guint16 type)
Definition: item.c:461
Spell_struct
Definition: client.h:295
VersionCmd
void VersionCmd(char *data, int len)
Definition: init.c:48
clear_fire
void clear_fire(void)
Definition: player.c:111
can_write_spell_on
int can_write_spell_on(item *it)
Definition: item.c:720
SetupCmd
void SetupCmd(char *buf, int len)
Received a response to a setup from the server.
Definition: commands.c:901
send_command
int send_command(const char *command, int repeat, int must_send)
Definition: player.c:231
GetInt64_String
gint64 GetInt64_String(const unsigned char *data)
The reverse of SockList_AddInt, but on strings instead.
Definition: newsocket.c:162
command_take
void command_take(const char *command, const char *cpnext)
Definition: player.c:349
Image2Cmd
void Image2Cmd(guint8 *data, int len)
Definition: image.c:552
SockList_Init
void SockList_Init(SockList *sl, guint8 *buf)
Definition: newsocket.c:33
Map2Cmd
void Map2Cmd(unsigned char *data, int len)
Definition: commands.c:2082
AddMeSuccess
void AddMeSuccess(char *data, int len)
This is really a throwaway command - there really isn't any reason to send addme_success commands.
Definition: commands.c:1127
GetInt_String
int GetInt_String(const unsigned char *data)
The reverse of SockList_AddInt, but on strings instead.
Definition: newsocket.c:150
script_lua_load
void script_lua_load(const char *name)
client_send_examine
void client_send_examine(int tag)
Definition: player.c:86
reset_player_data
void reset_player_data(void)
Reset player experience data.
Definition: init.c:234
map_scrollCmd
void map_scrollCmd(char *data, int len)
Scrolls the map on the client by some amount.
Definition: commands.c:2235
send_reply
void send_reply(const char *text)
Sends a reply to the server.
Definition: commands.c:1613
SendAddMe
void SendAddMe(ClientSocket csock)
Definition: init.c:79
DeleteItem
void DeleteItem(unsigned char *data, int len)
Definition: commands.c:1812
get_image_info
void get_image_info(guint8 *data, int len)
Takes the data from a replyinfo image_info and breaks it down.
Definition: image.c:706
Race_Class_Info
Definition: client.h:596
get_image_sums
void get_image_sums(char *data, int len)
This gets a block of checksums from the server.
Definition: image.c:802
ExtendedInfoSetCmd
void ExtendedInfoSetCmd(char *data, int len)
UpdspellCmd
void UpdspellCmd(unsigned char *data, int len)
Definition: commands.c:1964
CompleteCmd
void CompleteCmd(unsigned char *data, int len)
Definition: player.c:317
SockList_Send
int SockList_Send(SockList *sl, GSocketConnection *c)
Send data from a socklist to the socket.
Definition: newsocket.c:113
cs_print_string
int cs_print_string(GSocketConnection *c, const char *str,...)
Send a printf-formatted packet to the socket.
Definition: newsocket.c:251
look_at
void look_at(int x, int y)
Definition: player.c:78
script_lua_list
void script_lua_list(const char *param)
GetShort_String
short GetShort_String(const unsigned char *data)
Definition: newsocket.c:180
client_init
void client_init(void)
Called ONCE during client startup to initialize configuration and other variables to reasonable defau...
Definition: init.c:192
init_common_cache_data
void init_common_cache_data(void)
Definition: image.c:359
item_struct
Definition: item.h:50
print_inventory
void print_inventory(item *op)
Definition: item.c:620
item_actions
void item_actions(item *op)
Definition: commands.c:1657
ClientSocket
Basic support for socket communications, including the file descriptor, input buffer,...
Definition: client.h:123
setTextManager
void setTextManager(int type, ExtTextManager callback)
Definition: commands.c:1252
map_item
item * map_item(void)
Definition: item.c:571
SockList_ReadPacket
bool SockList_ReadPacket(GInputStream in[static 1], SockList sl[static 1], size_t len, GError **error)
Reads from the socket and puts data into a socklist.
Definition: newsocket.c:214
toggle_locked
void toggle_locked(item *op)
Definition: item.c:530
AccountPlayersCmd
void AccountPlayersCmd(char *buf, int len)
This handles the accountplayers command.
Definition: commands.c:2503
GoodbyeCmd
void GoodbyeCmd(char *data, int len)
Definition: commands.c:1143
free_all_race_class_info
void free_all_race_class_info(Race_Class_Info *data, int num_entries)
This function clears the data from the Race_Class_Info array.
Definition: commands.c:420
DrawExtInfoCmd
void DrawExtInfoCmd(char *data, int len)
We must extract color, type, subtype and dispatch to callback.
Definition: commands.c:1292
remove_item
void remove_item(item *op)
Definition: item.c:309
SendVersion
void SendVersion(ClientSocket csock)
Definition: init.c:74
MagicMapCmd
void MagicMapCmd(unsigned char *data, int len)
Definition: commands.c:2365
error_dialog
void error_dialog(char *error, char *message)
Display an error message dialog.
Definition: main.c:328
script_lua_command
int script_lua_command(const char *command, const char *param)
AddspellCmd
void AddspellCmd(unsigned char *data, int len)
Definition: commands.c:1879
clear_run
void clear_run(void)
Definition: player.c:118
use_skill
void use_skill(int skill_id)
Maintain the last_used_skills LRU list for displaying the recently used skills first.
Definition: commands.c:1344
client_send_apply
void client_send_apply(int tag)
Definition: player.c:82
UpdateItemCmd
void UpdateItemCmd(unsigned char *data, int len)
Updates some attributes of an item.
Definition: commands.c:1728
FailureCmd
void FailureCmd(char *buf, int len)
Handles a failure return from the server.
Definition: commands.c:2457
requestface
void requestface(int pnum, char *facename)
Definition: image.c:412
LOG
void LOG(LogLevel level, const char *origin, const char *format,...)
Log messages of a certain importance to stderr.
Definition: misc.c:111
animate_objects
void animate_objects(void)
Definition: item.c:654
fire_dir
void fire_dir(int dir)
Definition: player.c:125
update_item_sort
void update_item_sort(item *it)
Definition: item.c:87
update_item
void update_item(int tag, int loc, char *name, int weight, int face, int flags, int anim, int animspeed, guint32 nrof, int type)
Definition: item.c:579
client_reset
void client_reset(void)
Clear client variables between connections to different servers.
Definition: init.c:247
display_newpng
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.
Definition: image.c:669
SockList_AddString
void SockList_AddString(SockList *sl, const char *str)
Definition: newsocket.c:99
handle_query
void handle_query(char *data, int len)
Prompts the user for input.
Definition: commands.c:1557
SockList
Contains the base information we use to make up a packet we want to send.
Definition: newclient.h:654
inscribe_magical_scroll
void inscribe_magical_scroll(item *scroll, Spell *spell)
Definition: item.c:725