Freeciv-3.3
Loading...
Searching...
No Matches
dailog.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 2002 - The Freeciv Project
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__DAILOG_H
14#define FC__DAILOG_H
15
16/* utility */
17#include "log.h"
18#include "support.h"
19
20/* Change these and remake to watch logs from a specific
21 part of the AI code. */
22#define LOGLEVEL_TECH LOG_DEBUG
23
24struct player;
25
26void dai_city_log(struct ai_type *ait, char *buffer, int buflength,
27 const struct city *pcity);
28void dai_unit_log(struct ai_type *ait, char *buffer, int buflength,
29 const struct unit *punit);
30
31void real_tech_log(struct ai_type *ait, const char *file, const char *function,
32 int line, enum log_level level, bool send_notify,
33 const struct player *pplayer, struct advance *padvance,
34 const char *msg, ...)
36#define TECH_LOG(ait, loglevel, pplayer, padvance, msg, ...) \
37{ \
38 bool send_notify = BV_ISSET(pplayer->server.debug, PLAYER_DEBUG_TECH); \
39 enum log_level level = (send_notify ? LOG_AI_TEST \
40 : MIN(loglevel, LOGLEVEL_TECH)); \
41 if (log_do_output_for_level(level)) { \
42 real_tech_log(ait, __FILE__, __FUNCTION__, __FC_LINE__, level, \
43 send_notify, pplayer, padvance, msg, ## __VA_ARGS__); \
44 } \
45}
46
47void real_diplo_log(struct ai_type *ait,
48 const char *file, const char *function, int line,
49 enum log_level level, bool send_notify,
50 const struct player *pplayer,
51 const struct player *aplayer, const char *msg, ...)
53#define DIPLO_LOG(ait, loglevel, pplayer, aplayer, msg, ...) \
54{ \
55 bool send_notify = BV_ISSET(pplayer->server.debug, PLAYER_DEBUG_DIPLOMACY); \
56 enum log_level level = (send_notify ? LOG_AI_TEST \
57 : MIN(loglevel, LOGLEVEL_PLAYER)); \
58 if (log_do_output_for_level(level)) { \
59 real_diplo_log(ait, __FILE__, __FUNCTION__, __FC_LINE__, level, \
60 send_notify, pplayer, aplayer, msg, ## __VA_ARGS__); \
61 } \
62}
63
64void real_bodyguard_log(struct ai_type *ait, const char *file,
65 const char *function, int line,
66 enum log_level level, bool send_notify,
67 const struct unit *punit, const char *msg, ...)
69#define BODYGUARD_LOG(ait, loglevel, punit, msg, ...) \
70{ \
71 bool send_notify = punit->server.debug; \
72 enum log_level level = (send_notify ? LOG_AI_TEST \
73 : MIN(loglevel, LOGLEVEL_BODYGUARD)); \
74 if (log_do_output_for_level(level)) { \
75 real_bodyguard_log(ait, __FILE__, __FUNCTION__, __FC_LINE__, level, \
76 send_notify, punit, \
77 msg, ## __VA_ARGS__); \
78 } \
79}
80
81#endif /* FC__DAILOG_H */
char * incite_cost
Definition comments.c:76
void real_diplo_log(struct ai_type *ait, const char *file, const char *function, int line, enum log_level level, bool send_notify, const struct player *pplayer, const struct player *aplayer, const char *msg,...) fc__attribute((__format__(__printf__
void real_tech_log(struct ai_type *ait, const char *file, const char *function, int line, enum log_level level, bool send_notify, const struct player *pplayer, struct advance *padvance, const char *msg,...) fc__attribute((__format__(__printf__
void dai_unit_log(struct ai_type *ait, char *buffer, int buflength, const struct unit *punit)
Definition dailog.c:54
void real_bodyguard_log(struct ai_type *ait, const char *file, const char *function, int line, enum log_level level, bool send_notify, const struct unit *punit, const char *msg,...) fc__attribute((__format__(__printf__
void dai_city_log(struct ai_type *ait, char *buffer, int buflength, const struct city *pcity)
Definition dailog.c:41
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:74
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
log_level
Definition log.h:29
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:190
Definition ai.h:50
Definition city.h:317
Definition unit.h:140
#define fc__attribute(x)
Definition support.h:99