Allowing scorer identification if he shot the ball with a projectile.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14250 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
yasin-ghannam
2013-10-14 00:51:29 +00:00
parent 70ef7966e1
commit af7aa7fd02
3 changed files with 14 additions and 0 deletions

View File

@@ -515,4 +515,9 @@ HitEffect* Flyable::getHitEffect() const
return new Explosion(getXYZ(), "explosion", "explosion_cake.xml");
} // getHitEffect
// ----------------------------------------------------------------------------
unsigned int Flyable::getOwnerId()
{
return m_owner->getWorldKartId();
}
/* EOF */

View File

@@ -208,6 +208,8 @@ public:
* call, or if the inheriting object will update TerrainInfo itself
* (or perhaps not at all if it is not needed). */
void setDoTerrainInfo(bool d) { m_do_terrain_info = d; }
// ------------------------------------------------------------------------
unsigned int getOwnerId();
}; // Flyable
#endif

View File

@@ -235,6 +235,13 @@ void Physics::update(float dt)
// -------------------------------
p->getUserPointer(0)->getPointerFlyable()
->hit(NULL, p->getUserPointer(1)->getPointerPhysicalObject());
PhysicalObject* obj = p->getUserPointer(1)->getPointerPhysicalObject();
if(obj->isSoccerBall())
{
int kartId = p->getUserPointer(0)->getPointerFlyable()->getOwnerId();
SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld();
soccerWorld->setLastKartTohitBall(kartId);
}
}
else if(p->getUserPointer(1)->is(UserPointer::UP_KART))