[ScryMUD] SVN Commit Info r826 - trunk/mud/grrmud/server

scrymud at wanfear.com scrymud at wanfear.com
Fri Jan 7 19:22:42 PST 2005


Author: eroper
Date: 2005-01-07 19:22:41 -0800 (Fri, 07 Jan 2005)
New Revision: 826

Modified:
   trunk/mud/grrmud/server/command4.cc
   trunk/mud/grrmud/server/zone.cc
Log:
automapper will no longer mark all paths as "stretched".

toggling obj_flag 54 (container) will now actually make the object a bag or
unmake a bag and clear the objects inventory.

This should prevent issues like the accidental purging of all objects from
Koth (whistles an innocent tune), caused by corruption of the World/ database.

Ben, if you read this can you let me know if obj_ptr->inv.clearAndDestroy() is
safe, or do I need to walk and and call lose() on every object in the
inventory? (see: command4.cc:3096

Thanks,
Ed



Modified: trunk/mud/grrmud/server/command4.cc
===================================================================
--- trunk/mud/grrmud/server/command4.cc	2005-01-02 03:40:44 UTC (rev 825)
+++ trunk/mud/grrmud/server/command4.cc	2005-01-08 03:22:41 UTC (rev 826)
@@ -3087,6 +3087,22 @@
       if (flagnum != 8 && flagnum != 9 && flagnum != 10 && flagnum != 63
           && flagnum != 70 && flagnum != 73 && flagnum != 74) {
          obj_ptr->OBJ_FLAGS.flip(flagnum);
+
+         //Special handling for certain flags.
+         switch (flagnum) {
+            case 54: //container
+               if ( ! obj_ptr->isContainer() ) {
+                  // was a container, now it's not.
+                  obj_ptr->inv.clearAndDestroy();
+                  delete obj_ptr->bag;
+                  obj_ptr->bag = NULL;
+               } else {
+                  // make it a container
+                  obj_ptr->bag = new bag_struct;
+               }//else
+               break; //case 54
+         }//switch(flagnum)
+
          return 0;
       }//if
       else {

Modified: trunk/mud/grrmud/server/zone.cc
===================================================================
--- trunk/mud/grrmud/server/zone.cc	2005-01-02 03:40:44 UTC (rev 825)
+++ trunk/mud/grrmud/server/zone.cc	2005-01-08 03:22:41 UTC (rev 826)
@@ -826,9 +826,20 @@
             end_rm->z());
       retval.append(tmp_buf);
       if (
-            ( abs((start_rm->x()-end_rm->x())) != path_ptr->distance() ) ||
-            ( abs((start_rm->y()-end_rm->y())) != path_ptr->distance() ) ||
-            ( abs((start_rm->z()-end_rm->z())) != path_ptr->distance() )
+            (
+             ( abs((start_rm->x()-end_rm->x())) != path_ptr->distance() ) &&
+             ( abs((start_rm->x()-end_rm->x())) != 0 ) 
+            ) ||
+
+            (
+             ( abs((start_rm->y()-end_rm->y())) != path_ptr->distance() ) &&
+             ( abs((start_rm->y()-end_rm->y())) != 0 ) 
+            ) ||
+
+            (
+             ( abs((start_rm->z()-end_rm->z())) != path_ptr->distance() ) &&
+             ( abs((start_rm->z()-end_rm->z())) != 0 )
+            )
          ) {
          retval.append(" stretched");
       }




More information about the ScryMUD mailing list