[CF-Devel] Possible item price bug
crossfire-devel at archives.real-time.com
crossfire-devel at archives.real-time.com
Fri Apr 16 18:33:52 CDT 2004
On Thu, 15 Apr 2004, Andreas Kirschbaum wrote:
>
I think there is a bug in the function query_cost() for high priced
>
items: the graph of the adjusted price is not a continuous function (see
>
red function in attached image). I.e. you will get the "real" price for
>
items up to 25000; for higher priced items you will get about 11000
>
only.
>
>
What is the "right" fix for this problem?
>
>
1. Decrease the limit from 25000 to 10000 (green function in image).
>
(Maybe this was the case some time ago because this makes the
>
existing adjustment function continuous and the comment for
>
query_cost() mentions "10000".)
>
>
2. Modify the adjustment function (blue function in image).
>
>
3. Leave it as is (red function in image).
>
Indeed, this is a bug.
server/shop.c 148:
/* Limit amount of money you can get for really great items. */
if (flag==F_TRUE || flag==F_SELL) {
if (val/number>25000) {
val=8000+isqrt((int)val/number)*20;
val *= number;
}
}
My suggestion:
/* Limit amount of money you can get for really great items. */
if (flag==F_TRUE || flag==F_SELL) {
if (val/number>PRICE_LIMIT) {
val=isqrt((int)val/number)*2*isqrt(PRICE_LIMIT)-PRICE_LIMIT;
val *= number;
}
}
One can define PRICE_LIMIT here or even in the config.h if desired.
These functions are not only continuous but even more important here,
monotonic increasing.
They are also differentiable, meaning they bend away smoothly
from the linear function.
On choosing PRICE_LIMIT :
10,000 :
linear until 800 pt
2,000 pt -> 1728 pt
4,000 pt -> 2776 pt
20,000 pt -> 7,200 pt
40,000 pt -> 10,512 pt
25,000 :
linear until 2000 pt
4,000 pt -> 3,656 pt
20,000 pt -> 10,640 pt
40,000 pt -> 15,872 pt
10,000 silver are 200 pt. ,but all prices are multiplied by 4.
_______________________________________________
crossfire-devel mailing list
crossfire-devel at lists.real-time.com
https://mailman.real-time.com/mailman/listinfo/crossfire-devel
More information about the crossfire
mailing list