Re: [NEWBIE][CODE] invalid_race/invalid_class

From: George Greer (greerga@circlemud.org)
Date: 03/10/01


That function is awful for modifying.

Index: class.c
===================================================================
RCS file: /home/circledb/.cvs/circle/src/class.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -p -r1.17 -r1.18
--- class.c     1999/05/10 00:06:50     1.17
+++ class.c     2001/03/10 22:06:53     1.18
@@ -1605,15 +1605,21 @@ int backstab_mult(int level)
  * invalid_class is used by handler.c to determine if a piece of equipment is
  * usable by a particular class, based on the ITEM_ANTI_{class} bitvectors.
  */
+int invalid_class(struct char_data *ch, struct obj_data *obj)
+{
+  if (IS_OBJ_STAT(obj, ITEM_ANTI_MAGIC_USER) && IS_MAGIC_USER(ch))
+    return 1;

-int invalid_class(struct char_data *ch, struct obj_data *obj) {
-  if ((IS_OBJ_STAT(obj, ITEM_ANTI_MAGIC_USER) && IS_MAGIC_USER(ch)) ||
-      (IS_OBJ_STAT(obj, ITEM_ANTI_CLERIC) && IS_CLERIC(ch)) ||
-      (IS_OBJ_STAT(obj, ITEM_ANTI_WARRIOR) && IS_WARRIOR(ch)) ||
-      (IS_OBJ_STAT(obj, ITEM_ANTI_THIEF) && IS_THIEF(ch)))
-       return 1;
-  else
-       return 0;
+  if (IS_OBJ_STAT(obj, ITEM_ANTI_CLERIC) && IS_CLERIC(ch))
+    return 1;
+
+  if (IS_OBJ_STAT(obj, ITEM_ANTI_WARRIOR) && IS_WARRIOR(ch))
+    return 1;
+
+  if (IS_OBJ_STAT(obj, ITEM_ANTI_THIEF) && IS_THIEF(ch)))
+    return 1;
+
+  return 0;
 }

The above change will be included in bpl18, released on 3/18. (I hope)

--
George Greer            | If it's about the CircleMUD mailing list,
greerga@circlemud.org   | mail owner-circle@post.queensu.ca instead.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/04/01 PST