Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/climisc.h Source File

Freeciv-3.1

Loading...
Searching...
No Matches
climisc.h
Go to the documentation of this file.
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.
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__CLIMISC_H
14#define FC__CLIMISC_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* common */
21#include "fc_types.h"
22#include "featured_text.h" /* struct ft_color */
23#include "events.h"
24#include "unittype.h"
25#include "unitlist.h"
26
27struct Clause;
28struct nation_type;
29struct nation_set;
30
31 typedef int cid;
32
33 void client_remove_player(int plrno);
34void client_remove_city(struct city *pcity);
35void client_remove_unit(struct unit *punit);
36
37void client_change_all(struct universal *from,
38 struct universal *to);
39
40const char *get_embassy_status(const struct player *me,
41 const struct player *them);
42const char *get_vision_status(const struct player *me,
43 const struct player *them);
44void client_diplomacy_clause_string(char *buf, int bufsiz,
45 struct Clause *pclause);
46
47void global_warming_scaled(int *chance, int *rate, int max);
48void nuclear_winter_scaled(int *chance, int *rate, int max);
49
50struct sprite *client_research_sprite(void);
51struct sprite *client_warming_sprite(void);
52struct sprite *client_cooling_sprite(void);
53struct sprite *client_government_sprite(void);
54
55void center_on_something(void);
56
57/*
58 * A compound id (cid) can hold all objects a city can build:
59 * improvements (with wonders) and units. This is achieved by
60 * seperation the value set: a cid < B_LAST denotes a improvement
61 * (including wonders). A cid >= B_LAST denotes a unit with the
62 * unit_type_id of (cid - B_LAST).
63 */
64
65 cid cid_encode(struct universal target);
66 cid cid_encode_unit(const struct unit_type *punittype);
67 cid cid_encode_building(const struct impr_type *pimprove);
68 cid cid_encode_from_city(const struct city *pcity);
69
70struct universal cid_decode(cid cid);
71#define cid_production cid_decode
72
73bool city_unit_supported(const struct city *pcity,
74 const struct universal *target);
75bool city_unit_present(const struct city *pcity,
76 const struct universal *target);
77bool city_building_present(const struct city *pcity,
78 const struct universal *target);
79
80 struct item {
81 struct universal item;
82 char descr[MAX_LEN_NAME + 40];
83};
84
85 typedef bool (*TestCityFunc)(const struct city *, const struct universal *);
86
87#define MAX_NUM_PRODUCTION_TARGETS (U_LAST + B_LAST)
88void name_and_sort_items(struct universal *targets, int num_items,
89 struct item *items,
90 bool show_cost, struct city *pcity);
91int collect_production_targets(struct universal *targets,
92 struct city **selected_cities,
93 int num_selected_cities, bool append_units,
94 bool append_wonders, bool change_prod,
95 TestCityFunc test_func);
96int collect_currently_building_targets(struct universal *targets);
97int collect_buildable_targets(struct universal *targets);
98int collect_eventually_buildable_targets(struct universal *targets,
99 struct city *pcity,
100 bool advanced_tech);
101int collect_already_built_targets(struct universal *targets,
102 struct city *pcity);
103
104/* the number of units in city */
105int num_present_units_in_city(struct city* pcity);
106int num_supported_units_in_city(struct city* pcity);
107
108void handle_event(const char *featured_text, struct tile *ptile,
109 enum event_type event, int turn, int phase, int conn_id);
110 void create_event(struct tile *ptile, enum event_type event,
111 const struct ft_color color, const char *format, ...)
112 fc__attribute((__format__ (__printf__, 4, 5)));
113
114struct city *get_nearest_city(const struct unit *punit, int *sq_dist);
115
116void cityrep_buy(struct city *pcity);
117void common_taxrates_callback(int idx, bool reverse);
118
119bool can_units_do_connect(struct unit_list *punits,
120 enum unit_activity activity,
121 struct extra_type *tgt);
122
123void client_unit_init_act_prob_cache(struct unit *punit);
124
125enum unit_bg_color_type { UNIT_BG_HP_LOSS,
126 UNIT_BG_LAND,
127 UNIT_BG_SEA,
128 UNIT_BG_AMPHIBIOUS,
129 UNIT_BG_FLYING };
130
131enum unit_bg_color_type unit_color_type(const struct unit_type *punittype);
132
133void buy_production_in_selected_cities(void);
134
135void unit_focus_set_status(struct player *pplayer);
136
137void client_player_init(struct player *pplayer);
138
139void client_player_maps_reset(void);
140
141bool mapimg_client_define(void);
142bool mapimg_client_createmap(const char *filename);
143
144struct nation_set *client_current_nation_set(void);
145bool client_nation_is_in_current_set(const struct nation_type *pnation);
146
147enum ai_level server_ai_level(void);
148
149#ifdef __cplusplus
150}
151#endif /* __cplusplus */
152
153#endif /* FC__CLIMISC_H */
collect_eventually_buildable_targets
int collect_eventually_buildable_targets(struct universal *targets, struct city *pcity, bool advanced_tech)
Definition climisc.c:802
city_unit_supported
bool city_unit_supported(const struct city *pcity, const struct universal *target)
Definition climisc.c:537
server_ai_level
enum ai_level server_ai_level(void)
Definition climisc.c:1501
client_change_all
void client_change_all(struct universal *from, struct universal *to)
Definition climisc.c:165
cid_encode_building
cid cid_encode_building(const struct impr_type *pimprove)
Definition climisc.c:497
collect_buildable_targets
int collect_buildable_targets(struct universal *targets)
Definition climisc.c:771
cid_decode
struct universal cid_decode(cid cid)
Definition climisc.c:518
client_player_init
void client_player_init(struct player *pplayer)
Definition climisc.c:1355
get_nearest_city
void struct city * get_nearest_city(const struct unit *punit, int *sq_dist)
Definition climisc.c:1101
mapimg_client_createmap
bool mapimg_client_createmap(const char *filename)
Definition climisc.c:1448
client_remove_city
void client_remove_city(struct city *pcity)
Definition climisc.c:134
client_unit_init_act_prob_cache
void client_unit_init_act_prob_cache(struct unit *punit)
Definition climisc.c:1241
nuclear_winter_scaled
void nuclear_winter_scaled(int *chance, int *rate, int max)
Definition climisc.c:338
get_embassy_status
const char * get_embassy_status(const struct player *me, const struct player *them)
Definition climisc.c:194
buy_production_in_selected_cities
void buy_production_in_selected_cities(void)
Definition climisc.c:1299
common_taxrates_callback
void common_taxrates_callback(int idx, bool reverse)
Definition climisc.c:1176
mapimg_client_define
bool mapimg_client_define(void)
Definition climisc.c:1391
collect_currently_building_targets
int collect_currently_building_targets(struct universal *targets)
Definition climisc.c:739
unit_color_type
enum unit_bg_color_type unit_color_type(const struct unit_type *punittype)
Definition climisc.c:1257
client_warming_sprite
struct sprite * client_warming_sprite(void)
Definition climisc.c:371
name_and_sort_items
void name_and_sort_items(struct universal *targets, int num_items, struct item *items, bool show_cost, struct city *pcity)
Definition climisc.c:633
can_units_do_connect
bool can_units_do_connect(struct unit_list *punits, enum unit_activity activity, struct extra_type *tgt)
Definition climisc.c:1224
cid
int cid
Definition climisc.h:31
cityrep_buy
void cityrep_buy(struct city *pcity)
Definition climisc.c:1137
global_warming_scaled
void global_warming_scaled(int *chance, int *rate, int max)
Definition climisc.c:328
client_player_maps_reset
void client_player_maps_reset(void)
Definition climisc.c:1366
client_nation_is_in_current_set
bool client_nation_is_in_current_set(const struct nation_type *pnation)
Definition climisc.c:1491
cid_encode_from_city
cid cid_encode_from_city(const struct city *pcity)
Definition climisc.c:510
TestCityFunc
bool(* TestCityFunc)(const struct city *, const struct universal *)
Definition climisc.h:85
client_cooling_sprite
struct sprite * client_cooling_sprite(void)
Definition climisc.c:388
client_research_sprite
struct sprite * client_research_sprite(void)
Definition climisc.c:348
create_event
void create_event(struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...) fc__attribute((__format__(__printf__
num_present_units_in_city
int num_present_units_in_city(struct city *pcity)
Definition climisc.c:933
cid_encode
cid cid_encode(struct universal target)
Definition climisc.c:475
client_remove_unit
void client_remove_unit(struct unit *punit)
Definition climisc.c:72
city_building_present
bool city_building_present(const struct city *pcity, const struct universal *target)
Definition climisc.c:575
client_current_nation_set
struct nation_set * client_current_nation_set(void)
Definition climisc.c:1474
num_supported_units_in_city
int num_supported_units_in_city(struct city *pcity)
Definition climisc.c:915
collect_already_built_targets
int collect_already_built_targets(struct universal *targets, struct city *pcity)
Definition climisc.c:895
client_remove_player
void client_remove_player(int plrno)
unit_focus_set_status
void unit_focus_set_status(struct player *pplayer)
Definition climisc.c:1345
handle_event
void handle_event(const char *featured_text, struct tile *ptile, enum event_type event, int turn, int phase, int conn_id)
Definition climisc.c:950
center_on_something
void center_on_something(void)
Definition climisc.c:424
unit_bg_color_type
unit_bg_color_type
Definition climisc.h:125
UNIT_BG_AMPHIBIOUS
@ UNIT_BG_AMPHIBIOUS
Definition climisc.h:128
UNIT_BG_SEA
@ UNIT_BG_SEA
Definition climisc.h:127
UNIT_BG_FLYING
@ UNIT_BG_FLYING
Definition climisc.h:129
UNIT_BG_LAND
@ UNIT_BG_LAND
Definition climisc.h:126
UNIT_BG_HP_LOSS
@ UNIT_BG_HP_LOSS
Definition climisc.h:125
cid_encode_unit
cid cid_encode_unit(const struct unit_type *punittype)
Definition climisc.c:485
client_diplomacy_clause_string
void client_diplomacy_clause_string(char *buf, int bufsiz, struct Clause *pclause)
Definition climisc.c:241
get_vision_status
const char * get_vision_status(const struct player *me, const struct player *them)
Definition climisc.c:222
client_government_sprite
struct sprite * client_government_sprite(void)
Definition climisc.c:406
city_unit_present
bool city_unit_present(const struct city *pcity, const struct universal *target)
Definition climisc.c:556
collect_production_targets
int collect_production_targets(struct universal *targets, struct city **selected_cities, int num_selected_cities, bool append_units, bool append_wonders, bool change_prod, TestCityFunc test_func)
Definition climisc.c:683
punit
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:73
event
enum event_type event
Definition events.c:81
events.h
fc_types.h
MAX_LEN_NAME
#define MAX_LEN_NAME
Definition fc_types.h:66
featured_text.h
Clause
Definition diptreaty.h:70
city
Definition city.h:309
color
Definition colors.h:20
extra_type
Definition extras.h:85
ft_color
Definition featured_text.h:141
impr_type
Definition improvement.h:68
item
Definition climisc.h:80
item::descr
char descr[MAX_LEN_NAME+40]
Definition climisc.h:82
nation_set
Definition nation.c:40
nation_type
Definition nation.h:97
player
Definition player.h:249
sprite
Definition sprite.h:22
test_func
Definition mapgen.c:679
tile
Definition tile.h:49
unit_type
Definition unittype.h:481
unit
Definition unit.h:138
universal
Definition fc_types.h:756
fc__attribute
#define fc__attribute(x)
Definition support.h:89
bool
#define bool
Definition support.h:61
unitlist.h
unittype.h