Author: sveinung
Date: Fri Apr 28 12:03:11 2017
New Revision: 35318

URL: http://svn.gna.org/viewcvs/freeciv?rev=35318&view=rev
Log:
Implement fc_interface for freeciv-manual.

See hrm Bug #655527

Modified:
    trunk/server/srv_main.c
    trunk/server/srv_main.h
    trunk/tools/civmanual.c

Modified: trunk/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=35318&r1=35317&r2=35318&view=diff
==============================================================================
--- trunk/server/srv_main.c     (original)
+++ trunk/server/srv_main.c     Fri Apr 28 12:03:11 2017
@@ -3267,7 +3267,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);
 
@@ -3282,7 +3282,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);
 
@@ -3297,7 +3297,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);
 
@@ -3312,7 +3312,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: trunk/server/srv_main.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.h?rev=35318&r1=35317&r2=35318&view=diff
==============================================================================
--- trunk/server/srv_main.h     (original)
+++ trunk/server/srv_main.h     Fri Apr 28 12:03:11 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: trunk/tools/civmanual.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/civmanual.c?rev=35318&r1=35317&r2=35318&view=diff
==============================================================================
--- trunk/tools/civmanual.c     (original)
+++ trunk/tools/civmanual.c     Fri Apr 28 12:03:11 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

Reply via email to