Fix division by zero when unit activity rate is zero
[freeciv.git] / server / notify.h
blobf41d1b176a7e988fc6d3d25a007f75ad0ebd21f3
1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
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.
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__NOTIFY_H
14 #define FC__NOTIFY_H
16 #include <stdarg.h>
18 /* utility */
19 #include "support.h" /* fc__attribute */
21 /* common */
22 #include "events.h"
23 #include "fc_types.h"
24 #include "featured_text.h" /* ftc_*: color pre-definitions. */
25 #include "packets.h"
27 /* server */
28 #include "srv_main.h" /* enum server_states */
30 struct research;
33 void package_chat_msg(struct packet_chat_msg *packet,
34 const struct connection *sender,
35 const struct ft_color color,
36 const char *format, ...)
37 fc__attribute((__format__ (__printf__, 4, 5)));
38 void vpackage_chat_msg(struct packet_chat_msg *packet,
39 const struct connection *sender,
40 const struct ft_color color,
41 const char *format,
42 va_list vargs);
43 void package_event(struct packet_chat_msg *packet,
44 const struct tile *ptile,
45 enum event_type event,
46 const struct ft_color color,
47 const char *format, ...)
48 fc__attribute((__format__ (__printf__, 5, 6)));
49 void vpackage_event(struct packet_chat_msg *packet,
50 const struct tile *ptile,
51 enum event_type event,
52 const struct ft_color color,
53 const char *format,
54 va_list vargs);
56 void notify_conn(struct conn_list *dest,
57 const struct tile *ptile,
58 enum event_type event,
59 const struct ft_color color,
60 const char *format, ...)
61 fc__attribute((__format__ (__printf__, 5, 6)));
62 void notify_conn_early(struct conn_list *dest,
63 const struct tile *ptile,
64 enum event_type event,
65 const struct ft_color color,
66 const char *format, ...)
67 fc__attribute((__format__ (__printf__, 5, 6)));
68 void notify_player(const struct player *pplayer,
69 const struct tile *ptile,
70 enum event_type event,
71 const struct ft_color color,
72 const char *format, ...)
73 fc__attribute((__format__ (__printf__, 5, 6)));
74 void notify_embassies(const struct player *pplayer,
75 const struct tile *ptile,
76 enum event_type event,
77 const struct ft_color color,
78 const char *format, ...)
79 fc__attribute((__format__ (__printf__, 5, 6)));
80 void notify_team(const struct player *pplayer,
81 const struct tile *ptile,
82 enum event_type event,
83 const struct ft_color color,
84 const char *format, ...)
85 fc__attribute((__format__ (__printf__, 5, 6)));
86 void notify_research(const struct research *presearch,
87 const struct player *exclude,
88 enum event_type event,
89 const struct ft_color color,
90 const char *format, ...)
91 fc__attribute((__format__ (__printf__, 5, 6)));
92 void notify_research_embassies(const struct research *presearch,
93 const struct player *exclude,
94 enum event_type event,
95 const struct ft_color color,
96 const char *format, ...)
97 fc__attribute((__format__ (__printf__, 5, 6)));
99 /* Event cache. */
101 /* The type of event target. */
102 struct event_cache_players;
104 void event_cache_init(void);
105 void event_cache_free(void);
106 void event_cache_clear(void);
107 void event_cache_remove_old(void);
109 void event_cache_add_for_all(const struct packet_chat_msg *packet);
110 void event_cache_add_for_global_observers(const struct packet_chat_msg *packet);
111 void event_cache_add_for_player(const struct packet_chat_msg *packet,
112 const struct player *pplayer);
113 struct event_cache_players *
114 event_cache_player_add(struct event_cache_players *players,
115 const struct player *pplayer)
116 fc__warn_unused_result;
117 void event_cache_add_for_players(const struct packet_chat_msg *packet,
118 struct event_cache_players *players);
120 void send_pending_events(struct connection *pconn, bool include_public);
122 void event_cache_phases_invalidate(void);
124 struct section_file;
125 void event_cache_load(struct section_file *file, const char *section);
126 void event_cache_save(struct section_file *file, const char *section);
128 #endif /* FC__NOTIFY_H */