--- deliantra/server/common/utils.C 2007/02/05 01:47:22 1.46 +++ deliantra/server/common/utils.C 2007/02/07 02:04:46 1.47 @@ -253,7 +253,7 @@ } else { - int mat = op->material; + int mat = op->materials; if (mat & M_PAPER || mat & M_LEATHER @@ -278,20 +278,13 @@ /* convert materialname to materialtype_t */ materialtype_t * -name_to_material (const char *name) +name_to_material (const shstr &name) { - materialtype_t *mt, *nmt; + for (materialtype_t *mt = materialt; mt && mt->next; mt = mt->next) + if (name == mt->name) + return mt; - mt = NULL; - for (nmt = materialt; nmt != NULL && nmt->next != NULL; nmt = nmt->next) - { - if (strcmp (name, nmt->name) == 0) - { - mt = nmt; - break; - } - } - return mt; + return materialt; } /* when doing transmutation of objects, we have to recheck the resistances, @@ -350,9 +343,9 @@ { lmt = NULL; #ifndef NEW_MATERIAL_CODE - for (mt = materialt; mt != NULL && mt->next != NULL; mt = mt->next) + for (mt = materialt; mt && mt->next; mt = mt->next) { - if (op->material & mt->material) + if (op->materials & mt->material) { lmt = mt; break; @@ -360,9 +353,9 @@ } #else - for (mt = materialt; mt != NULL && mt->next != NULL; mt = mt->next) + for (mt = materialt; mt && mt->next; mt = mt->next) { - if (op->material & mt->material && rndm (1, 100) <= mt->chance && + if (op->materials & mt->material && rndm (1, 100) <= mt->chance && difficulty >= mt->difficulty && (op->magic >= mt->magic || mt->magic == 0)) { lmt = mt;