--- deliantra/server/socket/info.C 2006/12/21 06:12:37 1.22 +++ deliantra/server/socket/info.C 2007/01/19 17:50:11 1.32 @@ -1,7 +1,7 @@ - /* CrossFire, A Multiplayer game for X-windows + Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team Copyright (C) 2002 Mark Wedel & Crossfire Development Team Copyright (C) 1992 Frank Tore Johansen @@ -85,7 +85,7 @@ return; if (pl->type == PLAYER) - esrv_print_msg (pl->contr->socket, colr, (char *) tmp); + esrv_print_msg (pl->contr->ns, colr, (char *) tmp); } /** @@ -187,29 +187,19 @@ { if (flags & NDI_ALL) { - player *tmppl; - - for (tmppl = first_player; tmppl != NULL; tmppl = tmppl->next) - new_draw_info ((flags & ~NDI_ALL), pri, tmppl->ob, buf); + for_all_players (pl) + new_draw_info (flags & ~NDI_ALL, pri, pl->ob, buf); return; } - if (!pl || (pl->type == PLAYER && pl->contr == NULL)) - { - /* Write to the socket? */ - print_message (0, NULL, buf); - return; - } - - if (pl->type != PLAYER) + if (!pl || pl->type != PLAYER || !pl->contr || !pl->contr->ns) return; if (pri >= pl->contr->listening) return; if ((flags & NDI_COLOR_MASK) == NDI_BLACK && !(flags & NDI_UNIQUE)) - /* following prints stuff out, as appropriate */ check_output_buffers (pl, buf); else print_message (flags & NDI_COLOR_MASK, pl, buf); @@ -229,11 +219,8 @@ char buf[HUGE_BUF]; va_list ap; - va_start (ap, format); - vsnprintf (buf, HUGE_BUF, format, ap); - va_end (ap); new_draw_info (flags, pri, pl, buf); @@ -249,7 +236,7 @@ if (pri >= pl->contr->listening) return; - if (!CLIENT_SUPPORT_READABLES (pl->contr->socket, type)) + if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) { char *buf = (char *) malloc (strlen (oldmessage == NULL ? message : oldmessage) + 1); @@ -264,13 +251,12 @@ } } else - esrv_print_ext_msg (pl->contr->socket, flags & NDI_COLOR_MASK, type, subtype, message); + esrv_print_ext_msg (pl->contr->ns, flags & NDI_COLOR_MASK, type, subtype, message); } void draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *old_format, char *new_format, ...) { - char buf[HUGE_BUF]; if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) @@ -279,7 +265,7 @@ if (pri >= pl->contr->listening) return; - if (!CLIENT_SUPPORT_READABLES (pl->contr->socket, type)) + if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) { va_list ap; @@ -298,7 +284,7 @@ vsnprintf (buf, HUGE_BUF, new_format, ap); va_end (ap); strip_media_tag (buf); - esrv_print_ext_msg (pl->contr->socket, flags & NDI_COLOR_MASK, type, subtype, buf); + esrv_print_ext_msg (pl->contr->ns, flags & NDI_COLOR_MASK, type, subtype, buf); } } @@ -311,11 +297,9 @@ { player *pl; - for (pl = first_player; pl != NULL; pl = pl->next) + for_all_players (pl) if (pl->ob != NULL && pl->ob->map == map && pl->ob != op) - { - new_draw_info (color, 0, pl->ob, str); - } + new_draw_info (color, 0, pl->ob, str); } /** @@ -327,11 +311,9 @@ { player *pl; - for (pl = first_player; pl != NULL; pl = pl->next) + for_all_players (pl) if (pl->ob != NULL && pl->ob->map == map && pl->ob != op1 && pl->ob != op2) - { - new_draw_info (color, 0, pl->ob, str); - } + new_draw_info (color, 0, pl->ob, str); } /** @@ -343,14 +325,11 @@ { player *pl; - for (pl = first_player; pl != NULL; pl = pl->next) + for_all_players (pl) if (pl->ob != NULL && pl->ob->map == map) - { - new_draw_info (color, 0, pl->ob, str); - } + new_draw_info (color, 0, pl->ob, str); } - /** * This does nothing now. However, in theory, we should probably send * something to the client and let the client figure out how it might want @@ -466,7 +445,7 @@ int x, y, dx, dy, mflags; sint16 nx, ny; maptile *mp; - New_Face *f; + facetile *f; for (dx = -1; dx <= 1; dx++) { @@ -520,7 +499,7 @@ * * This function examines the map the player is on, and determines what * is visible. 2 is set for walls or objects that blocks view. 1 - * is for open spaces. map_mark should already have been initialized + * is for open spaces. map_mark should already have been initialised * to zero before this is called. * strength is an initial strength*2 rectangular area that we automatically * see in/penetrate through. @@ -532,7 +511,7 @@ int x, y, mflags; sint16 nx, ny; maptile *mp; - New_Face *f; + facetile *f; for (x = -strength; x < strength; x++) { @@ -572,7 +551,6 @@ * * Mark Wedel */ - void draw_magic_map (object *pl) { @@ -600,7 +578,7 @@ for (int x = 0; x < MAGIC_MAP_SIZE; x++) for (int y = 0; y < MAGIC_MAP_SIZE; y++) - if (map_mark[x + MAP_WIDTH (pl->map) * y] | FACE_FLOOR) + if (map_mark[x + pl->map->width * y] | FACE_FLOOR) { xmin = x < xmin ? x : xmin; xmax = x > xmax ? x : xmax; @@ -616,7 +594,7 @@ for (int x = xmin; x <= xmax; x++) sl << uint8 (map_mark[x + MAGIC_MAP_SIZE * y] & ~FACE_FLOOR); - pl->contr->socket->send_packet (sl); + pl->contr->ns->send_packet (sl); free (map_mark); }