Crossfire Server, Trunk  R20513
links.c
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2014 Mark Wedel and the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, please
9  * see COPYING and LICENSE.
10  *
11  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
12  */
13 
19 #include "global.h"
20 
21 #include <stdlib.h>
22 
34  objectlink *ol = (objectlink *)CALLOC(1, sizeof(objectlink));
35  if (!ol)
37  ol->ob = NULL;
38  ol->next = NULL;
39  ol->id = 0;
40  return ol;
41 }
42 
54  oblinkpt *obp = (oblinkpt *)malloc(sizeof(oblinkpt));
55 
56  if (!obp)
58  obp->link = NULL;
59  obp->next = NULL;
60  obp->value = 0;
61  return obp;
62 }
63 
72  if (ol->next)
73  free_objectlink(ol->next);
74  free(ol);
75 }
76 
84  if (obp->next)
85  free_objectlinkpt(obp->next);
86  if (obp->link)
87  free_objectlink(obp->link);
88  free(obp);
89 }
Used to link together several objects.
Definition: object.h:442
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
Definition: utils.c:596
Global type definitions and header inclusions.
long value
Used as connected value in buttons/gates.
Definition: object.h:453
tag_t id
ob&#39;s tag, in case it is removed.
Definition: object.h:445
Used to link together several object links.
Definition: object.h:451
#define CALLOC(x, y)
Definition: compat.h:27
struct oblnk * link
Items for this value.
Definition: object.h:452
object * ob
Item to link to.
Definition: object.h:443
struct oblinkpt * next
Next value in the list.
Definition: object.h:454
struct oblnk * next
Next item to link to.
Definition: object.h:444