[CODE] Crash_extract_norents_from_equipped

From: Andrey Fidrya (andrey@alex-ua.com)
Date: 06/04/99


While patching in last bpl, I saw the new Crash_exract_norents_from_equipped
function and was completely shocked! It can be simplified a lot:

-void Crash_extract_norents_from_equipped(struct char_data *ch)
-{
-  int j;
-  struct obj_data *obj;
-
-  for (j = 0; j < NUM_WEARS; j++) {
-    if ((obj = GET_EQ(ch, j)) == NULL)  /* A huge || looks ugly. */
-      continue;
-    else if (IS_OBJ_STAT(obj, ITEM_NORENT))
-      obj_to_char(unequip_char(ch, j), ch);
-    else if (GET_OBJ_RENT(obj) < 0)
-      obj_to_char(unequip_char(ch, j), ch);
-    else if (GET_OBJ_RNUM(obj) <= NOTHING)
-      obj_to_char(unequip_char(ch, j), ch);
-    else if (GET_OBJ_TYPE(obj) == ITEM_KEY)
-      obj_to_char(unequip_char(ch, j), ch);
-    else
-      Crash_extract_norents(obj);
-  }
-}

+void Crash_extract_norents_from_equipped(struct char_data *ch)
+{
+  int j;
+
+  for (j = 0; j < NUM_WEARS; j++) {
+    if (GET_EQ(ch, j)) {
+      if (Crash_is_unrentable(GET_EQ(ch, j)))
+        obj_to_char(unequip_char(ch, j), ch);
+      else
+        Crash_extract_norents(GET_EQ(ch, j));
+    }
+  }
+}

Zmey // 3MoonsWorld (rmud.net.ru:4000)


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST