Author: sveinung Date: Fri Apr 28 12:04:21 2017 New Revision: 35322 URL: http://svn.gna.org/viewcvs/freeciv?rev=35322&view=rev Log: Implement fc_interface for freeciv-manual.
See hrm Bug #655527 Modified: branches/S3_0/server/srv_main.c branches/S3_0/server/srv_main.h branches/S3_0/tools/civmanual.c Modified: branches/S3_0/server/srv_main.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/srv_main.c?rev=35322&r1=35321&r2=35322&view=diff ============================================================================== --- branches/S3_0/server/srv_main.c (original) +++ branches/S3_0/server/srv_main.c Fri Apr 28 12:04:21 2017 @@ -3266,7 +3266,7 @@ /*************************************************************************** Returns the id of the server setting with the specified name. ***************************************************************************/ -static server_setting_id server_ss_by_name(const char *name) +server_setting_id server_ss_by_name(const char *name) { struct setting *pset = setting_by_name(name); @@ -3281,7 +3281,7 @@ /*************************************************************************** Returns the name of the server setting with the specified id. ***************************************************************************/ -static const char *server_ss_name_get(server_setting_id id) +const char *server_ss_name_get(server_setting_id id) { struct setting *pset = setting_by_number(id); @@ -3296,7 +3296,7 @@ /*************************************************************************** Returns the type of the server setting with the specified id. ***************************************************************************/ -static enum sset_type server_ss_type_get(server_setting_id id) +enum sset_type server_ss_type_get(server_setting_id id) { struct setting *pset = setting_by_number(id); @@ -3311,7 +3311,7 @@ /*************************************************************************** Returns the value of the boolean server setting with the specified id. ***************************************************************************/ -static bool server_ss_val_bool_get(server_setting_id id) +bool server_ss_val_bool_get(server_setting_id id) { struct setting *pset = setting_by_number(id); Modified: branches/S3_0/server/srv_main.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/srv_main.h?rev=35322&r1=35321&r2=35322&view=diff ============================================================================== --- branches/S3_0/server/srv_main.h (original) +++ branches/S3_0/server/srv_main.h Fri Apr 28 12:04:21 2017 @@ -99,6 +99,11 @@ bool check_for_game_over(void); bool game_was_started(void); +server_setting_id server_ss_by_name(const char *name); +const char *server_ss_name_get(server_setting_id id); +enum sset_type server_ss_type_get(server_setting_id id); +bool server_ss_val_bool_get(server_setting_id id); + bool server_packet_input(struct connection *pconn, void *packet, int type); void start_game(void); const char *pick_random_player_name(const struct nation_type *pnation); Modified: branches/S3_0/tools/civmanual.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/tools/civmanual.c?rev=35322&r1=35321&r2=35322&view=diff ============================================================================== --- branches/S3_0/tools/civmanual.c (original) +++ branches/S3_0/tools/civmanual.c Fri Apr 28 12:04:21 2017 @@ -659,6 +659,58 @@ } /* manuals */ return TRUE; +} + +/*************************************************************************** + Unused but required by fc_interface_init() +***************************************************************************/ +static bool tool_player_tile_vision_get(const struct tile *ptile, + const struct player *pplayer, + enum vision_layer vision) +{ + log_error("Assumed unused function %s called.", __FUNCTION__); + return FALSE; +} + +/*************************************************************************** + Unused but required by fc_interface_init() +***************************************************************************/ +static int tool_player_tile_city_id_get(const struct tile *ptile, + const struct player *pplayer) +{ + log_error("Assumed unused function %s called.", __FUNCTION__); + return IDENTITY_NUMBER_ZERO; +} + +/*************************************************************************** + Unused but required by fc_interface_init() +***************************************************************************/ +static void tool_gui_color_free(struct color *pcolor) +{ + log_error("Assumed unused function %s called.", __FUNCTION__); +} + +/*************************************************************** + Initialize tool specific functions. +***************************************************************/ +static void fc_interface_init_tool(void) +{ + struct functions *funcs = fc_interface_funcs(); + + /* May be used when generating help texts */ + funcs->server_setting_by_name = server_ss_by_name; + funcs->server_setting_name_get = server_ss_name_get; + funcs->server_setting_type_get = server_ss_type_get; + funcs->server_setting_val_bool_get = server_ss_val_bool_get; + + /* Not used. Set to dummy functions. */ + funcs->player_tile_vision_get = tool_player_tile_vision_get; + funcs->player_tile_city_id_get = tool_player_tile_city_id_get; + funcs->gui_color_free = tool_gui_color_free; + + /* Keep this function call at the end. It checks if all required functions + are defined. */ + fc_interface_init(); } /************************************************************************** @@ -731,6 +783,10 @@ /* Get common code to treat us as a tool. */ i_am_tool(); + /* Initialize the fc_interface functions needed to generate the help + * text. */ + fc_interface_init_tool(); + /* Initialize game with default values */ game_init(); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits