2001-01-25 10:37:55 +01:00
|
|
|
/* vi: set ts=2:
|
|
|
|
*
|
2001-12-10 01:13:39 +01:00
|
|
|
*
|
2003-07-29 11:48:03 +02:00
|
|
|
* 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-pbem.de)
|
|
|
|
* 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 "follow.h"
|
|
|
|
|
|
|
|
#include <eressea.h>
|
|
|
|
#include <unit.h>
|
|
|
|
|
|
|
|
#include <attrib.h>
|
|
|
|
#include <resolve.h>
|
|
|
|
|
2001-04-22 20:14:07 +02:00
|
|
|
static int
|
|
|
|
verify_follow(attrib * a)
|
|
|
|
{
|
|
|
|
if (a->data.v==NULL) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2001-01-25 10:37:55 +01:00
|
|
|
static int
|
|
|
|
read_follow(attrib * a, FILE * F)
|
|
|
|
{
|
|
|
|
if (global.data_version < BASE36IDS_VERSION) {
|
|
|
|
int i;
|
|
|
|
fscanf(F, "%d", &i);
|
|
|
|
ur_add((void*)i, (void**)&a->data.v, resolve_unit);
|
|
|
|
} else {
|
2002-04-07 02:44:01 +02:00
|
|
|
return read_unit_reference(NULL, F);
|
2001-01-25 10:37:55 +01:00
|
|
|
}
|
2002-04-07 02:44:01 +02:00
|
|
|
return AT_READ_OK;
|
2001-01-25 10:37:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
attrib_type at_follow = {
|
2002-04-07 02:44:01 +02:00
|
|
|
"follow", NULL, NULL, verify_follow, NULL, read_follow
|
2001-01-25 10:37:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
attrib *
|
|
|
|
make_follow(struct unit * u)
|
|
|
|
{
|
|
|
|
attrib * a = a_new(&at_follow);
|
|
|
|
a->data.v = u;
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
init_follow(void)
|
|
|
|
{
|
|
|
|
at_register(&at_follow);
|
|
|
|
}
|