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

scrymud at wanfear.com scrymud at wanfear.com
Sat Feb 17 17:11:45 PST 2007


Author: eroper
Date: 2007-02-17 17:11:44 -0800 (Sat, 17 Feb 2007)
New Revision: 882

Modified:
   trunk/mud/grrmud/server/BugEntry.h
   trunk/mud/grrmud/server/grrmud.cc
   trunk/mud/grrmud/server/zone.cc
   trunk/mud/grrmud/server/zone.h
Log:
Fixed a couple of destructors and the game-exit cleanup.


Modified: trunk/mud/grrmud/server/BugEntry.h
===================================================================
--- trunk/mud/grrmud/server/BugEntry.h	2007-02-17 21:13:30 UTC (rev 881)
+++ trunk/mud/grrmud/server/BugEntry.h	2007-02-18 01:11:44 UTC (rev 882)
@@ -83,7 +83,7 @@
    /** Copy constructor */
    BugEntry(const BugEntry& src);
    BugEntry& operator=(const BugEntry& src);
-   ~BugEntry() { _cnt--; }
+   ~BugEntry() { _cnt--; reports.clearAndDestroy(); }
 
    int clear();
    int read(ifstream& dafile);
@@ -169,7 +169,7 @@
       _cnt++;
    }
 
-   ~BugCollection() { _cnt--; }
+   ~BugCollection() { _cnt--; bugs.clearAndDestroy(); }
 
    String& getFileName() { return file_name; }
 

Modified: trunk/mud/grrmud/server/grrmud.cc
===================================================================
--- trunk/mud/grrmud/server/grrmud.cc	2007-02-17 21:13:30 UTC (rev 881)
+++ trunk/mud/grrmud/server/grrmud.cc	2007-02-18 01:11:44 UTC (rev 882)
@@ -617,6 +617,30 @@
    }
 
    do_shutdown = TRUE;
+
+
+   // Start cleaning up.
+
+   // room destructors handle any smobs in the rooms.
+   //
+   // critter destructors will wack objects in smob
+   // inventories.
+   //
+   // object destructors will clean up their SOBJ's
+   // (and thus recursively cleanup)
+   //
+   // And lastly... I don't think LazyPtrArray implements
+   // clearAndDestroy() nor does it have a "real" destructor,
+   // at least not one that I found in my quick survey.
+   for(int i=0;i<NUMBER_OF_ROOMS;i++) {
+       room* r_ptr = room_list.elementAtNoCreate(i);
+       if ( r_ptr ) {
+           delete r_ptr;
+       }
+   }
+
+   pc_list.clearAndDestroy();
+
    return (grr_reboot);
 }
 

Modified: trunk/mud/grrmud/server/zone.cc
===================================================================
--- trunk/mud/grrmud/server/zone.cc	2007-02-17 21:13:30 UTC (rev 881)
+++ trunk/mud/grrmud/server/zone.cc	2007-02-18 01:11:44 UTC (rev 882)
@@ -181,6 +181,15 @@
    }//while
 }//execute
 
+ZoneCollection::~ZoneCollection() {
+   _cnt--;
+   for ( int i = 0; i < NUMBER_OF_ZONES; i++ ) {
+      zone* z_ptr = zone_list.elementAtNoCreate(i);
+      if ( z_ptr ) {
+         delete z_ptr;
+      }
+   }
+}
 
 
 int ZoneCollection::_cnt = 0;

Modified: trunk/mud/grrmud/server/zone.h
===================================================================
--- trunk/mud/grrmud/server/zone.h	2007-02-17 21:13:30 UTC (rev 881)
+++ trunk/mud/grrmud/server/zone.h	2007-02-18 01:11:44 UTC (rev 882)
@@ -183,7 +183,7 @@
 
 public:
 
-   ~ZoneCollection() { _cnt--; }
+   ~ZoneCollection();
 
    static ZoneCollection& instance();
 




More information about the ScryMUD mailing list