summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-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: