server/src/common/kernel/unit.h

158 lines
4.9 KiB
C
Raw Normal View History

2001-01-25 10:37:55 +01:00
/* vi: set ts=2:
*
*
2001-01-25 10:37:55 +01:00
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
*
* based on:
*
* Atlantis v1.0 13 September 1993 Copyright 1993 by Russell Wallace
* Atlantis v1.7 Copyright 1996 by Alex Schr<EFBFBD>der
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
* This program may not be sold or used commercially without prior written
* permission from the authors.
*/
#ifndef UNIT_H
#define UNIT_H
struct skill;
2001-01-25 10:37:55 +01:00
typedef struct unit {
struct unit *next;
struct unit *nexthash;
struct unit *nextF; /* n<>chste Einheit der Partei */
struct unit *prevF; /* letzte Einheit der Partei */
struct region *region;
int no;
char *name;
char *display;
int number;
int hp;
short age;
struct faction *faction;
struct building *building;
struct ship *ship;
char *thisorder;
char *lastorder;
int skill_size;
struct skill *skills;
2001-01-25 10:37:55 +01:00
struct item * items;
struct reservation {
struct reservation * next;
const struct resource_type * type;
int value;
} * reservations;
struct strlist *orders;
struct strlist *botschaften;
unsigned int flags;
struct attrib * attribs;
#ifndef NDEBUG
int debug_number; /* Sollte immer == number sein. Wenn nicht, ist
* * nicht mit createunit und set_number
* * gearbeitet worden. */
#endif
status_t status;
const struct race * race;
const struct race * irace;
2001-01-25 10:37:55 +01:00
int n; /* enno: attribut? */
int wants; /* enno: attribut? */
} unit;
extern attrib_type at_alias;
extern attrib_type at_siege;
extern attrib_type at_target;
extern attrib_type at_potion;
extern attrib_type at_potionuser;
extern attrib_type at_contact;
extern attrib_type at_effect;
extern attrib_type at_private;
2002-02-22 20:41:20 +01:00
extern attrib_type at_showskchange;
2001-01-25 10:37:55 +01:00
int ualias(const struct unit * u);
extern attrib_type at_stealth;
void u_seteffstealth(struct unit * u, int value);
int u_geteffstealth(const struct unit * u);
struct building * usiege(const struct unit * u);
void usetsiege(struct unit * u, const struct building * b);
struct unit * utarget(const struct unit * u);
void usettarget(struct unit * u, const struct unit * b);
struct unit * utarget(const struct unit * u);
void usettarget(struct unit * u, const struct unit * b);
extern const struct race * urace(const struct unit * u);
2001-01-25 10:37:55 +01:00
const char* uprivate(const struct unit * u);
void usetprivate(struct unit * u, const char * c);
const struct potion_type * ugetpotionuse(const struct unit * u); /* benutzt u einein trank? */
void usetpotionuse(struct unit * u, const struct potion_type * p); /* u benutzt trank p (es darf halt nur einer pro runde) */
boolean ucontact(const struct unit * u, const struct unit * u2);
void usetcontact(struct unit * u, const struct unit * c);
2001-04-26 19:41:06 +02:00
struct unit * findnewunit (const struct region * r, const struct faction *f, int alias);
2001-01-25 10:37:55 +01:00
#define upotions(u) fval(u, FL_POTIONS)
extern const struct unit u_peasants;
extern const struct unit u_unknown;
2001-01-25 10:37:55 +01:00
extern struct unit * udestroy;
2002-02-23 17:18:26 +01:00
extern struct skill * add_skill(struct unit * u, skill_t id);
extern void remove_skill(struct unit *u, skill_t sk);
extern struct skill * get_skill(const struct unit * u, skill_t id);
extern boolean has_skill(const unit* u, skill_t sk);
extern void set_level(struct unit * u, skill_t id, int level);
extern int get_level(const struct unit * u, skill_t id);
extern void transfermen(struct unit * u, struct unit * u2, int n);
2001-01-25 10:37:55 +01:00
extern int eff_skill(const struct unit * u, skill_t sk, const struct region * r);
extern int get_modifier(const struct unit * u, skill_t sk, int lvl, const struct region * r);
2001-01-25 10:37:55 +01:00
#undef DESTROY
/* Einheiten werden nicht wirklich zerst<73>rt. */
extern void destroy_unit(struct unit * u);
/* see resolve.h */
extern void * resolve_unit(void * data);
extern void write_unit_reference(const unit * u, FILE * F);
extern int read_unit_reference(unit ** up, FILE * F);
2001-01-25 10:37:55 +01:00
extern void leave(struct region * r, struct unit * u);
extern void leave_ship(unit * u);
extern void leave_building(unit * u);
extern void set_leftship(struct unit *u, struct ship *sh);
extern struct ship * leftship(const struct unit *);
extern boolean can_survive(const struct unit *u, const struct region *r);
extern void move_unit(struct unit * u, struct region * target, struct unit ** ulist);
extern struct building * inside_building(const struct unit * u);
/* cleanup code for this module */
extern void free_units(void);
extern struct faction * dfindhash(int no);
2001-02-10 15:18:01 +01:00
extern void u_setfaction(struct unit * u, struct faction * f);
/* vorsicht Spr<70>che k<>nnen u->number == 0 (RS_FARVISION) haben! */
extern void set_number(struct unit * u, int count);
extern boolean learn_skill(struct unit * u, skill_t sk, double chance);
2002-05-05 18:59:25 +02:00
extern int invisible(const unit *u);
2001-01-25 10:37:55 +01:00
#endif