--- deliantra/server/common/arch.C 2006/12/12 21:39:56 1.29 +++ deliantra/server/common/arch.C 2007/01/03 20:32:13 1.35 @@ -120,18 +120,14 @@ object * get_archetype_by_skill_name (const char *skill, int type) { - archetype * - at; - - if (skill == NULL) - return NULL; + archetype *at; - for (at = first_archetype; at != NULL; at = at->next) - { + if (skill) + for (at = first_archetype; at; at = at->next) if (((type == -1) || (type == at->clone.type)) && (!strcmp (at->clone.skill, skill))) return arch_to_object (at); - } - return NULL; + + return 0; } /* similiar to above - this returns the first archetype @@ -181,7 +177,7 @@ tmpname[i] = 0; at = find_archetype_by_object_name (tmpname); - if (at != NULL) + if (at) return arch_to_object (at); } @@ -389,7 +385,6 @@ archetype::archetype () { - clear_object (&clone); /* to initial state other also */ CLEAR_FLAG (&clone, FLAG_FREED); /* This shouldn't matter, since copy_to */ SET_FLAG (&clone, FLAG_REMOVED); /* doesn't copy these flags... */ } @@ -578,7 +573,8 @@ LOG (llevDebug, " loading treasure...\n"); load_treasures (); - LOG (llevDebug, " done\n arch-pass 2...\n"); + LOG (llevDebug, " done\n"); + LOG (llevDebug, " arch-pass 2...\n"); second_arch_pass (thawer); LOG (llevDebug, " done\n"); #ifdef DEBUG @@ -592,7 +588,6 @@ * Creates and returns a new object which is a copy of the given archetype. * This function returns NULL on failure. */ - object * arch_to_object (archetype *at) { @@ -606,8 +601,7 @@ return NULL; } - op = object::create (); - at->clone.copy_to (op); + op = at->clone.clone (); op->arch = at; op->instantiate (); return op; @@ -619,7 +613,6 @@ * Thus get_archetype() will be guaranteed to always return * an object, and never NULL. */ - object * create_singularity (const char *name) { @@ -637,7 +630,6 @@ * Finds which archetype matches the given name, and returns a new * object containing a copy of the archetype. */ - object * get_archetype (const char *name) { @@ -808,16 +800,14 @@ clone_arch (int type) { archetype *at; - object *op = object::create (); if ((at = type_to_archetype (type)) == NULL) { LOG (llevError, "Can't clone archetype %d\n", type); - op->destroy (); - return NULL; + return 0; } - at->clone.copy_to (op); + object *op = at->clone.clone (); op->instantiate (); return op; }