ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/links.C
Revision: 1.3
Committed: Thu Sep 14 22:33:58 2006 UTC (17 years, 8 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.2: +0 -6 lines
Log Message:
indent

File Contents

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