--- deliantra/server/common/object.C 2006/09/09 21:48:28 1.21 +++ deliantra/server/common/object.C 2006/09/10 00:51:23 1.22 @@ -1,6 +1,6 @@ /* * static char *rcsid_object_c = - * "$Id: object.C,v 1.21 2006/09/09 21:48:28 root Exp $"; + * "$Id: object.C,v 1.22 2006/09/10 00:51:23 root Exp $"; */ /* @@ -845,6 +845,21 @@ object::object () { + SET_FLAG (this, FLAG_REMOVED); + + expmul = 1.0; + face = blank_face; + attacked_by_count = -1; +} + +object::~object () +{ + free_key_values (this); +} + +void +object::link () +{ count = ++ob_count; prev = 0; @@ -854,21 +869,24 @@ objects->prev = this; objects = this; - - SET_FLAG (this, FLAG_REMOVED); - - expmul = 1.0; - face = blank_face; - attacked_by_count = -1; } -object::~object () +void +object::unlink () { -} + count = 0; + + /* Remove this object from the list of used objects */ + if (prev) prev->next = next; + if (next) next->prev = prev; + if (this == objects) objects = next; +} object *object::create () { - return new object; + object *op = new object; + op->link (); + return op; } /* @@ -961,22 +979,9 @@ speed = 0; update_ob_speed (this); - SET_FLAG (this, FLAG_FREED); - - mortalise (); -} - -void -object::mortalise () -{ - count = 0; + unlink (); - /* Remove this object from the list of used objects */ - if (prev) prev->next = next; - if (next) next->prev = prev; - if (this == objects) objects = next; - - free_key_values (this); + SET_FLAG (this, FLAG_FREED); mortals.push_back (this); }