[ScryMUD] SVN Commit Info r736 - branches/version-2-1/mud/grrmud/server

scrymud at wanfear.com scrymud at wanfear.com
Sun Dec 5 20:30:44 PST 2004


Author: eroper
Date: 2004-12-05 20:30:43 -0800 (Sun, 05 Dec 2004)
New Revision: 736

Modified:
   branches/version-2-1/mud/grrmud/server/misc.cc
Log:
Beehives now work. i.e. items reload inside of containers. This isn't done
recursively (yet). Maybe I'll tackle that when my head stops spinning :p.

And yeah, I'm backup up *everything* before rolling this one out

--Khaav


Modified: branches/version-2-1/mud/grrmud/server/misc.cc
===================================================================
--- branches/version-2-1/mud/grrmud/server/misc.cc	2004-12-06 01:35:48 UTC (rev 735)
+++ branches/version-2-1/mud/grrmud/server/misc.cc	2004-12-06 04:30:43 UTC (rev 736)
@@ -1104,6 +1104,45 @@
       //log("About to check if need to load more inv into the room.\n");
       room_ptr->getInv()->head(ocell);
       while ((obj_ptr = ocell.next())) {
+
+         //make sure containers have their initial inventory reload if
+         //necessary.
+         if ( obj_ptr->isContainer() ) {
+            object* ig_room_object;
+            object* orig_object_inv;
+            Cell<object*> ig_room_inv_cell;
+            Cell<object*> orig_inv_cell;
+            int id_we_want = obj_ptr->getIdNum();
+            //don't update more than should load in room, otherwise players
+            //have the potential to mass item dupe/farm.
+            int max_to_update = obj_count(*(room_ptr->getInv()), *obj_ptr);
+
+            obj_ptr->inv.head(orig_inv_cell);
+            room_list[k].getInv()->head(ig_room_inv_cell);
+
+            //look at everything in this room.
+            while ( (ig_room_object = ig_room_inv_cell.next()) &&
+                  (max_to_update--) ) {
+               //if we've found a match for the container
+               if ( ig_room_object->getIdNum() == id_we_want ) {
+                  obj_ptr->inv.head(orig_inv_cell);
+                  //walk the clean ones inventory
+                  while ( ( orig_object_inv = orig_inv_cell.next() ) ) {
+                     //do we need to add something to our in-game?
+                     if ( (obj_count(obj_ptr->inv, *orig_object_inv) >
+                           obj_count(ig_room_object->inv,
+                                 *orig_object_inv )) &&
+                           ( orig_object_inv->getCurInGame() <
+                             orig_object_inv->getMaxInGame()) ) {
+                        ig_room_object->inv.append(orig_object_inv);
+                        recursive_init_loads(
+                              obj_list[orig_object_inv->getIdNum()], 0);
+                     }
+                  }
+               }//match
+            }
+         }//handle containers.
+
          if ((obj_count(*(room_ptr->getInv()), *obj_ptr) >
               obj_count(*(room_list[k].getInv()), *obj_ptr)) &&
              (obj_ptr->getCurInGame()




More information about the ScryMUD mailing list