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.6 by pippijn, Mon Jan 15 21:06:18 2007 UTC

1
2/* 1/*
3 * static char *rcsid_friend_c = 2 * CrossFire, A Multiplayer game for X-windows
4 * "$Id: links.C,v 1.2 2006/09/10 16:00:23 root Exp $"; 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
5 * Copyright (C) 1992 Frank Tore Johansen
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * The author can be reached via e-mail to frankj@ifi.uio.no.
5 */ 22 */
6 23
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
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
33 * a pointer to it. 28 * a pointer to it.
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