Author: sveinung
Date: Sun Apr 23 15:05:00 2017
New Revision: 35279

URL: http://svn.gna.org/viewcvs/freeciv?rev=35279&view=rev
Log:
Populate the server setting module.

Build server setting access functions on top of the functions exported in
the interface.

See hrm Feature #653904

Added:
    trunk/common/server_settings.c
Modified:
    trunk/common/Makefile.am
    trunk/common/server_settings.h

Modified: trunk/common/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/Makefile.am?rev=35279&r1=35278&r2=35279&view=diff
==============================================================================
--- trunk/common/Makefile.am    (original)
+++ trunk/common/Makefile.am    Sun Apr 23 15:05:00 2017
@@ -92,6 +92,7 @@
                road.c          \
                road.h          \
                server_settings.h \
+               server_settings.c \
                spaceship.c     \
                spaceship.h     \
                specialist.c    \

Added: trunk/common/server_settings.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/server_settings.c?rev=35279&view=auto
==============================================================================
--- trunk/common/server_settings.c      (added)
+++ trunk/common/server_settings.c      Sun Apr 23 15:05:00 2017
@@ -0,0 +1,53 @@
+/***********************************************************************
+ Freeciv - Copyright (C) 2017 - Freeciv Development Team
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***********************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <fc_config.h>
+#endif
+
+/* common */
+#include "fc_interface.h"
+
+#include "server_settings.h"
+
+/***************************************************************************
+  Returns the server setting with the specified name.
+***************************************************************************/
+server_setting_id server_setting_by_name(const char *name)
+{
+  return fc_funcs->server_setting_by_name(name);
+}
+
+/***************************************************************************
+  Returns the name of the server setting with the specified id.
+***************************************************************************/
+const char *server_setting_name_get(server_setting_id id)
+{
+  return fc_funcs->server_setting_name_get(id);
+}
+
+/***************************************************************************
+  Returns the type of the server setting with the specified id.
+***************************************************************************/
+enum sset_type server_setting_type_get(server_setting_id id)
+{
+  return fc_funcs->server_setting_type_get(id);
+}
+
+/***************************************************************************
+  Returns TRUE iff a server setting with the specified id exists.
+***************************************************************************/
+bool server_setting_exists(server_setting_id id)
+{
+  return sset_type_is_valid(server_setting_type_get(id));
+}

Modified: trunk/common/server_settings.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/server_settings.h?rev=35279&r1=35278&r2=35279&view=diff
==============================================================================
--- trunk/common/server_settings.h      (original)
+++ trunk/common/server_settings.h      Sun Apr 23 15:05:00 2017
@@ -34,6 +34,15 @@
 /* Mark server setting id's. */
 typedef int server_setting_id;
 
+
+/* Pure server settings. */
+server_setting_id server_setting_by_name(const char *name);
+bool server_setting_exists(server_setting_id id);
+
+enum sset_type server_setting_type_get(server_setting_id id);
+
+const char *server_setting_name_get(server_setting_id id);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to