Author: cazfi
Date: Wed May 18 20:07:31 2016
New Revision: 32747

URL: http://svn.gna.org/viewcvs/freeciv?rev=32747&view=rev
Log:
Inlined utype_has_flag() and uclass_has_flag()

See patch #7189

Modified:
    branches/S2_5/common/unittype.c
    branches/S2_5/common/unittype.h

Modified: branches/S2_5/common/unittype.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/unittype.c?rev=32747&r1=32746&r2=32747&view=diff
==============================================================================
--- branches/S2_5/common/unittype.c     (original)
+++ branches/S2_5/common/unittype.c     Wed May 18 20:07:31 2016
@@ -173,25 +173,6 @@
 }
 
 /**************************************************************************
-  Return whether the given unit class has the flag.
-**************************************************************************/
-bool uclass_has_flag(const struct unit_class *punitclass,
-                     enum unit_class_flag_id flag)
-{
-  fc_assert_ret_val(unit_class_flag_id_is_valid(flag), FALSE);
-  return BV_ISSET(punitclass->flags, flag);
-}
-
-/**************************************************************************
-  Return whether the given unit type has the flag.
-**************************************************************************/
-bool utype_has_flag(const struct unit_type *punittype, int flag)
-{
-  fc_assert_ret_val(unit_type_flag_id_is_valid(flag), FALSE);
-  return BV_ISSET(punittype->flags, flag);
-}
-
-/**************************************************************************
   Return whether the unit has the given flag.
 **************************************************************************/
 bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)

Modified: branches/S2_5/common/unittype.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/unittype.h?rev=32747&r1=32746&r2=32747&view=diff
==============================================================================
--- branches/S2_5/common/unittype.h     (original)
+++ branches/S2_5/common/unittype.h     Wed May 18 20:07:31 2016
@@ -499,7 +499,14 @@
 
 /* General unit type flag and role routines */
 bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag);
-bool utype_has_flag(const struct unit_type *punittype, int flag);
+
+/**************************************************************************
+  Return whether the given unit type has the flag.
+**************************************************************************/
+static inline bool utype_has_flag(const struct unit_type *punittype, int flag)
+{
+  return BV_ISSET(punittype->flags, flag);
+}
 
 bool unit_has_type_role(const struct unit *punit, enum unit_role_id role);
 bool utype_has_role(const struct unit_type *punittype, int role);
@@ -555,8 +562,14 @@
 const char *uclass_rule_name(const struct unit_class *pclass);
 const char *uclass_name_translation(const struct unit_class *pclass);
 
-bool uclass_has_flag(const struct unit_class *punitclass,
-                     enum unit_class_flag_id flag);
+/**************************************************************************
+  Return whether the given unit class has the flag.
+**************************************************************************/
+static inline bool uclass_has_flag(const struct unit_class *punitclass,
+                                   enum unit_class_flag_id flag)
+{
+  return BV_ISSET(punitclass->flags, flag);
+}
 
 /* Ancillary routines */
 int unit_build_shield_cost(const struct unit *punit);


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

Reply via email to