2015-03-29 14:03:56 +02:00
|
|
|
#pragma once
|
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-08-24 23:36:06 +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 H_KRNL_REPORTS
|
|
|
|
#define H_KRNL_REPORTS
|
2011-03-08 08:44:20 +01:00
|
|
|
|
|
|
|
#include <time.h>
|
2014-08-27 06:40:18 +02:00
|
|
|
#include <kernel/objtypes.h>
|
2014-11-01 12:57:01 +01:00
|
|
|
#include <kernel/types.h>
|
2017-01-10 18:20:47 +01:00
|
|
|
#include <stdbool.h>
|
2011-03-08 08:44:20 +01:00
|
|
|
|
2010-08-08 10:06:34 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-12-31 15:05:49 +01:00
|
|
|
struct battle;
|
2017-12-22 11:15:17 +01:00
|
|
|
struct gamedate;
|
2017-01-26 17:41:21 +01:00
|
|
|
struct selist;
|
|
|
|
struct stream;
|
|
|
|
struct seen_region;
|
|
|
|
|
2014-08-24 23:36:06 +02:00
|
|
|
/* Alter, ab dem der Score angezeigt werden soll: */
|
2010-08-08 10:06:34 +02:00
|
|
|
#define DISPLAYSCORE 12
|
2014-08-24 23:36:06 +02:00
|
|
|
/* Breite einer Reportzeile: */
|
2010-08-08 10:06:34 +02:00
|
|
|
#define REPORTWIDTH 78
|
|
|
|
|
2014-08-24 23:36:06 +02:00
|
|
|
extern const char *directions[];
|
|
|
|
extern const char *coasts[];
|
|
|
|
extern const char *combatstatus[];
|
|
|
|
extern bool nonr;
|
|
|
|
extern bool nocr;
|
|
|
|
extern bool noreports;
|
2014-08-25 08:15:51 +02:00
|
|
|
extern const char *visibility[];
|
2016-11-17 10:38:09 +01:00
|
|
|
extern const char *options[MAXOPTIONS]; /* report options */
|
2014-08-24 23:36:06 +02:00
|
|
|
|
2016-09-07 20:46:41 +02:00
|
|
|
void reports_done(void);
|
|
|
|
|
2014-08-24 23:36:06 +02:00
|
|
|
struct unit *can_find(struct faction *, struct faction *);
|
|
|
|
|
2016-09-20 20:27:41 +02:00
|
|
|
bool omniscient(const struct faction *f);
|
2017-03-11 16:08:14 +01:00
|
|
|
struct selist *get_regions_distance(struct region * root, int radius);
|
2016-09-23 19:51:33 +02:00
|
|
|
int get_regions_distance_arr(struct region *r, int radius, struct region *result[], int size);
|
2014-08-24 23:36:06 +02:00
|
|
|
/* funktionen zum schreiben eines reports */
|
2015-05-15 11:19:26 +02:00
|
|
|
void sparagraph(struct strlist **SP, const char *s, unsigned int indent, char mark);
|
|
|
|
void lparagraph(struct strlist **SP, char *s, unsigned int indent, char mark);
|
2014-08-24 23:36:06 +02:00
|
|
|
const char *hp_status(const struct unit *u);
|
|
|
|
size_t spskill(char *pbuf, size_t siz, const struct locale *lang, const struct unit *u, struct skill *sv, int *dh, int days); /* mapper */
|
|
|
|
void spunit(struct strlist **SP, const struct faction *f,
|
2016-09-12 22:03:16 +02:00
|
|
|
const struct unit *u, unsigned int indent, seen_mode mode);
|
2014-08-24 23:36:06 +02:00
|
|
|
|
|
|
|
int reports(void);
|
|
|
|
int write_reports(struct faction *f, time_t ltime);
|
|
|
|
int init_reports(void);
|
|
|
|
void reorder_units(struct region * r);
|
|
|
|
|
|
|
|
const struct unit *ucansee(const struct faction *f,
|
|
|
|
const struct unit *u, const struct unit *x);
|
|
|
|
|
2017-10-10 20:09:39 +02:00
|
|
|
int stealth_modifier(const struct region *r, const struct faction *f, seen_mode mode);
|
2014-08-24 23:36:06 +02:00
|
|
|
|
|
|
|
typedef struct report_context {
|
|
|
|
struct faction *f;
|
2017-01-26 17:41:21 +01:00
|
|
|
struct selist *addresses;
|
2014-08-24 23:36:06 +02:00
|
|
|
struct region *first, *last;
|
|
|
|
void *userdata;
|
|
|
|
time_t report_time;
|
|
|
|
} report_context;
|
|
|
|
|
2016-09-14 21:46:57 +02:00
|
|
|
void prepare_report(report_context *ctx, struct faction *f);
|
|
|
|
void finish_reports(report_context *ctx);
|
2017-03-01 19:52:23 +01:00
|
|
|
void get_addresses(report_context * ctx);
|
2016-09-13 09:09:35 +02:00
|
|
|
|
2014-08-24 23:36:06 +02:00
|
|
|
typedef int(*report_fun) (const char *filename, report_context * ctx,
|
|
|
|
const char *charset);
|
|
|
|
void register_reporttype(const char *extension, report_fun write,
|
|
|
|
int flag);
|
|
|
|
|
2015-05-15 11:19:26 +02:00
|
|
|
int bufunit(const struct faction *f, const struct unit *u, unsigned int indent,
|
2016-09-12 22:03:16 +02:00
|
|
|
seen_mode mode, char *buf, size_t size);
|
2014-08-24 23:36:06 +02:00
|
|
|
|
|
|
|
const char *trailinto(const struct region *r,
|
|
|
|
const struct locale *lang);
|
2015-10-27 12:32:32 +01:00
|
|
|
size_t report_status(const struct unit *u,
|
|
|
|
const struct locale *lang, char *buf, size_t siz);
|
2017-12-31 15:05:49 +01:00
|
|
|
void report_battle_start(struct battle * b);
|
2014-08-24 23:36:06 +02:00
|
|
|
|
|
|
|
void register_reports(void);
|
|
|
|
|
|
|
|
struct message *msg_curse(const struct curse *c, const void *obj,
|
|
|
|
objtype_t typ, int slef);
|
|
|
|
|
|
|
|
typedef struct arg_regions {
|
|
|
|
int nregions;
|
|
|
|
struct region **regions;
|
|
|
|
} arg_regions;
|
|
|
|
|
|
|
|
typedef struct resource_report {
|
2017-03-05 17:42:57 +01:00
|
|
|
const struct resource_type *rtype;
|
2014-08-24 23:36:06 +02:00
|
|
|
int number;
|
|
|
|
int level;
|
|
|
|
} resource_report;
|
2016-09-12 22:03:16 +02:00
|
|
|
int report_resources(const struct region *r, struct resource_report *res,
|
|
|
|
int size, const struct faction *viewer, bool see_unit);
|
2016-08-29 20:37:47 +02:00
|
|
|
int report_items(const struct unit *u, struct item *result, int size,
|
2014-08-24 23:36:06 +02:00
|
|
|
const struct unit *owner, const struct faction *viewer);
|
2017-12-22 11:15:17 +01:00
|
|
|
void report_warnings(struct faction *f, const struct gamedate *date);
|
2018-01-25 21:31:09 +01:00
|
|
|
void report_race_skills(const struct race *rc, char *zText, size_t length, const struct locale *lang);
|
2014-08-24 23:36:06 +02:00
|
|
|
void report_item(const struct unit *owner, const struct item *i,
|
|
|
|
const struct faction *viewer, const char **name, const char **basename,
|
|
|
|
int *number, bool singular);
|
|
|
|
void report_building(const struct building *b, const char **btype,
|
|
|
|
const char **billusion);
|
|
|
|
void report_race(const struct unit *u, const char **rcname,
|
|
|
|
const char **rcillusion);
|
|
|
|
|
|
|
|
void add_seen_faction(struct faction *self, struct faction *seen);
|
|
|
|
size_t f_regionid(const struct region *r, const struct faction *f,
|
|
|
|
char *buffer, size_t size);
|
2011-03-07 08:02:35 +01:00
|
|
|
|
2016-08-29 15:49:31 +02:00
|
|
|
void split_paragraph(struct strlist ** SP, const char *s, unsigned int indent, unsigned int width, char mark);
|
2014-12-17 17:40:36 +01:00
|
|
|
|
2015-08-05 14:45:46 +02:00
|
|
|
int stream_printf(struct stream * out, const char *format, ...);
|
2014-12-17 17:40:36 +01:00
|
|
|
|
2016-09-17 08:28:33 +02:00
|
|
|
int count_travelthru(struct region *r, const struct faction *f);
|
2017-01-22 20:19:32 +01:00
|
|
|
const char *get_mailcmd(const struct locale *loc);
|
2015-08-19 14:37:51 +02:00
|
|
|
|
2017-12-23 17:49:30 +01:00
|
|
|
bool visible_unit(const struct unit *u, const struct faction *f, int stealthmod, seen_mode mode);
|
2017-12-23 17:37:24 +01:00
|
|
|
|
2011-03-07 08:02:35 +01:00
|
|
|
#define GR_PLURAL 0x01 /* grammar: plural */
|
|
|
|
#define MAX_INVENTORY 128 /* maimum number of different items in an inventory */
|
|
|
|
#define MAX_RAWMATERIALS 8 /* maximum kinds of raw materials in a regions */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|