… | |
… | |
83 | |
83 | |
84 | if (!pl || (pl->type == PLAYER && pl->contr == NULL)) |
84 | if (!pl || (pl->type == PLAYER && pl->contr == NULL)) |
85 | return; |
85 | return; |
86 | |
86 | |
87 | if (pl->type == PLAYER) |
87 | if (pl->type == PLAYER) |
88 | esrv_print_msg (pl->contr->socket, colr, (char *) tmp); |
88 | esrv_print_msg (pl->contr->ns, colr, (char *) tmp); |
89 | } |
89 | } |
90 | |
90 | |
91 | /** |
91 | /** |
92 | * Prints out the contents of specified buffer structures, |
92 | * Prints out the contents of specified buffer structures, |
93 | * and clears the string. |
93 | * and clears the string. |
… | |
… | |
185 | void |
185 | void |
186 | new_draw_info (int flags, int pri, const object *pl, const char *buf) |
186 | new_draw_info (int flags, int pri, const object *pl, const char *buf) |
187 | { |
187 | { |
188 | if (flags & NDI_ALL) |
188 | if (flags & NDI_ALL) |
189 | { |
189 | { |
190 | player *tmppl; |
190 | for_all_players (pl) |
191 | |
|
|
192 | for (tmppl = first_player; tmppl != NULL; tmppl = tmppl->next) |
|
|
193 | new_draw_info ((flags & ~NDI_ALL), pri, tmppl->ob, buf); |
191 | new_draw_info (flags & ~NDI_ALL, pri, pl->ob, buf); |
194 | |
192 | |
195 | return; |
193 | return; |
196 | } |
194 | } |
197 | |
195 | |
198 | if (!pl || (pl->type == PLAYER && pl->contr == NULL)) |
196 | if (!pl || (pl->type == PLAYER && pl->contr == NULL)) |
… | |
… | |
247 | return; |
245 | return; |
248 | |
246 | |
249 | if (pri >= pl->contr->listening) |
247 | if (pri >= pl->contr->listening) |
250 | return; |
248 | return; |
251 | |
249 | |
252 | if (!CLIENT_SUPPORT_READABLES (pl->contr->socket, type)) |
250 | if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) |
253 | { |
251 | { |
254 | char *buf = (char *) malloc (strlen (oldmessage == NULL ? message : oldmessage) + 1); |
252 | char *buf = (char *) malloc (strlen (oldmessage == NULL ? message : oldmessage) + 1); |
255 | |
253 | |
256 | if (buf == NULL) |
254 | if (buf == NULL) |
257 | LOG (llevError, "info::draw_ext_info -> Out of memory!"); |
255 | LOG (llevError, "info::draw_ext_info -> Out of memory!"); |
… | |
… | |
262 | new_draw_info (flags, pri, pl, buf); |
260 | new_draw_info (flags, pri, pl, buf); |
263 | free (buf); |
261 | free (buf); |
264 | } |
262 | } |
265 | } |
263 | } |
266 | else |
264 | else |
267 | esrv_print_ext_msg (pl->contr->socket, flags & NDI_COLOR_MASK, type, subtype, message); |
265 | esrv_print_ext_msg (pl->contr->ns, flags & NDI_COLOR_MASK, type, subtype, message); |
268 | } |
266 | } |
269 | |
267 | |
270 | void |
268 | void |
271 | draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *old_format, char *new_format, ...) |
269 | draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *old_format, char *new_format, ...) |
272 | { |
270 | { |
… | |
… | |
277 | return; |
275 | return; |
278 | |
276 | |
279 | if (pri >= pl->contr->listening) |
277 | if (pri >= pl->contr->listening) |
280 | return; |
278 | return; |
281 | |
279 | |
282 | if (!CLIENT_SUPPORT_READABLES (pl->contr->socket, type)) |
280 | if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) |
283 | { |
281 | { |
284 | va_list ap; |
282 | va_list ap; |
285 | |
283 | |
286 | LOG (llevDebug, "Non supported extension text type for client.\n"); |
284 | LOG (llevDebug, "Non supported extension text type for client.\n"); |
287 | va_start (ap, new_format); |
285 | va_start (ap, new_format); |
… | |
… | |
296 | |
294 | |
297 | va_start (ap, new_format); |
295 | va_start (ap, new_format); |
298 | vsnprintf (buf, HUGE_BUF, new_format, ap); |
296 | vsnprintf (buf, HUGE_BUF, new_format, ap); |
299 | va_end (ap); |
297 | va_end (ap); |
300 | strip_media_tag (buf); |
298 | strip_media_tag (buf); |
301 | esrv_print_ext_msg (pl->contr->socket, flags & NDI_COLOR_MASK, type, subtype, buf); |
299 | esrv_print_ext_msg (pl->contr->ns, flags & NDI_COLOR_MASK, type, subtype, buf); |
302 | } |
300 | } |
303 | } |
301 | } |
304 | |
302 | |
305 | /** |
303 | /** |
306 | * Writes to everyone on the map *except* op. This is useful for emotions. |
304 | * Writes to everyone on the map *except* op. This is useful for emotions. |
… | |
… | |
309 | void |
307 | void |
310 | new_info_map_except (int color, maptile * map, object *op, const char *str) |
308 | new_info_map_except (int color, maptile * map, object *op, const char *str) |
311 | { |
309 | { |
312 | player *pl; |
310 | player *pl; |
313 | |
311 | |
314 | for (pl = first_player; pl != NULL; pl = pl->next) |
312 | for_all_players (pl) |
315 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op) |
313 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op) |
316 | { |
314 | { |
317 | new_draw_info (color, 0, pl->ob, str); |
315 | new_draw_info (color, 0, pl->ob, str); |
318 | } |
316 | } |
319 | } |
317 | } |
… | |
… | |
325 | void |
323 | void |
326 | new_info_map_except2 (int color, maptile * map, object *op1, object *op2, const char *str) |
324 | new_info_map_except2 (int color, maptile * map, object *op1, object *op2, const char *str) |
327 | { |
325 | { |
328 | player *pl; |
326 | player *pl; |
329 | |
327 | |
330 | for (pl = first_player; pl != NULL; pl = pl->next) |
328 | for_all_players (pl) |
331 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op1 && pl->ob != op2) |
329 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op1 && pl->ob != op2) |
332 | { |
330 | { |
333 | new_draw_info (color, 0, pl->ob, str); |
331 | new_draw_info (color, 0, pl->ob, str); |
334 | } |
332 | } |
335 | } |
333 | } |
… | |
… | |
341 | void |
339 | void |
342 | new_info_map (int color, maptile * map, const char *str) |
340 | new_info_map (int color, maptile * map, const char *str) |
343 | { |
341 | { |
344 | player *pl; |
342 | player *pl; |
345 | |
343 | |
346 | for (pl = first_player; pl != NULL; pl = pl->next) |
344 | for_all_players (pl) |
347 | if (pl->ob != NULL && pl->ob->map == map) |
345 | if (pl->ob != NULL && pl->ob->map == map) |
348 | { |
346 | { |
349 | new_draw_info (color, 0, pl->ob, str); |
347 | new_draw_info (color, 0, pl->ob, str); |
350 | } |
348 | } |
351 | } |
349 | } |
… | |
… | |
598 | xmax = 0; |
596 | xmax = 0; |
599 | ymax = 0; |
597 | ymax = 0; |
600 | |
598 | |
601 | for (int x = 0; x < MAGIC_MAP_SIZE; x++) |
599 | for (int x = 0; x < MAGIC_MAP_SIZE; x++) |
602 | for (int y = 0; y < MAGIC_MAP_SIZE; y++) |
600 | for (int y = 0; y < MAGIC_MAP_SIZE; y++) |
603 | if (map_mark[x + MAP_WIDTH (pl->map) * y] | FACE_FLOOR) |
601 | if (map_mark[x + pl->map->width * y] | FACE_FLOOR) |
604 | { |
602 | { |
605 | xmin = x < xmin ? x : xmin; |
603 | xmin = x < xmin ? x : xmin; |
606 | xmax = x > xmax ? x : xmax; |
604 | xmax = x > xmax ? x : xmax; |
607 | ymin = y < ymin ? y : ymin; |
605 | ymin = y < ymin ? y : ymin; |
608 | ymax = y > ymax ? y : ymax; |
606 | ymax = y > ymax ? y : ymax; |
… | |
… | |
614 | |
612 | |
615 | for (int y = ymin; y <= ymax; y++) |
613 | for (int y = ymin; y <= ymax; y++) |
616 | for (int x = xmin; x <= xmax; x++) |
614 | for (int x = xmin; x <= xmax; x++) |
617 | sl << uint8 (map_mark[x + MAGIC_MAP_SIZE * y] & ~FACE_FLOOR); |
615 | sl << uint8 (map_mark[x + MAGIC_MAP_SIZE * y] & ~FACE_FLOOR); |
618 | |
616 | |
619 | pl->contr->socket->send_packet (sl); |
617 | pl->contr->ns->send_packet (sl); |
620 | |
618 | |
621 | free (map_mark); |
619 | free (map_mark); |
622 | } |
620 | } |
623 | |
621 | |
624 | /** |
622 | /** |