1 |
/* |
2 |
* This file is part of Deliantra, the Roguelike Realtime MMORPG. |
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> |
23 |
*/ |
24 |
|
25 |
#include <global.h> |
26 |
|
27 |
/* |
28 |
* Allocates a new objectlink structure, initialises it, and returns |
29 |
* a pointer to it. |
30 |
*/ |
31 |
|
32 |
objectlink * |
33 |
get_objectlink () |
34 |
{ |
35 |
objectlink *ol = new objectlink; |
36 |
|
37 |
ol->ob = 0; |
38 |
ol->next = 0; |
39 |
|
40 |
return ol; |
41 |
} |
42 |
|
43 |
/* |
44 |
* Allocates a new oblinkpt structure, initialises it, and returns |
45 |
* a pointer to it. |
46 |
*/ |
47 |
|
48 |
oblinkpt * |
49 |
get_objectlinkpt () |
50 |
{ |
51 |
oblinkpt *obp = new oblinkpt; |
52 |
|
53 |
obp->link = 0; |
54 |
obp->next = 0; |
55 |
|
56 |
return obp; |
57 |
} |
58 |
|
59 |
/* |
60 |
* Recursively frees all objectlinks |
61 |
*/ |
62 |
|
63 |
void |
64 |
free_objectlink (objectlink *ol) |
65 |
{ |
66 |
if (ol->next) |
67 |
free_objectlink (ol->next); |
68 |
|
69 |
delete ol; |
70 |
} |
71 |
|
72 |
/* |
73 |
* Recursively frees all linked list of objectlink pointers |
74 |
*/ |
75 |
|
76 |
void |
77 |
free_objectlinkpt (oblinkpt *obp) |
78 |
{ |
79 |
if (obp->next) |
80 |
free_objectlinkpt (obp->next); |
81 |
|
82 |
if (obp->link) |
83 |
free_objectlink (obp->link); |
84 |
|
85 |
delete obp; |
86 |
} |
87 |
|