server/src/reports.h

153 lines
5.7 KiB
C
Raw Normal View History

#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>
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>
#include <kernel/objtypes.h>
#include <kernel/types.h>
#include <stdbool.h>
2011-03-08 08:44:20 +01:00
2010-08-08 10:06:34 +02:00
#ifdef __cplusplus
extern "C" {
#endif
struct battle;
struct gamedate;
struct sbstring;
struct selist;
struct stream;
struct seen_region;
/* Alter, ab dem der Score angezeigt werden soll: */
2010-08-08 10:06:34 +02:00
#define DISPLAYSCORE 12
/* Breite einer Reportzeile: */
2010-08-08 10:06:34 +02:00
#define REPORTWIDTH 78
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 */
void reports_done(void);
struct unit *can_find(struct faction *, struct faction *);
bool omniscient(const struct faction *f);
struct selist *get_regions_distance(struct region * root, int radius);
int get_regions_distance_arr(struct region *r, int radius, struct region *result[], int size);
/* 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);
const char *hp_status(const struct unit *u);
void spunit(struct strlist **SP, const struct faction *f,
const struct unit *u, unsigned int indent, seen_mode mode);
int reports(void);
2018-02-24 19:41:36 +01:00
int write_reports(struct faction *f);
int init_reports(void);
void reorder_units(struct region * r);
int stealth_modifier(const struct region *r, const struct faction *f, seen_mode mode);
typedef struct report_context {
struct faction *f;
struct selist *addresses;
struct region *first, *last;
void *userdata;
time_t report_time;
const char *password;
} report_context;
void prepare_report(report_context *ctx, struct faction *f, const char *password);
void finish_reports(report_context *ctx);
void get_addresses(report_context * ctx);
typedef int(*report_fun) (const char *filename, report_context * ctx,
const char *charset);
void register_reporttype(const char *extension, report_fun write,
int flag);
2018-11-24 12:26:52 +01:00
int bufunit_depr(const struct faction *f, const struct unit *u, seen_mode mode,
char *buf, size_t size);
2018-11-24 12:26:52 +01:00
void bufunit(const struct faction * f, const struct unit * u,
const struct faction *fv, seen_mode mode, int getarnt,
struct sbstring *sbp);
const char *trailinto(const struct region *r,
const struct locale *lang);
2018-11-24 12:26:52 +01:00
size_t report_status_depr(const struct unit *u,
const struct locale *lang, char *buf, size_t siz);
void report_battle_start(struct battle * b);
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 {
const struct resource_type *rtype;
int number;
int level;
} resource_report;
int report_resources(const struct region *r, struct resource_report *res,
int size, const struct faction *viewer, bool see_unit);
int report_items(const struct unit *u, struct item *result, int size,
const struct unit *owner, const struct faction *viewer);
2018-08-02 13:53:41 +02:00
void report_warnings(struct faction *f, int now);
void report_raceinfo(const struct race *rc, const struct locale *lang, struct sbstring *sbp);
void report_race_skills_depr(const struct race *rc, char *zText, size_t length, const struct locale *lang);
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 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
void split_paragraph(struct strlist ** SP, const char *s, unsigned int indent, unsigned int width, char mark);
int stream_printf(struct stream * out, const char *format, ...);
int count_travelthru(struct region *r, const struct faction *f);
const char *get_mailcmd(const struct locale *loc);
bool visible_unit(const struct unit *u, const struct faction *f, int stealthmod, seen_mode mode);
2018-03-11 14:40:38 +01:00
bool see_region_details(const struct region *r);
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