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