--- deliantra/server/common/arch.C 2006/12/12 20:53:02 1.28 +++ deliantra/server/common/arch.C 2007/01/06 14:42:28 1.36 @@ -1,6 +1,7 @@ /* CrossFire, A Multiplayer game for X-windows + Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team Copyright (C) 2002 Mark Wedel & Crossfire Development Team Copyright (C) 1992 Frank Tore Johansen @@ -120,18 +121,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 +178,7 @@ tmpname[i] = 0; at = find_archetype_by_object_name (tmpname); - if (at != NULL) + if (at) return arch_to_object (at); } @@ -389,8 +386,7 @@ archetype::archetype () { - clear_object (&clone); /* to initial state other also */ - CLEAR_FLAG (&clone, FLAG_FREED); /* This shouldn't matter, since copy_object() */ + CLEAR_FLAG (&clone, FLAG_FREED); /* This shouldn't matter, since copy_to */ SET_FLAG (&clone, FLAG_REMOVED); /* doesn't copy these flags... */ } @@ -578,7 +574,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 +589,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 +602,7 @@ return NULL; } - op = get_object (); - copy_object (&at->clone, op); + op = at->clone.clone (); op->arch = at; op->instantiate (); return op; @@ -619,7 +614,6 @@ * Thus get_archetype() will be guaranteed to always return * an object, and never NULL. */ - object * create_singularity (const char *name) { @@ -627,7 +621,7 @@ char buf[MAX_BUF]; sprintf (buf, "%s (%s)", ARCH_SINGULARITY, name); - op = get_object (); + op = object::create (); op->name = op->name_pl = buf; SET_FLAG (op, FLAG_NO_PICK); return op; @@ -637,7 +631,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 +801,14 @@ clone_arch (int type) { archetype *at; - object *op = get_object (); if ((at = type_to_archetype (type)) == NULL) { LOG (llevError, "Can't clone archetype %d\n", type); - op->destroy (0); - return NULL; + return 0; } - copy_object (&at->clone, op); + object *op = at->clone.clone (); op->instantiate (); return op; }