Freeciv-3.2
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()! */
33struct functions {
35 const char *(*server_setting_name_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);
55};
56
57extern const struct functions *fc_funcs;
58
59struct functions *fc_interface_funcs(void);
61void libfreeciv_free(void);
62
63extern bool am_i_server;
64
65
66/**********************************************************************/
69static 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/**********************************************************************/
80static 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 */
struct canvas int int int int struct sprite *sprite struct canvas struct color * pcolor
Definition canvas_g.h:56
char * incite_cost
Definition comments.c:75
int int id
Definition editgui_g.h:28
void i_am_server(void)
void i_am_client(void)
const struct functions * fc_funcs
static void i_am_tool(void)
void libfreeciv_init(bool check_fc_interface)
void libfreeciv_free(void)
static bool is_server(void)
struct functions * fc_interface_funcs(void)
bool am_i_server
Definition game.c:65
int server_setting_id
Definition fc_types.h:1070
const char * name
Definition inputfile.c:127
Definition city.h:320
Definition colors.h:21
int(* player_tile_city_id_get)(const struct tile *ptile, const struct player *pplayer)
int(* server_setting_val_int_get)(server_setting_id id)
bool(* player_tile_vision_get)(const struct tile *ptile, const struct player *pplayer, enum vision_layer vision)
bool(* server_setting_val_bool_get)(server_setting_id id)
void(* destroy_city)(struct city *pcity)
void(* destroy_extra)(struct tile *ptile, struct extra_type *pextra)
server_setting_id(* server_setting_by_name)(const char *name)
unsigned int(* server_setting_val_bitwise_get)(server_setting_id id)
void(* create_extra)(struct tile *ptile, struct extra_type *pextra, struct player *pplayer)
enum sset_type(* server_setting_type_get)(server_setting_id id)
void(* gui_color_free)(struct color *pcolor)
Definition tile.h:50
#define bool
Definition support.h:71