ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/links.C
Revision: 1.4
Committed: Sun Oct 15 02:16:34 2006 UTC (17 years, 7 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.3: +12 -10 lines
Log Message:
more now invalid tag_t uses replaced by refcounting. reduced codesize quite a bit.

File Contents

# User Rev Content
1 elmex 1.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 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 }