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

scrymud at wanfear.com scrymud at wanfear.com
Sun Feb 11 01:19:00 PST 2007


Author: eroper
Date: 2007-02-11 01:19:00 -0800 (Sun, 11 Feb 2007)
New Revision: 869

Modified:
   trunk/mud/grrmud/server/misc.cc
   trunk/mud/grrmud/server/misc.h
Log:
FIXES: MUD-403
Dissolving objects (corpses) placed inside any container which could present a
sorted and categorized inventory listing to places were causing memory
corruption and on occasion segfaults after they dissolved.

This appears to have been caused by the out_inv() routine doing bad things
that were invalidating the corpse-objects "in_list" pointers.

This was not affecting rooms (which are containers of sorts) as they did not
utilize the out_inv() function.

As a future project, objects which dissolve in player owned boxes (like the
altar and donation bin) should cause the box to be saved. This is not
currently the case.


Modified: trunk/mud/grrmud/server/misc.cc
===================================================================
--- trunk/mud/grrmud/server/misc.cc	2007-02-10 22:19:15 UTC (rev 868)
+++ trunk/mud/grrmud/server/misc.cc	2007-02-11 09:19:00 UTC (rev 869)
@@ -2139,14 +2139,14 @@
 
 
 
-void out_inv(List<object*>& lst, critter& pc, 
+void out_inv(PtrList<object>& lst, critter& pc, 
              const short type_of_list, int is_board) {
                                //outs the names object*
 
    List<object*>* lst_ptr = NULL;
    int lst_idx;
 
-   List<object*> reordered_lst(NULL);
+   PtrList<object> reordered_lst;
    Cell<object*> cell(lst);
 
    List<object*> inv_weapons(NULL);
@@ -2270,7 +2270,9 @@
                }
                lst_ptr = inv_lists[++lst_idx];
             }
+            lst.clear();
             lst = reordered_lst;
+            reordered_lst.clear();
       }//switch
 
       lst.head(cell);

Modified: trunk/mud/grrmud/server/misc.h
===================================================================
--- trunk/mud/grrmud/server/misc.h	2007-02-10 22:19:15 UTC (rev 868)
+++ trunk/mud/grrmud/server/misc.h	2007-02-11 09:19:00 UTC (rev 869)
@@ -111,7 +111,7 @@
 void out_str(const List<String*>& lst, critter& pc); 
 void out_crit(const List<critter*>& lst, critter& pc, int see_all = FALSE);
 void out_vehicles(const List<door*>& lst, critter& pc);
-void out_inv(List<object*>& lst, critter& pc, const short l_type, const
+void out_inv(PtrList<object>& lst, critter& pc, const short l_type, const
       int is_board = false); 
          //outs the names object*, formats according to l_type
 




More information about the ScryMUD mailing list