ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/info.C
(Generate patch)

Comparing deliantra/server/socket/info.C (file contents):
Revision 1.59 by root, Fri Mar 26 00:59:22 2010 UTC vs.
Revision 1.69 by root, Sat Nov 17 23:40:05 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 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 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 6 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 7 * Copyright (©) 1992 Frank Tore Johansen
7 * 8 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 9 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 10 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 11 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 12 * option) any later version.
12 * 13 *
13 * This program is distributed in the hope that it will be useful, 14 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 17 * GNU General Public License for more details.
17 * 18 *
18 * You should have received a copy of the Affero GNU General Public License 19 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see 20 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 21 * <http://www.gnu.org/licenses/>.
21 * 22 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 23 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 24 */
24 25
25/** 26/**
26 * \file 27 * \file
39#include <skills.h> 40#include <skills.h>
40 41
41#include <cstring> 42#include <cstring>
42 43
43/** 44/**
44 * Draws a normal message on the client. It is pretty 45 * Draws a normal message on the client. It is pretty
45 * much the same thing as the draw_info above, but takes a color 46 * much the same thing as the draw_info above, but takes a color
46 * parameter. the esrv_drawinfo functions should probably be 47 * parameter. the esrv_drawinfo functions should probably be
47 * replaced with this, just using black as the color. 48 * replaced with this, just using black as the color.
48 */ 49 */
49static void 50static void
93 for (msg_buf *buf = msgbuf; buf < msgbuf + MSG_BUF_COUNT; ++buf) 94 for (msg_buf *buf = msgbuf; buf < msgbuf + MSG_BUF_COUNT; ++buf)
94 { 95 {
95 if (len == buf->len && !memcmp (msg, buf->msg, len)) 96 if (len == buf->len && !memcmp (msg, buf->msg, len))
96 { 97 {
97 // found matching buf, see if expired 98 // found matching buf, see if expired
98 if (buf->expire <= pticks || !buf->count) 99 if (buf->expire <= server_tick || !buf->count)
99 { 100 {
100 // yes, take over matching buffer, print 101 // yes, take over matching buffer, print
101 buf->expire = pticks + pl->outputs_sync; 102 buf->expire = server_tick + pl->outputs_sync;
102 buf->count = pl->outputs_count; 103 buf->count = pl->outputs_count;
103 104
104 return false; 105 return false;
105 } 106 }
106 107
112 if (lru->expire > buf->expire) 113 if (lru->expire > buf->expire)
113 lru = buf; 114 lru = buf;
114 } 115 }
115 116
116 // new message, evoke oldest buffer 117 // new message, evoke oldest buffer
117 lru->expire = pticks + pl->outputs_sync; 118 lru->expire = server_tick + pl->outputs_sync;
118 lru->count = pl->outputs_count; 119 lru->count = pl->outputs_count;
119 lru->len = len; 120 lru->len = len;
120 memcpy (lru->msg, msg, len); 121 memcpy (lru->msg, msg, len);
121 122
122 return false; 123 return false;
339 * Mark Wedel 340 * Mark Wedel
340 */ 341 */
341void 342void
342draw_magic_map (object *pl) 343draw_magic_map (object *pl)
343{ 344{
344 char *map_mark = (char *)calloc (MAGIC_MAP_SIZE * MAGIC_MAP_SIZE, 1);
345 int xmin, xmax, ymin, ymax; 345 int xmin, xmax, ymin, ymax;
346 346
347 if (pl->type != PLAYER) 347 if (pl->type != PLAYER)
348 { 348 {
349 LOG (llevError, "Non player object called draw_map.\n"); 349 LOG (llevError, "Non player object called draw_map.\n");
350 return; 350 return;
351 } 351 }
352
353 char *map_mark = (char *)calloc (MAGIC_MAP_SIZE * MAGIC_MAP_SIZE, 1);
354 assert(("Out of memory!", map_mark != NULL));
352 355
353 /* First, we figure out what spaces are 'reachable' by the player */ 356 /* First, we figure out what spaces are 'reachable' by the player */
354 magic_mapping_mark (pl, map_mark, 3); 357 magic_mapping_mark (pl, map_mark, 3);
355 358
356 /* We now go through and figure out what spaces have been 359 /* We now go through and figure out what spaces have been

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines