--- deliantra/server/common/utils.C 2007/07/01 05:00:18 1.60 +++ deliantra/server/common/utils.C 2007/07/10 07:31:20 1.62 @@ -214,7 +214,7 @@ if (name == mt->name) return mt; - return materialt; + return 0; } /* when doing transmutation of objects, we have to recheck the resistances, @@ -260,53 +260,27 @@ { materialtype_t *mt, *lmt; -#ifdef NEW_MATERIAL_CODE - int j; -#endif - if (op->materialname != NULL) return; - - if (nmt == NULL) { lmt = NULL; -#ifndef NEW_MATERIAL_CODE - for (mt = materialt; mt && mt->next; mt = mt->next) - { - if (op->materials & mt->material) - { - lmt = mt; - break; - } - } -#else for (mt = materialt; mt && mt->next; mt = mt->next) - { - if (op->materials & mt->material && rndm (1, 100) <= mt->chance && - difficulty >= mt->difficulty && (op->magic >= mt->magic || mt->magic == 0)) - { - lmt = mt; - if (!(op->is_weapon () || op->is_armor ())) - break; - } - } -#endif + if (op->materials & mt->material && rndm (1, 100) <= mt->chance && + difficulty >= mt->difficulty && (op->magic >= mt->magic || mt->magic == 0)) + { + lmt = mt; + if (!(op->is_weapon () || op->is_armor ())) + break; + } } else - { - lmt = nmt; - } + lmt = nmt; if (lmt != NULL) { -#ifndef NEW_MATERIAL_CODE - op->materialname = lmt->name; - return; -#else - if (op->stats.dam && op->is_weapon ()) { op->stats.dam += lmt->damage; @@ -322,7 +296,8 @@ { if (op->stats.ac) op->stats.ac += lmt->ac; - for (j = 0; j < NROFATTACKS; j++) + + for (int j = 0; j < NROFATTACKS; j++) if (op->resist[j] != 0) { op->resist[j] += lmt->mod[j]; @@ -332,6 +307,7 @@ op->resist[j] = -100; } } + op->materialname = lmt->name; /* dont make it unstackable if it doesn't need to be */ if (op->is_weapon () || op->is_armor ()) @@ -339,7 +315,6 @@ op->weight = (op->weight * lmt->weight) / 100; op->value = (op->value * lmt->value) / 100; } -#endif } }