summaryrefslogtreecommitdiff
path: root/src/tool.cpp
diff options
context:
space:
mode:
authorHybrid Dog <ovvv@web.de>2017-04-19 20:55:47 +0200
committerparamat <mat.gregory@virginmedia.com>2018-01-03 03:58:11 +0000
commitd7c1f6c92ec612a13850f0aa58c3541c9a1e19c1 (patch)
tree9013352f750affa831054fe59556772e2ac591ba /src/tool.cpp
parent0d6b58a772d515824afd83e8d9cfa9d2e56a1f91 (diff)
downloadminetest-d7c1f6c92ec612a13850f0aa58c3541c9a1e19c1.tar.gz
minetest-d7c1f6c92ec612a13850f0aa58c3541c9a1e19c1.tar.bz2
minetest-d7c1f6c92ec612a13850f0aa58c3541c9a1e19c1.zip
Tool getDigParams: Fix selecting the best fitting time
Previously, time was compared with result_time before dividing it by the level difference.
Diffstat (limited to 'src/tool.cpp')
-rw-r--r--src/tool.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tool.cpp b/src/tool.cpp
index 2d2f9dee5..7128f1915 100644
--- a/src/tool.cpp
+++ b/src/tool.cpp
@@ -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