--- deliantra/server/common/readable.C 2006/09/14 21:16:11 1.8 +++ deliantra/server/common/readable.C 2006/12/12 20:53:02 1.12 @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - The authors can be reached via e-mail at crossfire-devel@real-time.com + The authors can be reached via e-mail at */ @@ -817,6 +817,7 @@ if (did_init_mon_info) return; + did_init_mon_info = 1; @@ -824,15 +825,15 @@ { if (QUERY_FLAG (&at->clone, FLAG_MONSTER) && (!QUERY_FLAG (&at->clone, FLAG_CHANGING) || QUERY_FLAG (&at->clone, FLAG_UNAGGRESSIVE))) { - objectlink *mon = (objectlink *) malloc (sizeof (objectlink)); + objectlink *mon = new objectlink; mon->ob = &at->clone; - mon->id = nrofmon; mon->next = first_mon_info; first_mon_info = mon; nrofmon++; } } + LOG (llevDebug, "init_mon_info() got %d monsters\n", nrofmon); } @@ -851,6 +852,7 @@ if (did_this) return; + did_this = 1; LOG (llevDebug, "Initializing reading data..."); @@ -1100,7 +1102,7 @@ { tmpbook->msg = book->msg; copy_object (tmpbook, book); - free_object (tmpbook); + tmpbook->destroy (0); } book->title = t->authour; @@ -1473,7 +1475,7 @@ SET_FLAG (tmp, FLAG_IDENTIFIED); if ((ch = describe_item (tmp, NULL)) != NULL && strlen (ch) > 1) sprintf (buf, "%s Properties of this artifact include: \n %s \n", buf, ch); - free_object (tmp); + tmp->destroy (0); /* add the buf if it will fit */ if (!book_overflow (retbuf, buf, booksize)) strcat (retbuf, buf); @@ -1980,6 +1982,7 @@ } strcat (msgbuf, "\n"); /* safety -- we get ugly map saves/crashes w/o this */ + if (strlen (msgbuf) > 1) { book->msg = msgbuf; @@ -2018,15 +2021,17 @@ delete tlist; } + for (lmsg = first_msg; lmsg; lmsg = nextmsg) { nextmsg = lmsg->next; delete lmsg; } + for (monlink = first_mon_info; monlink; monlink = nextmon) { nextmon = monlink->next; - free (monlink); + delete monlink; } }