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)
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 ****************************************************************************/
15 #include <fc_config.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
);
50 /**************************************************************************
51 Test and initialize the functions. The existence of all functions should
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
;
67 setup_real_activities_array();
70 /**************************************************************************
71 Free misc resources allocated for libfreeciv.
72 **************************************************************************/
73 void free_libfreeciv(void)
76 free_data_dir_names();
77 free_multicast_group();
78 free_freeciv_storage_dir();