Skip to content

Commit

Permalink
Tool getDigParams: Fix selecting the best fitting time
Browse files Browse the repository at this point in the history
Previously, time was compared with result_time before dividing it by
the level difference.
  • Loading branch information
HybridDog authored and paramat committed Jan 3, 2018
1 parent 0d6b58a commit d7c1f6c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tool.cpp
Expand Up @@ -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
Expand Down

0 comments on commit d7c1f6c

Please sign in to comment.