2015-01-30 20:37:14 +01:00
|
|
|
/*
|
2010-08-08 10:06:34 +02:00
|
|
|
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
|
|
|
| | Enno Rehling <enno@eressea.de>
|
|
|
|
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
|
|
|
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
|
|
|
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
|
|
|
+-------------------+ Stefan Reich <reich@halbling.de>
|
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
This program may not be used, modified or distributed
|
2010-08-08 10:06:34 +02:00
|
|
|
without prior permission by the authors of Eressea.
|
2015-01-30 20:37:14 +01:00
|
|
|
*/
|
2010-08-08 10:06:34 +02:00
|
|
|
#ifndef H_KRNL_RESOURCES
|
|
|
|
#define H_KRNL_RESOURCES
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
enum {
|
|
|
|
RM_USED = 1 << 0, /* resource has been used */
|
|
|
|
RM_MALLORN = 1 << 1 /* this is not wood. it's mallorn */
|
|
|
|
};
|
2011-03-07 08:02:35 +01:00
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
typedef struct rawmaterial {
|
|
|
|
const struct rawmaterial_type *type;
|
2014-06-27 06:48:01 +02:00
|
|
|
#ifdef LOMEM
|
2015-01-30 20:37:14 +01:00
|
|
|
int amount:16;
|
|
|
|
int level:8;
|
|
|
|
int flags:8;
|
|
|
|
int base:8;
|
|
|
|
int divisor:8;
|
|
|
|
int startlevel:8;
|
2014-06-27 06:48:01 +02:00
|
|
|
#else
|
2015-01-30 20:37:14 +01:00
|
|
|
int amount;
|
|
|
|
int level;
|
|
|
|
int flags;
|
|
|
|
int base;
|
|
|
|
int divisor;
|
|
|
|
int startlevel;
|
2014-06-27 06:48:01 +02:00
|
|
|
#endif
|
2015-01-30 20:37:14 +01:00
|
|
|
struct rawmaterial *next;
|
|
|
|
} rawmaterial;
|
2011-03-07 08:02:35 +01:00
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
typedef struct rawmaterial_type {
|
|
|
|
char *name;
|
|
|
|
const struct resource_type *rtype;
|
2011-03-07 08:02:35 +01:00
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
void(*terraform) (struct rawmaterial *, const struct region *);
|
|
|
|
void(*update) (struct rawmaterial *, const struct region *);
|
|
|
|
void(*use) (struct rawmaterial *, const struct region *, int amount);
|
|
|
|
int(*visible) (const struct rawmaterial *, int skilllevel);
|
2011-03-07 08:02:35 +01:00
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
/* no initialization required */
|
|
|
|
struct rawmaterial_type *next;
|
|
|
|
} rawmaterial_type;
|
2011-03-07 08:02:35 +01:00
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
extern struct rawmaterial_type *rawmaterialtypes;
|
2011-03-07 08:02:35 +01:00
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
extern void update_resources(struct region *r);
|
|
|
|
extern void terraform_resources(struct region *r);
|
|
|
|
extern void read_resources(struct region *r);
|
|
|
|
extern void write_resources(struct region *r);
|
|
|
|
extern struct rawmaterial *rm_get(struct region *,
|
|
|
|
const struct resource_type *);
|
|
|
|
extern struct rawmaterial_type *rmt_find(const char *str);
|
|
|
|
extern struct rawmaterial_type *rmt_get(const struct resource_type *);
|
2011-03-07 08:02:35 +01:00
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
extern void add_resource(struct region *r, int level, int base, int divisor,
|
|
|
|
const struct resource_type *rtype);
|
|
|
|
extern struct rawmaterial_type *rmt_create(const struct resource_type *rtype,
|
|
|
|
const char *name);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|