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.1 by elmex, Sun Aug 13 17:16:00 2006 UTC vs.
Revision 1.21 by root, Sat Nov 17 23:40:00 2018 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines