When swatting a kart with a bomb, both karts explode

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9796 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-09-10 23:47:04 +00:00
parent 3fd08f30e8
commit f099a6f4c0

View File

@ -30,8 +30,10 @@
#include "audio/music_manager.hpp" #include "audio/music_manager.hpp"
#include "audio/sfx_base.hpp" #include "audio/sfx_base.hpp"
#include "audio/sfx_manager.hpp" #include "audio/sfx_manager.hpp"
#include "graphics/explosion.hpp"
#include "io/file_manager.hpp" #include "io/file_manager.hpp"
#include "items/attachment.hpp" #include "items/attachment.hpp"
#include "items/projectile_manager.hpp"
#include "modes/world.hpp" #include "modes/world.hpp"
#include "karts/kart.hpp" #include "karts/kart.hpp"
@ -251,6 +253,22 @@ void Swatter::squashThingsAround()
{ {
kart->setSquash(kp->getSquashDuration(), kart->setSquash(kp->getSquashDuration(),
kp->getSquashSlowdown()); kp->getSquashSlowdown());
if (kart->getAttachment() != NULL)
{
if (kart->getAttachment()->getType() == Attachment::ATTACH_BOMB)
{
// make bomb explode
kart->getAttachment()->update(10000);
HitEffect *he = new Explosion(m_kart->getXYZ(), "explosion");
if(m_kart->getController()->isPlayerController())
he->setPlayerKartHit();
projectile_manager->addHitEffect(he);
m_kart->handleExplosion(m_kart->getXYZ(),
/*direct_hit*/ true);
}
}
World::getWorld()->kartHit(kart->getWorldKartId()); World::getWorld()->kartHit(kart->getWorldKartId());
} }
} }