From 200ea6254c28b73d419001ea1be7d2d4d1d1ee88 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 18 Apr 2014 12:54:17 +0100 Subject: [PATCH] Fixed #904 --- src/Mobs/Monster.cpp | 2 +- src/World.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index d63758b3d..27bd28045 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -540,7 +540,7 @@ void cMonster::KilledBy(cEntity * a_Killer) break; } } - if (a_Killer != NULL) + if ((a_Killer != NULL) && (!IsBaby()) { m_World->SpawnExperienceOrb(GetPosX(), GetPosY(), GetPosZ(), Reward); } diff --git a/src/World.cpp b/src/World.cpp index c23e255f8..800bdde0e 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1691,6 +1691,11 @@ int cWorld::SpawnFallingBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE BlockType, NI int cWorld::SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward) { + if (a_Reward < 1) + { + return -1; + } + cExpOrb * ExpOrb = new cExpOrb(a_X, a_Y, a_Z, a_Reward); ExpOrb->Initialize(this); return ExpOrb->GetUniqueID();