--[snip intro]-- > for ( obj = ch->carrying; obj; obj = obj->next_content) { > if (GET_OBJ_TYPE(obj) == ITEM_WEAPON) { > if ( ((((GET_OBJ_VAL(obj,2)+1) / 2.0) * GET_OBJ_VAL(obj, 1)) > max) > && (!invalid_align(ch, obj) && !invalid_class(ch, obj)) ) { > if (GET_OBJ_VNUM(obj) != GET_OBJ_VNUM(best_obj)) { > best_obj = obj; --[end snip]-- I think the problem could possibly be in your loop, (but don't take my world for it..) Though the > max check should stop it I think the reason they swutch is because when you go through and remove the previous weilded weapon it adds it to the bottom of the item chain, in doing this you would cause an endless loop (if the check was >= max anyway) when 2 items had the same value. From the looks of the code though it shouldn't. I really don't like you if statement though. Even though the syntax is fine I don't like intricate stuff.. Why do you have it set up that way anyway? (with the + 1 / 2 * obj_val) Sorry about the sloppyness but I'm holding my 11 day old son in ine arm and typing with onew hand.. Do you plan on releasing this code? Brian -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/03/01 PST