Tool getDigParams: Fix selecting the best fitting time

Previously, time was compared with result_time before dividing it by
the level difference.
This commit is contained in:
Hybrid Dog 2017-04-19 20:55:47 +02:00 committed by paramat
parent 0d6b58a772
commit d7c1f6c92e

@ -200,11 +200,12 @@ DigParams getDigParams(const ItemGroupList &groups,
int rating = itemgroup_get(groups, name);
float time = 0;
bool time_exists = cap.getTime(rating, &time);
int leveldiff = cap.maxlevel - level;
time /= MYMAX(1, leveldiff);
if(!result_diggable || time < result_time){
if(cap.maxlevel >= level && time_exists){
result_diggable = true;
int leveldiff = cap.maxlevel - level;
result_time = time / MYMAX(1, leveldiff);
result_time = time;
if(cap.uses != 0)
result_wear = 1.0 / cap.uses / pow(3.0, (double)leveldiff);
else