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

Comparing deliantra/server/common/links.C (file contents):
Revision 1.2 by root, Sun Sep 10 16:00:23 2006 UTC vs.
Revision 1.8 by root, Mon May 28 21:21:40 2007 UTC

1
2/* 1/*
3 * static char *rcsid_friend_c = 2 * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game.
4 * "$Id: links.C,v 1.2 2006/09/10 16:00:23 root Exp $"; 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
5 * Copyright (©) 1992,2007 Frank Tore Johansen
6 *
7 * Crossfire TRT is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51
19 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 * The authors can be reached via e-mail to <crossfire@schmorp.de>
5 */ 22 */
6
7/*
8 CrossFire, A Multiplayer game for X-windows
9
10 Copyright (C) 1992 Frank Tore Johansen
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25
26 The author can be reached via e-mail to frankj@ifi.uio.no.
27*/
28 23
29#include <global.h> 24#include <global.h>
30 25
31/* 26/*
32 * Allocates a new objectlink structure, initialises it, and returns 27 * Allocates a new objectlink structure, initialises it, and returns
34 */ 29 */
35 30
36objectlink * 31objectlink *
37get_objectlink (void) 32get_objectlink (void)
38{ 33{
39 objectlink *ol = (objectlink *) CALLOC (1, sizeof (objectlink)); 34 objectlink *ol = new objectlink;
40 35
41 ol->ob = NULL; 36 ol->ob = 0;
42 ol->next = NULL; 37 ol->next = 0;
43 ol->id = 0;
44 return ol; 38 return ol;
45} 39}
46 40
47/* 41/*
48 * Allocates a new oblinkpt structure, initialises it, and returns 42 * Allocates a new oblinkpt structure, initialises it, and returns
50 */ 44 */
51 45
52oblinkpt * 46oblinkpt *
53get_objectlinkpt (void) 47get_objectlinkpt (void)
54{ 48{
55 oblinkpt *obp = (oblinkpt *) malloc (sizeof (oblinkpt)); 49 oblinkpt *obp = new oblinkpt;
56 50
57 obp->link = NULL; 51 obp->link = 0;
58 obp->next = NULL; 52 obp->next = 0;
59 obp->value = 0; 53 obp->value = 0;
60 return obp; 54 return obp;
61} 55}
62 56
63/* 57/*
67void 61void
68free_objectlink (objectlink * ol) 62free_objectlink (objectlink * ol)
69{ 63{
70 if (ol->next) 64 if (ol->next)
71 free_objectlink (ol->next); 65 free_objectlink (ol->next);
72 free (ol); 66
67 delete ol;
73} 68}
74 69
75/* 70/*
76 * Recursively frees all linked list of objectlink pointers 71 * Recursively frees all linked list of objectlink pointers
77 */ 72 */
78 73
79void 74void
80free_objectlinkpt (oblinkpt * obp) 75free_objectlinkpt (oblinkpt *obp)
81{ 76{
82 if (obp->next) 77 if (obp->next)
83 free_objectlinkpt (obp->next); 78 free_objectlinkpt (obp->next);
79
84 if (obp->link) 80 if (obp->link)
85 free_objectlink (obp->link); 81 free_objectlink (obp->link);
86 free (obp); 82
83 delete obp;
87} 84}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines