Prevented building advisor from randomly building, and thus potentially just moving...
[freeciv.git] / server / maphand.h
blob885302d4cbc9598a1f27009445c4aa804f3bc05e
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 resource *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_show_all(struct player *pplayer);
74 bool map_is_known_and_seen(const struct tile *ptile,
75 const struct player *pplayer,
76 enum vision_layer vlayer);
77 bool map_is_known(const struct tile *ptile, const struct player *pplayer);
78 void map_set_known(struct tile *ptile, struct player *pplayer);
79 void map_clear_known(struct tile *ptile, struct player *pplayer);
80 void map_know_and_see_all(struct player *pplayer);
81 void show_map_to_all(void);
83 void player_map_init(struct player *pplayer);
84 void player_map_free(struct player *pplayer);
85 void remove_player_from_maps(struct player *pplayer);
87 struct vision_site *map_get_player_city(const struct tile *ptile,
88 const struct player *pplayer);
89 struct vision_site *map_get_player_site(const struct tile *ptile,
90 const struct player *pplayer);
91 struct player_tile *map_get_player_tile(const struct tile *ptile,
92 const struct player *pplayer);
93 bool update_player_tile_knowledge(struct player *pplayer,struct tile *ptile);
94 void update_tile_knowledge(struct tile *ptile);
95 void update_player_tile_last_seen(struct player *pplayer, struct tile *ptile);
97 void give_shared_vision(struct player *pfrom, struct player *pto);
98 void remove_shared_vision(struct player *pfrom, struct player *pto);
99 bool really_gives_vision(struct player *me, struct player *them);
101 void enable_fog_of_war(void);
102 void disable_fog_of_war(void);
103 void enable_fog_of_war_player(struct player *pplayer);
104 void disable_fog_of_war_player(struct player *pplayer);
106 void map_calculate_borders(void);
107 void map_claim_border(struct tile *ptile, struct player *powner,
108 int radius_sq);
109 void map_claim_ownership(struct tile *ptile, struct player *powner,
110 struct tile *psource, bool claim_bases);
111 void map_clear_border(struct tile *ptile);
112 void map_update_border(struct tile *ptile, struct player *owner,
113 int old_radius_sq, int new_radius_sq);
115 void tile_claim_bases(struct tile *ptile, struct player *powner);
116 void map_claim_base(struct tile *ptile, struct extra_type *pextra,
117 struct player *powner, struct player *ploser);
119 void terrain_changed(struct tile *ptile);
120 void check_terrain_change(struct tile *ptile, struct terrain *oldter);
121 void fix_tile_on_terrain_change(struct tile *ptile,
122 struct terrain *oldter,
123 bool extend_rivers);
124 bool need_to_reassign_continents(const struct terrain *oldter,
125 const struct terrain *newter);
126 void bounce_units_on_terrain_change(struct tile *ptile);
128 void vision_change_sight(struct vision *vision,
129 const v_radius_t radius_sq);
130 void vision_clear_sight(struct vision *vision);
132 void change_playertile_site(struct player_tile *ptile,
133 struct vision_site *new_site);
135 void create_extra(struct tile *ptile, struct extra_type *pextra,
136 struct player *pplayer);
137 void destroy_extra(struct tile *ptile, struct extra_type *pextra);
139 void give_distorted_map(struct player *pfrom, struct player *pto, int good,
140 int bad, bool reveal_cities);
142 #endif /* FC__MAPHAND_H */