… | |
… | |
930 | double ratio = SPECIALISATION_EFFECT, likedness = 0.001; |
930 | double ratio = SPECIALISATION_EFFECT, likedness = 0.001; |
931 | int i; |
931 | int i; |
932 | |
932 | |
933 | if (item == NULL) |
933 | if (item == NULL) |
934 | { |
934 | { |
935 | LOG (llevError, "shop_specialisation_ratio: passed a NULL item for map %s\n", map->path); |
935 | LOG (llevError, "shop_specialisation_ratio: passed a NULL item for map %s\n", &map->path); |
936 | return 0; |
936 | return 0; |
937 | } |
937 | } |
938 | |
938 | |
939 | if (!item->type) |
939 | if (!item->type) |
940 | { |
940 | { |
… | |
… | |
953 | likedness = items[i].strength / 100.0; |
953 | likedness = items[i].strength / 100.0; |
954 | } |
954 | } |
955 | |
955 | |
956 | if (likedness > 1.0) |
956 | if (likedness > 1.0) |
957 | { /* someone has been rather silly with the map headers. */ |
957 | { /* someone has been rather silly with the map headers. */ |
958 | LOG (llevDebug, "shop_specialisation ratio: item type %d on map %s is above 100%%\n", item->type, map->path); |
958 | LOG (llevDebug, "shop_specialisation ratio: item type %d on map %s is above 100%%\n", item->type, &map->path); |
959 | likedness = 1.0; |
959 | likedness = 1.0; |
960 | } |
960 | } |
961 | |
961 | |
962 | if (likedness < -1.0) |
962 | if (likedness < -1.0) |
963 | { |
963 | { |
964 | LOG (llevDebug, "shop_specialisation ratio: item type %d on map %s is below -100%%\n", item->type, map->path); |
964 | LOG (llevDebug, "shop_specialisation ratio: item type %d on map %s is below -100%%\n", item->type, &map->path); |
965 | likedness = -1.0; |
965 | likedness = -1.0; |
966 | } |
966 | } |
967 | |
967 | |
968 | ratio = ratio + (1.0 - ratio) * likedness; |
968 | ratio = ratio + (1.0 - ratio) * likedness; |
969 | |
969 | |