From d082e245e4d0f3a09ab42c48043aea22e3cb3e7e Mon Sep 17 00:00:00 2001 From: sveinung Date: Sun, 23 Apr 2017 13:05:00 +0000 Subject: [PATCH] Populate the server setting module. Build server setting access functions on top of the functions exported in the interface. See hrm Feature #653904 git-svn-id: svn://svn.gna.org/svn/freeciv/trunk@35279 a0f10bec-cc02-0410-94fc-a9cfff90b4cd --- common/Makefile.am | 1 + common/server_settings.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ common/server_settings.h | 9 ++++++++ 3 files changed, 63 insertions(+) create mode 100644 common/server_settings.c diff --git a/common/Makefile.am b/common/Makefile.am index 0a798f4462..46adf78f1d 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -92,6 +92,7 @@ libfreeciv_la_SOURCES = \ road.c \ road.h \ server_settings.h \ + server_settings.c \ spaceship.c \ spaceship.h \ specialist.c \ diff --git a/common/server_settings.c b/common/server_settings.c new file mode 100644 index 0000000000..8cf6d5f797 --- /dev/null +++ b/common/server_settings.c @@ -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 +#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)); +} diff --git a/common/server_settings.h b/common/server_settings.h index d0b371cb91..4a930ccdb7 100644 --- a/common/server_settings.h +++ b/common/server_settings.h @@ -34,6 +34,15 @@ extern "C" { /* 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 */ -- 2.11.4.GIT