server/src/common/attributes/hate.c

72 lines
1.2 KiB
C
Raw Normal View History

2001-01-25 10:37:55 +01:00
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2003
2001-01-25 10:37:55 +01:00
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea.de)
2001-01-25 10:37:55 +01:00
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#include <config.h>
#include <kernel/eressea.h>
2001-01-25 10:37:55 +01:00
#include "hate.h"
2007-06-20 02:34:02 +02:00
#include <kernel/unit.h>
#include <kernel/version.h>
2001-01-25 10:37:55 +01:00
2007-06-20 02:34:02 +02:00
#include <util/attrib.h>
#include <util/resolve.h>
#include <util/storage.h>
2001-01-25 10:37:55 +01:00
static int
verify_hate(attrib * a)
{
if (a->data.v==NULL) {
return 0;
}
return 1;
}
2001-01-25 10:37:55 +01:00
static void
write_hate(const attrib * a, struct storage * store)
2001-01-25 10:37:55 +01:00
{
write_unit_reference((unit*)a->data.v, store);
2001-01-25 10:37:55 +01:00
}
static int
read_hate(attrib * a, struct storage * store)
2001-01-25 10:37:55 +01:00
{
unit * u;
int result = read_unit_reference(&u, store);
a->data.v = u;
return result;
2001-01-25 10:37:55 +01:00
}
attrib_type at_hate = {
"hates",
NULL,
NULL,
verify_hate,
2001-01-25 10:37:55 +01:00
write_hate,
read_hate,
};
attrib *
make_hate(struct unit * u)
{
attrib * a = a_new(&at_hate);
a->data.v = u;
return a;
}
void
init_hate(void)
{
at_register(&at_hate);
}