OasisOLC obj update

From: Kras Kresh (kras_kresh@hotmail.com)
Date: 08/02/01


After modifying an obj, the obj stats are changed in all the objects with
that vnum in the object_list. But it messes up the stats of a person that is
wearing it. What I've done is a unequip the person, update, and then
re-equip.

--- genobj.c.save       Thu Aug  2 14:10:14 2001
+++ genobj.c    Thu Aug  2 11:36:30 2001
@@ -16,6 +16,11 @@
#include "genobj.h"
#include "genzon.h"

+/* external functions */
+void equip_char(struct char_data * ch, struct obj_data * obj, int pos);
+struct obj_data *unequip_char(struct char_data * ch, int pos);
+
+
static int copy_object_main(struct obj_data *to, struct obj_data *from, int
free_object);

/* external variables */
@@ -68,17 +73,27 @@

     /* Update the existing object but save a copy for private information.
*/
     swap = *obj;
+
+    /* this should fix people wearing it */
+    if (obj->worn_by)
+      unequip_char(obj->worn_by, obj->worn_on);
+
     *obj = *refobj;

     /* Copy game-time dependent variables over. */
     obj->in_room = swap.in_room;
     obj->carried_by = swap.carried_by;
-    obj->worn_by = swap.worn_by;
-    obj->worn_on = swap.worn_on;
     obj->in_obj = swap.in_obj;
     obj->contains = swap.contains;
     obj->next_content = swap.next_content;
     obj->next = swap.next;
+
+    if (swap.worn_by)
+      equip_char(swap.worn_by, obj, swap.worn_on);
   }

   return count;


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
   +---------------------------------------------------------------+
   | 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/06/01 PST