webperimental: killstack decides stack protects.
[freeciv.git] / server / maphand.h
blob6e8f68e51703eb31ae2f3958398ca774c09d31ab
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__MAPHAND_H
14 #define FC__MAPHAND_H
16 #include "fc_types.h"
18 #include "map.h"
19 #include "packets.h"
20 #include "terrain.h"
21 #include "vision.h"
23 #include "hand_gen.h"
25 struct section_file;
26 struct conn_list;
29 struct player_tile {
30 struct vision_site *site; /* NULL for no vision site */
31 struct extra_type *resource; /* NULL for no resource */
32 struct terrain *terrain; /* NULL for unknown tiles */
33 struct player *owner; /* NULL for unowned */
34 struct player *extras_owner;
35 bv_extras extras;
37 /* If you build a city with an unknown square within city radius
38 the square stays unknown. However, we still have to keep count
39 of the seen points, so they are kept in here. When the tile
40 then becomes known they are moved to seen. */
41 v_radius_t own_seen;
42 v_radius_t seen_count;
43 short last_updated;
46 void global_warming(int effect);
47 void nuclear_winter(int effect);
48 void climate_change(bool warming, int effect);
49 bool upgrade_city_extras(struct city *pcity, struct extra_type **gained);
50 void upgrade_all_city_extras(struct player *pplayer, bool discovery);
52 void give_map_from_player_to_player(struct player *pfrom, struct player *pdest);
53 void give_seamap_from_player_to_player(struct player *pfrom, struct player *pdest);
54 void give_citymap_from_player_to_player(struct city *pcity,
55 struct player *pfrom, struct player *pdest);
56 void send_all_known_tiles(struct conn_list *dest);
58 bool send_tile_suppression(bool now);
59 void send_tile_info(struct conn_list *dest, struct tile *ptile,
60 bool send_unknown);
62 void send_map_info(struct conn_list *dest);
64 void map_show_tile(struct player *pplayer, struct tile *ptile);
65 void map_hide_tile(struct player *pplayer, struct tile *ptile);
66 void map_show_circle(struct player *pplayer,
67 struct tile *ptile, int radius_sq);
68 void map_vision_update(struct player *pplayer, struct tile *ptile,
69 const v_radius_t old_radius_sq,
70 const v_radius_t new_radius_sq,
71 bool can_reveal_tiles);
72 void map_set_border_vision(struct player *pplayer,
73 const bool is_enabled);
74 void map_show_all(struct player *pplayer);
76 bool map_is_known_and_seen(const struct tile *ptile,
77 const struct player *pplayer,
78 enum vision_layer vlayer);
79 bool map_is_known(const struct tile *ptile, const struct player *pplayer);
80 void map_set_known(struct tile *ptile, struct player *pplayer);
81 void map_clear_known(struct tile *ptile, struct player *pplayer);
82 void map_know_and_see_all(struct player *pplayer);
83 void show_map_to_all(void);
85 void player_map_init(struct player *pplayer);
86 void player_map_free(struct player *pplayer);
87 void remove_player_from_maps(struct player *pplayer);
89 struct vision_site *map_get_player_city(const struct tile *ptile,
90 const struct player *pplayer);
91 struct vision_site *map_get_player_site(const struct tile *ptile,
92 const struct player *pplayer);
93 struct player_tile *map_get_player_tile(const struct tile *ptile,
94 const struct player *pplayer);
95 bool update_player_tile_knowledge(struct player *pplayer,struct tile *ptile);
96 void update_tile_knowledge(struct tile *ptile);
97 void update_player_tile_last_seen(struct player *pplayer, struct tile *ptile);
99 void give_shared_vision(struct player *pfrom, struct player *pto);
100 void remove_shared_vision(struct player *pfrom, struct player *pto);
101 bool really_gives_vision(struct player *me, struct player *them);
103 void enable_fog_of_war(void);
104 void disable_fog_of_war(void);
105 void enable_fog_of_war_player(struct player *pplayer);
106 void disable_fog_of_war_player(struct player *pplayer);
108 void map_calculate_borders(void);
109 void map_claim_border(struct tile *ptile, struct player *powner,
110 int radius_sq);
111 void map_claim_ownership(struct tile *ptile, struct player *powner,
112 struct tile *psource, bool claim_bases);
113 void map_clear_border(struct tile *ptile);
114 void map_update_border(struct tile *ptile, struct player *owner,
115 int old_radius_sq, int new_radius_sq);
117 void tile_claim_bases(struct tile *ptile, struct player *powner);
118 void map_claim_base(struct tile *ptile, struct extra_type *pextra,
119 struct player *powner, struct player *ploser);
121 void terrain_changed(struct tile *ptile);
122 void check_terrain_change(struct tile *ptile, struct terrain *oldter);
123 void fix_tile_on_terrain_change(struct tile *ptile,
124 struct terrain *oldter,
125 bool extend_rivers);
126 bool need_to_reassign_continents(const struct terrain *oldter,
127 const struct terrain *newter);
128 void bounce_units_on_terrain_change(struct tile *ptile);
130 void vision_change_sight(struct vision *vision,
131 const v_radius_t radius_sq);
132 void vision_clear_sight(struct vision *vision);
134 void change_playertile_site(struct player_tile *ptile,
135 struct vision_site *new_site);
137 void create_extra(struct tile *ptile, struct extra_type *pextra,
138 struct player *pplayer);
139 void destroy_extra(struct tile *ptile, struct extra_type *pextra);
141 void give_distorted_map(struct player *pfrom, struct player *pto, int good,
142 int bad, bool reveal_cities);
144 #endif /* FC__MAPHAND_H */