Author: sveinung
Date: Sat May 13 23:24:35 2017
New Revision: 35565

URL: http://svn.gna.org/viewcvs/freeciv?rev=35565&view=rev
Log:
Setting visibility to access level checker.

Make it possible to check if a server setting is visible to any player with
a certain access level rather than checking if a server setting is visible
to a specific player (based on his access level).

See hrm Feature #659408

Modified:
    branches/S3_0/server/settings.c
    branches/S3_0/server/settings.h

Modified: branches/S3_0/server/settings.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/settings.c?rev=35565&r1=35564&r2=35565&view=diff
==============================================================================
--- branches/S3_0/server/settings.c     (original)
+++ branches/S3_0/server/settings.c     Sat May 13 23:24:35 2017
@@ -3106,6 +3106,16 @@
 }
 
 /****************************************************************************
+  Returns whether the specified server setting (option) can be seen by a
+  caller with the specified access level.
+****************************************************************************/
+bool setting_is_visible_at_level(const struct setting *pset,
+                                 enum cmdlevel plevel)
+{
+  return (plevel >= pset->access_level_read);
+}
+
+/****************************************************************************
   Returns whether the specified server setting (option) can be seen by the
   caller.
 ****************************************************************************/
@@ -3113,7 +3123,7 @@
                         struct connection *caller)
 {
   return (!caller
-          || caller->access_level >= pset->access_level_read);
+          || setting_is_visible_at_level(pset, caller->access_level));
 }
 
 /****************************************************************************

Modified: branches/S3_0/server/settings.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/settings.h?rev=35565&r1=35564&r2=35565&view=diff
==============================================================================
--- branches/S3_0/server/settings.h     (original)
+++ branches/S3_0/server/settings.h     Sat May 13 23:24:35 2017
@@ -92,6 +92,8 @@
 bool setting_is_changeable(const struct setting *pset,
                            struct connection *caller, char *reject_msg,
                            size_t reject_msg_len);
+bool setting_is_visible_at_level(const struct setting *pset,
+                                 enum cmdlevel plevel);
 bool setting_is_visible(const struct setting *pset,
                         struct connection *caller);
 


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

Reply via email to