--- deliantra/server/socket/info.C 2006/09/19 10:21:58 1.10 +++ deliantra/server/socket/info.C 2006/09/20 21:53:50 1.11 @@ -98,10 +98,8 @@ print_message (int colr, const object *pl, const char *tmp) { - if (tmp == (char *) NULL) - { - tmp = "[NULL]"; - } + if (!tmp) + tmp = "[NULL]"; if (!pl || (pl->type == PLAYER && pl->contr == NULL)) return; @@ -113,7 +111,6 @@ } } - /** * Prints out the contents of specified buffer structures, * and clears the string. @@ -224,38 +221,27 @@ for (tmppl = first_player; tmppl != NULL; tmppl = tmppl->next) new_draw_info ((flags & ~NDI_ALL), pri, tmppl->ob, buf); - for (i = 1; i < socket_info.allocated_sockets; i++) - { - if (init_sockets[i].status == Ns_Old && init_sockets[i].old_mode != Old_Listen && pri < 10) - { - cs_write_string (&init_sockets[i], buf, strlen (buf)); - /* Most messages don't have a newline, so add one */ - cs_write_string (&init_sockets[i], "\n", 1); - } - } - return; } + if (!pl || (pl->type == PLAYER && pl->contr == NULL)) { /* Write to the socket? */ print_message (0, NULL, buf); return; } + if (pl->type != PLAYER) 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); - } + /* following prints stuff out, as appropriate */ + check_output_buffers (pl, buf); else - { - print_message (flags & NDI_COLOR_MASK, pl, buf); - } + print_message (flags & NDI_COLOR_MASK, pl, buf); } /** @@ -690,19 +676,9 @@ char buf[MAX_BUF]; if (With != NULL) - { - snprintf (buf, MAX_BUF, "%s\t%s\t%d\t%s\t%d\n", Who, What, WhatType, With, WithType); - } + snprintf (buf, MAX_BUF, "%s\t%s\t%d\t%s\t%d\n", Who, What, WhatType, With, WithType); else - { - snprintf (buf, MAX_BUF, "%s\t%s\t%d\n", Who, What, WhatType); - } + snprintf (buf, MAX_BUF, "%s\t%s\t%d\n", Who, What, WhatType); + len = strlen (buf); - for (i = 1; i < socket_info.allocated_sockets; i++) - { - if (init_sockets[i].old_mode == Old_Listen) - { - cs_write_string (&init_sockets[i], buf, len); - } - } }