--- deliantra/server/socket/info.C 2009/11/06 13:07:28 1.56
+++ deliantra/server/socket/info.C 2012/10/29 23:55:57 1.66
@@ -1,24 +1,24 @@
/*
* This file is part of Deliantra, the Roguelike Realtime MMORPG.
- *
- * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
- * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
- * Copyright (©) 1992,2007 Frank Tore Johansen
- *
+ *
+ * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
+ * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
+ * Copyright (©) 1992 Frank Tore Johansen
+ *
* Deliantra is free software: you can redistribute it and/or modify it under
* the terms of the Affero GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the Affero GNU General Public License
* and the GNU General Public License along with this program. If not, see
* .
- *
+ *
* The authors can be reached via e-mail to
*/
@@ -53,21 +53,6 @@
}
/**
- * Draws an extended message on the client.
- * ns the socket to send message to
- * color color informations (used mainly if client does not support message type)
- * type,
- * subtype type and subtype of text message
- * intro Intro message to send with main message if client does not support the message type
- * message The main message
- */
-static void
-esrv_print_ext_msg (client *ns, int color, uint8 type, uint8 subtype, const char *message)
-{
- ns->send_packet_printf ("drawextinfo %d %u %u %s", color, type, subtype, message);
-}
-
-/**
* Frontend for esrv_print_msg
* \param colr message color
* \param pl player to send to. Can be NULL
@@ -110,10 +95,10 @@
if (len == buf->len && !memcmp (msg, buf->msg, len))
{
// found matching buf, see if expired
- if (buf->expire <= pticks || !buf->count)
+ if (buf->expire <= server_tick || !buf->count)
{
// yes, take over matching buffer, print
- buf->expire = pticks + pl->outputs_sync;
+ buf->expire = server_tick + pl->outputs_sync;
buf->count = pl->outputs_count;
return false;
@@ -129,7 +114,7 @@
}
// new message, evoke oldest buffer
- lru->expire = pticks + pl->outputs_sync;
+ lru->expire = server_tick + pl->outputs_sync;
lru->count = pl->outputs_count;
lru->len = len;
memcpy (lru->msg, msg, len);
@@ -186,55 +171,6 @@
va_end (ap);
}
-void
-draw_ext_info (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
-{
- if (!pl || (pl->type != PLAYER) || (pl->contr == NULL))
- return;
-
- if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type))
- {
- char *buf = (char *) malloc (strlen (oldmessage == NULL ? message : oldmessage) + 1);
-
- if (buf == NULL)
- LOG (llevError, "info::draw_ext_info -> Out of memory!");
- else
- {
- strcpy (buf, oldmessage == NULL ? message : oldmessage);
- strip_media_tag (buf);
- new_draw_info (flags, pri, pl, buf);
- free (buf);
- }
- }
- else
- 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, ...)
-{
- va_list ap;
- va_start (ap, new_format);
-
- if (!pl || !pl->is_player ())
- return;
-
- // TODO: just assume, and rip out?
- if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type))
- {
- LOG (llevDebug, "Non supported extension text type for client.\n");
- new_draw_info (flags, pri, pl, vformat (old_format, ap));
- }
- else
- {
- char *buf = vformat (new_format, ap);
- strip_media_tag (buf);
- esrv_print_ext_msg (pl->contr->ns, flags & NDI_COLOR_MASK, type, subtype, buf);
- }
-
- va_end (ap);
-}
-
/**
* Writes to everyone on the map *except* op. This is useful for emotions.
*/
@@ -247,17 +183,6 @@
}
/**
- * Writes to everyone on the map except op1 and op2
- */
-static void
-new_info_map_except2 (int color, maptile * map, object *op1, object *op2, const char *str)
-{
- for_all_players (pl)
- if (pl->ob->map == map && pl->ob != op1 && pl->ob != op2)
- new_draw_info (color, 0, pl->ob, str);
-}
-
-/**
* Writes to everyone on the specified map
*/
void
@@ -416,7 +341,6 @@
void
draw_magic_map (object *pl)
{
- char *map_mark = (char *)calloc (MAGIC_MAP_SIZE * MAGIC_MAP_SIZE, 1);
int xmin, xmax, ymin, ymax;
if (pl->type != PLAYER)
@@ -425,6 +349,9 @@
return;
}
+ char *map_mark = (char *)calloc (MAGIC_MAP_SIZE * MAGIC_MAP_SIZE, 1);
+ assert(("Out of memory!", map_mark != NULL));
+
/* First, we figure out what spaces are 'reachable' by the player */
magic_mapping_mark (pl, map_mark, 3);