diff options
author | Mattes D <github@xoft.cz> | 2015-03-21 15:52:49 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-03-21 15:52:49 +0100 |
commit | b698286e86b56cd43f340129a570b24d2a011949 (patch) | |
tree | 30a8bef7c388c148190b773b0aa9bbc83b8978d4 | |
parent | Fixed signedness issues in protocols. (diff) | |
download | cuberite-b698286e86b56cd43f340129a570b24d2a011949.tar cuberite-b698286e86b56cd43f340129a570b24d2a011949.tar.gz cuberite-b698286e86b56cd43f340129a570b24d2a011949.tar.bz2 cuberite-b698286e86b56cd43f340129a570b24d2a011949.tar.lz cuberite-b698286e86b56cd43f340129a570b24d2a011949.tar.xz cuberite-b698286e86b56cd43f340129a570b24d2a011949.tar.zst cuberite-b698286e86b56cd43f340129a570b24d2a011949.zip |
-rw-r--r-- | src/Mobs/Creeper.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp index c4ae47f2f..41796402f 100644 --- a/src/Mobs/Creeper.cpp +++ b/src/Mobs/Creeper.cpp @@ -67,30 +67,29 @@ void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer) } AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER); - if ((a_Killer != nullptr) && a_Killer->IsProjectile() && (((cProjectileEntity *)a_Killer)->GetCreatorUniqueID() >= 0)) + // If the creeper was killed by a skeleton, add a random music disc drop: + if ( + (a_Killer != nullptr) && + a_Killer->IsProjectile() && + ((reinterpret_cast<cProjectileEntity *>(a_Killer))->GetCreatorUniqueID() != cEntity::INVALID_ID)) { class cProjectileCreatorCallback : public cEntityCallback { public: - cProjectileCreatorCallback(void) - { - } + cProjectileCreatorCallback(void) {} virtual bool Item(cEntity * a_Entity) override { - if (a_Entity->IsMob() && ((cMonster *)a_Entity)->GetMobType() == mtSkeleton) + if (a_Entity->IsMob() && ((reinterpret_cast<cMonster *>(a_Entity))->GetMobType() == mtSkeleton)) { return true; } return false; } - }; - - cProjectileCreatorCallback PCC; - if (GetWorld()->DoWithEntityByID(((cProjectileEntity *)a_Killer)->GetCreatorUniqueID(), PCC)) + } PCC; + if (GetWorld()->DoWithEntityByID((reinterpret_cast<cProjectileEntity *>(a_Killer))->GetCreatorUniqueID(), PCC)) { - // 12 music discs. TickRand starts from 0 to 11. Disk IDs start at 2256, so add that. There. - AddRandomDropItem(a_Drops, 1, 1, (short)m_World->GetTickRandomNumber(11) + 2256); + AddRandomDropItem(a_Drops, 1, 1, static_cast<short>(m_World->GetTickRandomNumber(11) + E_ITEM_FIRST_DISC)); } } } |