server/src/kernel/pool.h

50 lines
1.5 KiB
C
Raw Normal View History

2010-08-08 10:06:34 +02:00
#ifndef H_KRNL_POOL_H
#define H_KRNL_POOL_H
#ifdef __cplusplus
extern "C" {
#endif
struct unit;
struct resource_type;
struct item_type;
struct region;
/* bitfield values for get/use/change operations */
2010-08-08 10:06:34 +02:00
#define GET_SLACK 0x01
#define GET_RESERVE 0x02
#define GET_POOLED_SLACK 0x08
#define GET_POOLED_RESERVE 0x10
2011-03-07 08:02:35 +01:00
#define GET_POOLED_FORCE 0x20 /* ignore f->options pools */
#define GET_ALLIED_SLACK 0x40
#define GET_ALLIED_RESERVE 0x80
2010-08-08 10:06:34 +02:00
/* for convenience: */
2010-08-08 10:06:34 +02:00
#define GET_DEFAULT (GET_RESERVE|GET_SLACK|GET_POOLED_SLACK)
#define GET_ALL (GET_SLACK|GET_RESERVE|GET_POOLED_SLACK|GET_POOLED_RESERVE|GET_POOLED_FORCE)
int get_pooled(const struct unit *u, const struct resource_type *res,
2019-01-24 17:50:58 +01:00
int mode, int count);
int use_pooled(struct unit *u, const struct resource_type *res,
2019-01-24 17:50:58 +01:00
int mode, int count);
/** use_pooled
* verbraucht 'count' Objekte der resource 'itm'
* unter zuhilfenahme des Pools der struct region und Aufbrauch des
* von der Einheit reservierten Resourcen
*/
2010-08-08 10:06:34 +02:00
int get_resource(const struct unit *u, const struct resource_type *res);
int change_resource(struct unit *u, const struct resource_type *res,
int change);
2010-08-08 10:06:34 +02:00
int get_reservation(const struct unit *u, const struct item_type *res);
int change_reservation(struct unit *u, const struct item_type *res,
int value);
2010-08-08 10:06:34 +02:00
int set_resvalue(struct unit * u, const struct item_type * rtype, int value);
2010-08-08 10:06:34 +02:00
#ifdef __cplusplus
}
#endif
#endif