2010-08-08 10:06:34 +02:00
|
|
|
|
/*
|
2015-01-30 22:10:29 +01:00
|
|
|
|
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
2014-07-23 11:54:51 +02:00
|
|
|
|
Katja Zedel <katze@felidae.kn-bremen.de
|
|
|
|
|
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
#ifndef ERESSEA_H
|
|
|
|
|
#define ERESSEA_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-07-23 11:54:51 +02:00
|
|
|
|
/* this should always be the first thing included after platform.h */
|
2016-11-25 20:15:11 +01:00
|
|
|
|
#include <stddef.h>
|
2017-01-10 16:31:05 +01:00
|
|
|
|
#include <stdbool.h>
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#include "types.h"
|
2017-01-21 19:53:47 +01:00
|
|
|
|
|
|
|
|
|
struct param;
|
|
|
|
|
struct _dictionary_;
|
2011-03-07 08:02:35 +01:00
|
|
|
|
|
2016-11-17 10:38:09 +01:00
|
|
|
|
#define DISPLAYSIZE 8192 /* max. L<>nge einer Beschreibung, incl trailing 0 */
|
2014-08-14 09:57:05 +02:00
|
|
|
|
#define ORDERSIZE (DISPLAYSIZE*2) /* max. length of an order */
|
2016-11-17 10:38:09 +01:00
|
|
|
|
#define NAMESIZE 128 /* max. L<>nge eines Namens, incl trailing 0 */
|
|
|
|
|
#define IDSIZE 16 /* max. L<>nge einer no (als String), incl trailing 0 */
|
|
|
|
|
#define OBJECTIDSIZE (NAMESIZE+5+IDSIZE) /* max. L<>nge der Strings, die
|
|
|
|
|
* von struct unitname, etc. zur<EFBFBD>ckgegeben werden. ohne die 0 */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
|
|
|
|
#define fval(u, i) ((u)->flags & (i))
|
|
|
|
|
#define fset(u, i) ((u)->flags |= (i))
|
|
|
|
|
#define freset(u, i) ((u)->flags &= ~(i))
|
|
|
|
|
|
2014-07-23 11:54:51 +02:00
|
|
|
|
int findoption(const char *s, const struct locale *lang);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2014-07-23 11:54:51 +02:00
|
|
|
|
param_t findparam(const char *s, const struct locale *lang);
|
2017-01-23 10:47:49 +01:00
|
|
|
|
param_t findparam_block(const char *s, const struct locale *lang, bool any_locale);
|
2014-07-23 11:54:51 +02:00
|
|
|
|
param_t findparam_ex(const char *s, const struct locale * lang);
|
|
|
|
|
bool isparam(const char *s, const struct locale * lang, param_t param);
|
|
|
|
|
param_t getparam(const struct locale *lang);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2014-07-23 11:54:51 +02:00
|
|
|
|
const char * game_name(void);
|
2017-03-02 18:28:00 +01:00
|
|
|
|
const char * game_mailcmd(void);
|
2014-07-23 11:54:51 +02:00
|
|
|
|
int game_id(void);
|
|
|
|
|
/* returns a value between [0..xpct_2], generated with two dice */
|
|
|
|
|
|
2014-09-29 21:19:07 +02:00
|
|
|
|
void init_locale(struct locale *lang);
|
2017-04-17 20:11:44 +02:00
|
|
|
|
void init_races(struct locale *lang);
|
2014-07-23 11:54:51 +02:00
|
|
|
|
|
|
|
|
|
int forbiddenid(int id);
|
|
|
|
|
int newcontainerid(void);
|
|
|
|
|
|
2015-09-11 10:04:08 +02:00
|
|
|
|
bool rule_region_owners(void);
|
2017-02-18 21:15:14 +01:00
|
|
|
|
bool rule_stealth_other(void); /* units can pretend to be another faction, TARNE PARTEI <no> */
|
|
|
|
|
bool rule_stealth_anon(void); /* units can anonymize their faction, TARNE PARTEI [NICHT] */
|
2015-09-11 10:04:08 +02:00
|
|
|
|
int rule_alliance_limit(void);
|
|
|
|
|
int rule_faction_limit(void);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#define HARVEST_WORK 0x00
|
|
|
|
|
#define HARVEST_TAXES 0x01
|
2014-07-23 11:54:51 +02:00
|
|
|
|
int rule_blessed_harvest(void);
|
2015-09-11 10:04:08 +02:00
|
|
|
|
#define GIVE_SELF 1
|
|
|
|
|
#define GIVE_PEASANTS 2
|
|
|
|
|
#define GIVE_LUXURIES 4
|
|
|
|
|
#define GIVE_HERBS 8
|
|
|
|
|
#define GIVE_GOODS 16
|
|
|
|
|
#define GIVE_ONDEATH 32
|
|
|
|
|
#define GIVE_ALLITEMS (GIVE_GOODS|GIVE_HERBS|GIVE_LUXURIES)
|
|
|
|
|
#define GIVE_DEFAULT (GIVE_SELF|GIVE_PEASANTS|GIVE_LUXURIES|GIVE_HERBS|GIVE_GOODS)
|
2014-07-23 11:54:51 +02:00
|
|
|
|
int rule_give(void);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2014-07-23 11:54:51 +02:00
|
|
|
|
/* grammatik-flags: */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#define GF_NONE 0
|
2014-07-23 11:54:51 +02:00
|
|
|
|
/* singular, ohne was dran */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#define GF_PLURAL 1
|
2014-07-23 11:54:51 +02:00
|
|
|
|
/* Angaben in Mehrzahl */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#define GF_ARTICLE 8
|
2014-07-23 11:54:51 +02:00
|
|
|
|
/* der, die, eine */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#define GF_SPECIFIC 16
|
2014-07-23 11:54:51 +02:00
|
|
|
|
/* der, die, das vs. ein, eine */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#define GF_DETAILED 32
|
2016-11-17 10:38:09 +01:00
|
|
|
|
/* mehr Informationen. z.b. stra<72>e zu 50% */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#define GF_PURE 64
|
2014-07-23 11:54:51 +02:00
|
|
|
|
/* untranslated */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2014-07-23 11:54:51 +02:00
|
|
|
|
const char *datapath(void);
|
|
|
|
|
void set_datapath(const char *path);
|
|
|
|
|
|
|
|
|
|
const char *basepath(void);
|
|
|
|
|
void set_basepath(const char *);
|
|
|
|
|
|
|
|
|
|
const char *reportpath(void);
|
|
|
|
|
void set_reportpath(const char *);
|
|
|
|
|
|
2016-02-01 09:26:24 +01:00
|
|
|
|
int create_directories(void);
|
|
|
|
|
|
2014-07-23 11:54:51 +02:00
|
|
|
|
void kernel_init(void);
|
|
|
|
|
void kernel_done(void);
|
|
|
|
|
|
|
|
|
|
/* globale settings des Spieles */
|
|
|
|
|
typedef struct settings {
|
|
|
|
|
struct attrib *attribs;
|
|
|
|
|
void *vm_state;
|
|
|
|
|
} settings;
|
|
|
|
|
|
2015-11-22 10:33:31 +01:00
|
|
|
|
void set_param(struct param **p, const char *key, const char *value);
|
2014-08-08 13:29:26 +02:00
|
|
|
|
const char *get_param(const struct param *p, const char *key);
|
|
|
|
|
int get_param_int(const struct param *p, const char *key, int def);
|
|
|
|
|
int check_param(const struct param *p, const char *key, const char *searchvalue);
|
2015-09-12 16:38:39 +02:00
|
|
|
|
double get_param_flt(const struct param *p, const char *key, double def);
|
2015-09-05 18:14:28 +02:00
|
|
|
|
void free_params(struct param **pp);
|
2014-07-23 11:54:51 +02:00
|
|
|
|
|
2015-11-22 10:33:31 +01:00
|
|
|
|
void config_set(const char *key, const char *value);
|
2017-05-07 13:26:54 +02:00
|
|
|
|
void config_set_int(const char *key, int value);
|
2017-03-12 21:03:38 +01:00
|
|
|
|
void config_set_from(const struct _dictionary_ *d, const char *keys[]);
|
2015-11-22 10:33:31 +01:00
|
|
|
|
const char *config_get(const char *key);
|
|
|
|
|
int config_get_int(const char *key, int def);
|
|
|
|
|
double config_get_flt(const char *key, double def);
|
2015-11-22 12:20:33 +01:00
|
|
|
|
bool config_token(const char *key, const char *tok);
|
2016-09-11 12:15:53 +02:00
|
|
|
|
bool config_changed(int *cache_key);
|
2015-11-22 10:33:31 +01:00
|
|
|
|
|
2016-01-29 19:11:48 +01:00
|
|
|
|
char * join_path(const char *p1, const char *p2, char *dst, size_t len);
|
2015-08-05 00:03:30 +02:00
|
|
|
|
|
2014-07-23 11:54:51 +02:00
|
|
|
|
struct order *default_order(const struct locale *lang);
|
2015-08-05 00:03:30 +02:00
|
|
|
|
|
2015-08-05 12:19:17 +02:00
|
|
|
|
void init_parameters(struct locale *lang);
|
2014-07-23 11:54:51 +02:00
|
|
|
|
|
|
|
|
|
void free_gamedata(void);
|
2015-11-22 12:24:27 +01:00
|
|
|
|
void free_config(void);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2014-07-23 11:54:51 +02:00
|
|
|
|
extern const char *parameters[];
|
|
|
|
|
extern settings global;
|
|
|
|
|
|
|
|
|
|
extern bool lomem; /* save memory */
|
|
|
|
|
extern int turn;
|
|
|
|
|
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|