ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/client.h
(Generate patch)

Comparing deliantra/server/include/client.h (file contents):
Revision 1.110 by root, Fri Nov 9 00:11:49 2012 UTC vs.
Revision 1.121 by root, Sat Nov 17 23:40:00 2018 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * 6 *
6 * Deliantra is free software: you can redistribute it and/or modify it under 7 * Deliantra is free software: you can redistribute it and/or modify it under
7 * the terms of the Affero GNU General Public License as published by the 8 * the terms of the Affero GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your 9 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version. 10 * option) any later version.
101 ST_GET_PARTY_PASSWORD, 102 ST_GET_PARTY_PASSWORD,
102}; 103};
103 104
104// a handler for a specific type of packet 105// a handler for a specific type of packet
105enum { 106enum {
106 PF_PLAYER = 0x01, // must have valid player / will by synchronised 107 PF_PLAYER = 0x01, // must have valid player / will by synchronised
107 PF_PLAYING = 0x02, // must be in playing state 108 PF_PLAYING = 0x02, // must be in playing state
108 PF_COMMAND0 = 0x04, // command starts at offset 0 109 PF_COMMAND = 0x04, // is a user command
109 PF_COMMAND6 = 0x08, // command starts at offset 6
110}; 110};
111 111
112// face types. bit 0 means "has meta info prepended" 112// face types. bit 0 means "has meta info prepended"
113enum { 113enum {
114 FT_FACE = 0 * 2 + 0, // faces (images) 114 FT_IMAGE = 0 * 2 + 0, // images
115 FT_MUSIC = 1 * 2 + 1, // background music 115 FT_MUSIC = 1 * 2 + 1, // background music
116 FT_SOUND = 2 * 2 + 1, // effects 116 FT_SOUND = 2 * 2 + 1, // effects
117 FT_RSRC = 3 * 2 + 0, // generic data files 117 FT_RSRC = 3 * 2 + 0, // generic data files
118 FT_NUM, 118 FT_NUM,
119}; 119};
150 unsigned int inbuf_len; // number of bytes valid in inbuf 150 unsigned int inbuf_len; // number of bytes valid in inbuf
151 statsinfo stats; 151 statsinfo stats;
152 object_vector_index ACC (RO, active); 152 object_vector_index ACC (RO, active);
153 player_ptr ACC (RO, pl); 153 player_ptr ACC (RO, pl);
154 154
155 char *ACC (RW, host); /* Which host it is connected from (ip address) */ 155 char *ACC (RW, host); /* Which host it is connected from (ip:port) */
156 uint8 ACC (RW, state); /* Input state of the player (name, password, etc */ 156 uint8 ACC (RW, state); /* Input state of the player (name, password, etc */
157 157
158 sint8 ACC (RW, last_level); /* Last level we sent to client */ 158 sint8 ACC (RW, last_level); /* Last level we sent to client */
159 uint16 ACC (RW, last_flags); /* fire/run on flags for last tick */ 159 uint16 ACC (RW, last_flags); /* fire/run on flags for last tick */
160 float ACC (RW, last_weapon_sp); /* if diff than weapon_sp, update client */ 160 float ACC (RW, last_weapon_sp); /* if diff than weapon_sp, update client */
167 float ACC (RW, last_speed); /* Last speed as sent to client */ 167 float ACC (RW, last_speed); /* Last speed as sent to client */
168 sint16 ACC (RW, last_resist[NROFATTACKS]);/* last resist values sent to client */ 168 sint16 ACC (RW, last_resist[NROFATTACKS]);/* last resist values sent to client */
169 sint64 ACC (RW, last_skill_exp[CS_NUM_SKILLS]);/* shadow register. if != exp. obj update client */ 169 sint64 ACC (RW, last_skill_exp[CS_NUM_SKILLS]);/* shadow register. if != exp. obj update client */
170 170
171 bool ACC (RW, afk); /* player is afk */ 171 bool ACC (RW, afk); /* player is afk */
172 bool ACC (RW, sent_scroll); 172 bool ACC (RW, sent_scroll);
173 bool ACC (RW, sound); /* does the client want sound */ 173 bool ACC (RW, sound); /* does the client want sound */
174 bool ACC (RW, bumpmsg); /* give message when bumping into walls */ 174 bool ACC (RW, bumpmsg); /* give message when bumping into walls */
175 175
176 bool ACC (RW, plugincmd); // extend the protocol through a plug-in */ 176 bool ACC (RW, plugincmd); // extend the protocol through a plug-in */
177 bool ACC (RW, mapinfocmd); // return map info and send map change info 177 bool ACC (RW, mapinfocmd); // return map info and send map change info
178 uint8_t ACC (RW, extcmd); // call into extensions/plugins 178 uint8 ACC (RW, extcmd); // call into extensions/plugins
179 bool ACC (RW, need_delinv0); /* If true, we need to delinv 0 before sending new floorbox */ 179 bool ACC (RW, need_delinv0); /* If true, we need to delinv 0 before sending new floorbox */
180 180
181 bool ACC (RW, update_look); /* If true, we need to send the look window */ 181 bool ACC (RW, update_look); /* If true, we need to send the look window */
182 bool ACC (RW, update_spells); // If true, we need to esrv_update_spells 182 bool ACC (RW, update_spells); // If true, we need to esrv_update_spells
183 bool ACC (RW, has_readable_type); /* If true client accept additional text information */ 183 bool ACC (RW, has_readable_type); /* If true client accept additional text information */
184 bool ACC (RW, monitor_spells); /* Client wishes to be informed when their spell list changes */ 184 uint8 ACC (RW, monitor_spells); /* Client wishes to be informed when their spell list changes */
185 185
186 bool ACC (RW, smoothing); // deliantra-style smoothing 186 bool ACC (RW, smoothing); // deliantra-style smoothing
187 bool ACC (RW, force_newmap); // force a newmap before next map update 187 bool ACC (RW, force_newmap); // force a newmap before next map update
188 uint16 ACC (RW, look_position); /* start of drawing of look window */ 188 uint16 ACC (RW, look_position); /* start of drawing of look window */
189 uint16 ACC (RW, mss); // likely tcp maximum segment size 189 uint16 ACC (RW, mss); // likely tcp maximum segment size
190 uint8 ACC (RW, mapx), ACC (RW, mapy); /* How large a map the client wants */ 190 uint8 ACC (RW, mapx), ACC (RW, mapy); /* How large a map the client wants */
191 uint8 ACC (RW, itemcmd); /* What version of the 'item' protocol command to use */ 191 uint8 ACC (RW, itemcmd); /* What version of the 'item' protocol command to use */
192 uint8 ACC (RW, faceset); // CF+ selected faceset 192 uint8 ACC (RW, tileset); // selected tileset
193 uint8 ACC (RW, ws_version); // websocket protocol versio for framing 193 uint8 ACC (RW, ws_version); // websocket protocol versio for framing
194 194
195 maptile_ptr ACC (RW, current_map); // CF+ last/current player map 195 maptile_ptr ACC (RW, current_map); // last/current player map
196 region_ptr ACC (RW, current_region); // CF+ last/current player region 196 region_ptr ACC (RW, current_region); // last/current player region
197 int ACC (RW, current_x), ACC (RW, current_y); // CF+ last/current map position 197 int ACC (RW, current_x), ACC (RW, current_y); // CF+ last/current map position
198 198
199 tstamp ACC (RW, last_send); // last data send on socket. 199 tstamp ACC (RW, last_send); // last data send on socket.
200 200
201 float ACC (RW, socket_timeout); /* after how many seconds of no ack do we declare dead */ 201 float ACC (RW, socket_timeout); /* after how many seconds of no ack do we declare dead */
217 void mapinfo_queue_clear (); 217 void mapinfo_queue_clear ();
218 void mapinfo_queue_run (); 218 void mapinfo_queue_run ();
219 bool mapinfo_try (char *buf); 219 bool mapinfo_try (char *buf);
220 220
221 struct ixsend { 221 struct ixsend {
222 int16_t pri; // higher means faces are sent earlier, default 0 222 sint16 pri; // higher means faces are sent earlier, default 0
223 faceidx idx; 223 faceidx idx;
224 uint32_t ofs; // if != 0, need to send remaining bytes of partial_face 224 uint32 ofs; // if != 0, need to send remaining bytes of partial_face
225 refcnt_buf data; 225 uint8 *data;
226 SV *data_sv;
226 }; 227 };
227 std::vector<ixsend, slice_allocator<ixsend> > ixface; // which faces to send to the client using ix 228 std::vector<ixsend, slice_allocator<ixsend> > ixface; // which faces to send to the client using ix
229 MTH void ix_send (faceidx idx, sint16 pri, SV *data_sv); // keeps a copy of data_sv
230 void ix_pop (); // pops topmost ixsend
228 231
229 std::vector<faceidx, slice_allocator<faceidx> > fxface; // which faces to send using fx 232 std::vector<faceidx, slice_allocator<faceidx> > fxface; // which faces to send using fx
230 MTH void flush_fx (); // send fx if required 233 MTH void flush_fx (); // send fx if required
231 234
232 MTH void invalidate_face (faceidx idx); 235 MTH void invalidate_face (faceidx idx);
292 void send_raw (void *buf_, int len); 295 void send_raw (void *buf_, int len);
293 296
294 void send (void *buf_, int len); 297 void send (void *buf_, int len);
295 void send_packet (const_octet_string buf); 298 void send_packet (const_octet_string buf);
296 void send_packet (const_octet_string buf, int len); 299 void send_packet (const_octet_string buf, int len);
297 void send_packet_printf (const_utf8_string format, ...) attribute ((format (printf, 2, 3))); 300 void send_packet_printf (const_utf8_string format, ...) ecb_attribute ((format (printf, 2, 3)));
298 void send_packet (packet &sl); 301 void send_packet (packet &sl);
299
300 void send_drawinfo (const_utf8_string msg, int flags = NDI_BLACK);
301 302
302 MTH void send_face (faceidx facenum, int pri = 0); 303 MTH void send_face (faceidx facenum, int pri = 0);
303 MTH void send_faces (object *ob); 304 MTH void send_faces (object *ob);
304 MTH void send_animation (short anim_num); 305 MTH void send_animation (short anim_num);
305 void send_msg (int color, const_utf8_string type, const_utf8_string msg); 306 void send_msg (int color, const_utf8_string type, const_utf8_string msg);
364 statementvar (client *, var, clients [_i]) 365 statementvar (client *, var, clients [_i])
365 366
366// returns true when the message needs special (read: perl) treatment 367// returns true when the message needs special (read: perl) treatment
367static inline bool 368static inline bool
368msg_is_special (const_any_string msg, bool nl_special = true) 369msg_is_special (const_any_string msg, bool nl_special = true)
369{ 370{
370 return msg [strcspn (msg, nl_special ? "<&\n" : "<&")]; 371 return msg [strcspn (msg, nl_special ? "<&\n" : "<&")];
371} 372}
372 373
373#endif 374#endif
374 375

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines