summaryrefslogtreecommitdiff
path: root/src/game-server/monster.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-11-01 21:33:51 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-11-01 22:21:00 +0100
commit63ff01f1d53f2c362beb60fdba664efe19593131 (patch)
tree8ae409671e587fdb0263e8814ff8a614bec06884 /src/game-server/monster.cpp
parent6129e5bf1fe0128eb7742a7270e1264b65798bbb (diff)
downloadmanaserv-63ff01f1d53f2c362beb60fdba664efe19593131.tar.gz
manaserv-63ff01f1d53f2c362beb60fdba664efe19593131.tar.bz2
manaserv-63ff01f1d53f2c362beb60fdba664efe19593131.tar.xz
manaserv-63ff01f1d53f2c362beb60fdba664efe19593131.zip
Prevented a crash in the monster loading code.
The server was trying to insert attributes value not in monster scope. The monster code is to be rewritten anyway. Resolves: Mana-Mantis #212.
Diffstat (limited to 'src/game-server/monster.cpp')
-rw-r--r--src/game-server/monster.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp
index 2412c849..4df000ed 100644
--- a/src/game-server/monster.cpp
+++ b/src/game-server/monster.cpp
@@ -96,7 +96,11 @@ Monster::Monster(MonsterClass *specy):
it2 != it2_end;
++it2)
{
- double attr = specy->getAttribute(it2->first);
+ double attr = 0.0f;
+
+ if (specy->hasAttribute(it2->first))
+ attr = specy->getAttribute(it2->first);
+
setAttribute(it2->first,
mutation ?
attr * (100 + (rand()%(mutation << 1)) - mutation) / 100.0 :