summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-10-20 13:42:59 +0200
committermadmaxoft <github@xoft.cz>2013-10-20 13:42:59 +0200
commit71d06e30155eb50cdc2b5ded2ca25e136cd19654 (patch)
tree63e4d96f5b2519aa77b3ffa92553a4218de1fb97
parentFixed memory leaks in cMobSpawner. (diff)
downloadcuberite-71d06e30155eb50cdc2b5ded2ca25e136cd19654.tar
cuberite-71d06e30155eb50cdc2b5ded2ca25e136cd19654.tar.gz
cuberite-71d06e30155eb50cdc2b5ded2ca25e136cd19654.tar.bz2
cuberite-71d06e30155eb50cdc2b5ded2ca25e136cd19654.tar.lz
cuberite-71d06e30155eb50cdc2b5ded2ca25e136cd19654.tar.xz
cuberite-71d06e30155eb50cdc2b5ded2ca25e136cd19654.tar.zst
cuberite-71d06e30155eb50cdc2b5ded2ca25e136cd19654.zip
-rw-r--r--source/Mobs/Monster.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/Mobs/Monster.cpp b/source/Mobs/Monster.cpp
index 73abc069d..ffc42cb07 100644
--- a/source/Mobs/Monster.cpp
+++ b/source/Mobs/Monster.cpp
@@ -532,7 +532,7 @@ cMonster::eType cMonster::StringToMobType(const AString & a_Name)
StrToLower(lcName);
// Binary-search for the lowercase name:
- int lo = 0, hi = ARRAYCOUNT(g_MobTypeNames);
+ int lo = 0, hi = ARRAYCOUNT(g_MobTypeNames) - 1;
while (hi - lo > 1)
{
int mid = (lo + hi) / 2;
@@ -543,11 +543,11 @@ cMonster::eType cMonster::StringToMobType(const AString & a_Name)
}
if (res < 0)
{
- hi = mid;
+ lo = mid;
}
else
{
- lo = mid;
+ hi = mid;
}
}
// Range has collapsed to at most two elements, compare each: