--- deliantra/server/common/utils.C 2007/07/01 05:00:18 1.60 +++ deliantra/server/common/utils.C 2007/08/06 10:54:11 1.63 @@ -38,6 +38,8 @@ #include +refcnt_base::refcnt_t refcnt_dummy; + rand_gen rndm; void @@ -214,7 +216,7 @@ if (name == mt->name) return mt; - return materialt; + return 0; } /* when doing transmutation of objects, we have to recheck the resistances, @@ -260,53 +262,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 +298,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 +309,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 +317,6 @@ op->weight = (op->weight * lmt->weight) / 100; op->value = (op->value * lmt->value) / 100; } -#endif } } @@ -655,4 +632,12 @@ 0x2d02ef8dL }; +#if 0 +void xyzzy (object_ptr &a, object_ptr &o) +{ + asm volatile ("int3"); + a = o; + asm volatile ("int3"); +} +#endif