| 1 |
elmex |
1.1 |
/* |
| 2 |
root |
1.10 |
* This file is part of Deliantra, the Roguelike Realtime MMORPG. |
| 3 |
pippijn |
1.6 |
* |
| 4 |
root |
1.17 |
* Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
| 5 |
root |
1.15 |
* Copyright (©) 1992 Frank Tore Johansen |
| 6 |
pippijn |
1.6 |
* |
| 7 |
root |
1.13 |
* Deliantra is free software: you can redistribute it and/or modify it under |
| 8 |
|
|
* the terms of the Affero GNU General Public License as published by the |
| 9 |
|
|
* Free Software Foundation, either version 3 of the License, or (at your |
| 10 |
|
|
* option) any later version. |
| 11 |
root |
1.8 |
* |
| 12 |
root |
1.9 |
* 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 |
root |
1.8 |
* |
| 17 |
root |
1.13 |
* You should have received a copy of the Affero GNU General Public License |
| 18 |
|
|
* and the GNU General Public License along with this program. If not, see |
| 19 |
|
|
* <http://www.gnu.org/licenses/>. |
| 20 |
root |
1.8 |
* |
| 21 |
root |
1.10 |
* The authors can be reached via e-mail to <support@deliantra.net> |
| 22 |
pippijn |
1.6 |
*/ |
| 23 |
root |
1.8 |
|
| 24 |
elmex |
1.1 |
#include <global.h> |
| 25 |
|
|
|
| 26 |
|
|
/* |
| 27 |
|
|
* Allocates a new objectlink structure, initialises it, and returns |
| 28 |
|
|
* a pointer to it. |
| 29 |
|
|
*/ |
| 30 |
|
|
|
| 31 |
root |
1.2 |
objectlink * |
| 32 |
root |
1.14 |
get_objectlink () |
| 33 |
root |
1.2 |
{ |
| 34 |
root |
1.4 |
objectlink *ol = new objectlink; |
| 35 |
root |
1.2 |
|
| 36 |
root |
1.12 |
ol->ob = 0; |
| 37 |
root |
1.4 |
ol->next = 0; |
| 38 |
root |
1.12 |
|
| 39 |
elmex |
1.1 |
return ol; |
| 40 |
|
|
} |
| 41 |
|
|
|
| 42 |
|
|
/* |
| 43 |
|
|
* Allocates a new oblinkpt structure, initialises it, and returns |
| 44 |
|
|
* a pointer to it. |
| 45 |
|
|
*/ |
| 46 |
|
|
|
| 47 |
root |
1.2 |
oblinkpt * |
| 48 |
root |
1.14 |
get_objectlinkpt () |
| 49 |
root |
1.2 |
{ |
| 50 |
root |
1.4 |
oblinkpt *obp = new oblinkpt; |
| 51 |
root |
1.2 |
|
| 52 |
root |
1.4 |
obp->link = 0; |
| 53 |
|
|
obp->next = 0; |
| 54 |
root |
1.12 |
|
| 55 |
elmex |
1.1 |
return obp; |
| 56 |
|
|
} |
| 57 |
|
|
|
| 58 |
|
|
/* |
| 59 |
|
|
* Recursively frees all objectlinks |
| 60 |
|
|
*/ |
| 61 |
|
|
|
| 62 |
root |
1.2 |
void |
| 63 |
root |
1.12 |
free_objectlink (objectlink *ol) |
| 64 |
root |
1.2 |
{ |
| 65 |
elmex |
1.1 |
if (ol->next) |
| 66 |
root |
1.2 |
free_objectlink (ol->next); |
| 67 |
root |
1.4 |
|
| 68 |
|
|
delete ol; |
| 69 |
elmex |
1.1 |
} |
| 70 |
|
|
|
| 71 |
|
|
/* |
| 72 |
|
|
* Recursively frees all linked list of objectlink pointers |
| 73 |
|
|
*/ |
| 74 |
|
|
|
| 75 |
root |
1.2 |
void |
| 76 |
root |
1.4 |
free_objectlinkpt (oblinkpt *obp) |
| 77 |
root |
1.2 |
{ |
| 78 |
elmex |
1.1 |
if (obp->next) |
| 79 |
root |
1.2 |
free_objectlinkpt (obp->next); |
| 80 |
root |
1.4 |
|
| 81 |
elmex |
1.1 |
if (obp->link) |
| 82 |
root |
1.2 |
free_objectlink (obp->link); |
| 83 |
root |
1.4 |
|
| 84 |
|
|
delete obp; |
| 85 |
elmex |
1.1 |
} |
| 86 |
root |
1.12 |
|