Stop sharing requirement_unit_state_ereq().
[freeciv.git] / common / fc_interface.c
bloba479d723c8ec12e499d958934c05144046a95c3b
1 /****************************************************************************
2 Freeciv - Copyright (C) 2004 - The Freeciv Team
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 ****************************************************************************/
14 #ifdef HAVE_CONFIG_H
15 #include <fc_config.h>
16 #endif
18 /* utility */
19 #include "shared.h"
21 /* common */
22 #include "player.h"
23 #include "tile.h"
24 #include "vision.h"
26 #include "fc_interface.h"
28 /* Struct with functions pointers; the functions are defined in
29 ./client/client_main.c:init_client_functions() and
30 ./server/srv_main.c:init_server_functions(). */
31 struct functions fc_functions;
33 /* The functions are accessed via this pointer. */
34 const struct functions *fc_funcs = NULL;
35 /* After this is set to TRUE (in interface_init()), the functions are
36 available via fc_funcs. */
37 bool fc_funcs_defined = FALSE;
39 /**************************************************************************
40 Return the function pointer. Only possible before interface_init() was
41 called (fc_funcs_defined == FALSE).
42 **************************************************************************/
43 struct functions *fc_interface_funcs(void)
45 fc_assert_exit(fc_funcs_defined == FALSE);
47 return &fc_functions;
50 /**************************************************************************
51 Test and initialize the functions. The existence of all functions should
52 be checked!
53 **************************************************************************/
54 void fc_interface_init(void)
56 fc_funcs = &fc_functions;
58 /* Test the existence of each required function here! */
59 fc_assert_exit(fc_funcs->player_tile_vision_get);
60 fc_assert_exit(fc_funcs->player_tile_city_id_get);
61 fc_assert_exit(fc_funcs->gui_color_free);
63 fc_funcs_defined = TRUE;
65 fc_strAPI_init();
67 setup_real_activities_array();
70 /**************************************************************************
71 Free misc resources allocated for libfreeciv.
72 **************************************************************************/
73 void free_libfreeciv(void)
75 diplrel_mess_close();
76 free_data_dir_names();
77 free_multicast_group();
78 free_freeciv_storage_dir();
79 free_user_home_dir();
80 free_fileinfo_data();
81 fc_strAPI_free();