Freeciv-3.1: /fast/freeciv/nightly/S3_1/common/fc_interface.h Source File

Freeciv-3.1

Loading...
Searching...
No Matches
fc_interface.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__FC_INTERFACE_H
14#define FC__FC_INTERFACE_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* utility */
21#include "support.h"
22
23/* common */
24#include "fc_types.h"
25#include "vision.h"
26
27struct player;
28struct tile;
29struct color;
30struct extra_type;
31
32/* The existence of each function should be checked in interface_init()! */
33 struct functions {
34 server_setting_id (*server_setting_by_name)(const char *name);
35 const char *(*server_setting_name_get)(server_setting_id id);
36 enum sset_type (*server_setting_type_get)(server_setting_id id);
37 bool (*server_setting_val_bool_get)(server_setting_id id);
38 int (*server_setting_val_int_get)(server_setting_id id);
39 unsigned int (*server_setting_val_bitwise_get)(server_setting_id id);
40 void (*create_extra)(struct tile *ptile, struct extra_type *pextra,
41 struct player *pplayer);
42 void (*destroy_extra)(struct tile *ptile, struct extra_type *pextra);
43 void (*destroy_city)(struct city *pcity);
44 /* Returns iff the player 'pplayer' has the vision in the layer
45 'vision' at tile given by 'ptile'. */
46 bool (*player_tile_vision_get)(const struct tile *ptile,
47 const struct player *pplayer,
48 enum vision_layer vision);
49 /* Returns the id of the city 'pplayer' believes exists at 'ptile' or
50 * IDENTITY_NUMBER_ZERO when the player is unaware of a city at that
51 * location. */
52 int (*player_tile_city_id_get)(const struct tile *ptile,
53 const struct player *pplayer);
54 void (*gui_color_free)(struct color *pcolor);
55};
56
57extern const struct functions *fc_funcs;
58
59struct functions *fc_interface_funcs(void);
60void libfreeciv_init(bool check_fc_interface);
61void libfreeciv_free(void);
62
63extern bool am_i_server;
64
65
66/**********************************************************************/
69 static inline bool is_server(void)
70{
71 return am_i_server;
72}
73
74void i_am_server(void);
75void i_am_client(void);
76
77/**********************************************************************/
80 static inline void i_am_tool(void)
81{
82 i_am_server(); /* No difference between a tool and server at the moment */
83}
84
85#ifdef __cplusplus
86}
87#endif /* __cplusplus */
88
89#endif /* FC__FC_INTERFACE_H */
pcolor
struct canvas int int struct sprite bool int int fog_y struct canvas struct sprite struct color * pcolor
Definition canvas_g.h:57
id
int int id
Definition editgui_g.h:28
i_am_server
void i_am_server(void)
Definition fc_interface.c:57
i_am_client
void i_am_client(void)
Definition fc_interface.c:65
fc_funcs
const struct functions * fc_funcs
Definition fc_interface.c:38
i_am_tool
static void i_am_tool(void)
Definition fc_interface.h:80
libfreeciv_init
void libfreeciv_init(bool check_fc_interface)
Definition fc_interface.c:74
libfreeciv_free
void libfreeciv_free(void)
Definition fc_interface.c:103
is_server
static bool is_server(void)
Definition fc_interface.h:69
fc_interface_funcs
struct functions * fc_interface_funcs(void)
Definition fc_interface.c:47
am_i_server
bool am_i_server
Definition game.c:60
fc_types.h
server_setting_id
int server_setting_id
Definition fc_types.h:924
name
const char * name
Definition inputfile.c:127
city
Definition city.h:309
color
Definition colors.h:20
extra_type
Definition extras.h:85
functions
Definition fc_interface.h:33
functions::player_tile_city_id_get
int(* player_tile_city_id_get)(const struct tile *ptile, const struct player *pplayer)
Definition fc_interface.h:52
functions::server_setting_val_int_get
int(* server_setting_val_int_get)(server_setting_id id)
Definition fc_interface.h:38
functions::player_tile_vision_get
bool(* player_tile_vision_get)(const struct tile *ptile, const struct player *pplayer, enum vision_layer vision)
Definition fc_interface.h:46
functions::server_setting_val_bool_get
bool(* server_setting_val_bool_get)(server_setting_id id)
Definition fc_interface.h:37
functions::destroy_city
void(* destroy_city)(struct city *pcity)
Definition fc_interface.h:43
functions::destroy_extra
void(* destroy_extra)(struct tile *ptile, struct extra_type *pextra)
Definition fc_interface.h:42
functions::server_setting_by_name
server_setting_id(* server_setting_by_name)(const char *name)
Definition fc_interface.h:34
functions::server_setting_val_bitwise_get
unsigned int(* server_setting_val_bitwise_get)(server_setting_id id)
Definition fc_interface.h:39
functions::create_extra
void(* create_extra)(struct tile *ptile, struct extra_type *pextra, struct player *pplayer)
Definition fc_interface.h:40
functions::server_setting_type_get
enum sset_type(* server_setting_type_get)(server_setting_id id)
Definition fc_interface.h:36
functions::gui_color_free
void(* gui_color_free)(struct color *pcolor)
Definition fc_interface.h:54
player
Definition player.h:249
tile
Definition tile.h:49
vision
Definition vision.h:85
support.h
bool
#define bool
Definition support.h:61
vision.h