server/src/common/kernel/ship.h

93 lines
2.4 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)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#ifndef SHIP_H
#define SHIP_H
#include "build.h"
#define DAMAGE_SCALE 100 /* multiplier for sh->damage */
/* ship_type::flags */
#define SFL_OPENSEA 0x01
#define SFL_FLY 0x02
2001-01-25 10:37:55 +01:00
typedef struct ship_type {
const char * name[2];
int range; /* range in regions */
int flags; /* flags */
int combat; /* modifier for combat */
double storm; /* multiplier for chance to drift in storm */
double damage; /* multiplier for damage taken by the ship */
int cabins; /* max. cabins (people) */
int cargo; /* max. cargo (weight) */
int cptskill; /* min. skill of captain */
int minskill; /* min. skill to sail this (crew) */
int sumskill; /* min. sum of crew+captain */
terrain_t * coast; /* coast that this ship can land on */
2001-01-25 10:37:55 +01:00
construction * construction; /* how to build a ship */
2001-01-25 10:37:55 +01:00
} ship_type;
typedef struct ship_typelist {
struct ship_typelist * next;
const ship_type * type;
} ship_typelist;
extern ship_typelist *shiptypes;
/* Alte Schiffstypen: */
extern const ship_type * st_find(const char* name);
extern void st_register(const ship_type * type);
#define NOSHIP NULL
#define SF_DRIFTED 1<<0
#define SF_MOVED 1<<1
#define SF_DAMAGED 1<<2 /* for use in combat */
typedef struct ship {
struct ship *next;
struct ship *nexthash;
int no;
struct region *region;
char *name;
char *display;
struct attrib * attribs;
int size;
int damage; /* damage in 100th of a point of size */
unsigned int flags;
const struct ship_type * type;
direction_t coast;
} ship;
2001-01-25 10:37:55 +01:00
extern void damage_ship(ship *sh, double percent);
extern struct unit *captain(ship *sh, struct region *r);
extern struct unit *shipowner(const struct region * r, const struct ship * sh);
extern ship *new_ship(const struct ship_type * stype, struct region * r);
extern const char *shipname(const struct ship * sh);
2001-01-25 10:37:55 +01:00
extern ship *findship(int n);
extern const struct ship_type * findshiptype(const char *s, const struct locale * lang);
extern void register_ships(void);
2001-01-25 10:37:55 +01:00
#endif