1 |
elmex |
1.1 |
/* |
2 |
root |
1.10 |
* This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 |
root |
1.19 |
* |
4 |
root |
1.21 |
* Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team |
5 |
root |
1.20 |
* Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
6 |
root |
1.15 |
* Copyright (©) 1992 Frank Tore Johansen |
7 |
root |
1.19 |
* |
8 |
root |
1.13 |
* 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 |
root |
1.19 |
* |
13 |
root |
1.9 |
* 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 |
root |
1.19 |
* |
18 |
root |
1.13 |
* 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 |
root |
1.19 |
* |
22 |
root |
1.10 |
* The authors can be reached via e-mail to <support@deliantra.net> |
23 |
pippijn |
1.6 |
*/ |
24 |
root |
1.8 |
|
25 |
elmex |
1.1 |
#include <global.h> |
26 |
|
|
|
27 |
|
|
/* |
28 |
|
|
* Allocates a new objectlink structure, initialises it, and returns |
29 |
|
|
* a pointer to it. |
30 |
|
|
*/ |
31 |
|
|
|
32 |
root |
1.2 |
objectlink * |
33 |
root |
1.14 |
get_objectlink () |
34 |
root |
1.2 |
{ |
35 |
root |
1.4 |
objectlink *ol = new objectlink; |
36 |
root |
1.2 |
|
37 |
root |
1.12 |
ol->ob = 0; |
38 |
root |
1.4 |
ol->next = 0; |
39 |
root |
1.12 |
|
40 |
elmex |
1.1 |
return ol; |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
/* |
44 |
|
|
* Allocates a new oblinkpt structure, initialises it, and returns |
45 |
|
|
* a pointer to it. |
46 |
|
|
*/ |
47 |
|
|
|
48 |
root |
1.2 |
oblinkpt * |
49 |
root |
1.14 |
get_objectlinkpt () |
50 |
root |
1.2 |
{ |
51 |
root |
1.4 |
oblinkpt *obp = new oblinkpt; |
52 |
root |
1.2 |
|
53 |
root |
1.4 |
obp->link = 0; |
54 |
|
|
obp->next = 0; |
55 |
root |
1.12 |
|
56 |
elmex |
1.1 |
return obp; |
57 |
|
|
} |
58 |
|
|
|
59 |
|
|
/* |
60 |
|
|
* Recursively frees all objectlinks |
61 |
|
|
*/ |
62 |
|
|
|
63 |
root |
1.2 |
void |
64 |
root |
1.12 |
free_objectlink (objectlink *ol) |
65 |
root |
1.2 |
{ |
66 |
elmex |
1.1 |
if (ol->next) |
67 |
root |
1.2 |
free_objectlink (ol->next); |
68 |
root |
1.4 |
|
69 |
|
|
delete ol; |
70 |
elmex |
1.1 |
} |
71 |
|
|
|
72 |
|
|
/* |
73 |
|
|
* Recursively frees all linked list of objectlink pointers |
74 |
|
|
*/ |
75 |
|
|
|
76 |
root |
1.2 |
void |
77 |
root |
1.4 |
free_objectlinkpt (oblinkpt *obp) |
78 |
root |
1.2 |
{ |
79 |
elmex |
1.1 |
if (obp->next) |
80 |
root |
1.2 |
free_objectlinkpt (obp->next); |
81 |
root |
1.4 |
|
82 |
elmex |
1.1 |
if (obp->link) |
83 |
root |
1.2 |
free_objectlink (obp->link); |
84 |
root |
1.4 |
|
85 |
|
|
delete obp; |
86 |
elmex |
1.1 |
} |
87 |
root |
1.12 |
|