1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-15 17:15:58 +00:00

Do not collide shots with entity if shot->firer == entity.

This check was already done if entity was ET_ENEMY,
but it seems more correct to me to check this for all cases.
Hope this doesn't break anything.
This commit is contained in:
fgenesis 2013-04-22 23:41:48 +02:00
parent 0490afe7a2
commit 405045b3fb

View file

@ -1233,6 +1233,8 @@ Game::Game() : StateObject()
loadEntityTypeList(); loadEntityTypeList();
lastCollideMaskIndex = -1;
} }
@ -8356,7 +8358,7 @@ void Game::registerSporeDrop(const Vector &pos, int t)
bool Game::isEntityCollideWithShot(Entity *e, Shot *shot) bool Game::isEntityCollideWithShot(Entity *e, Shot *shot)
{ {
if (!shot->isHitEnts()) if (!shot->isHitEnts() || shot->firer == e)
{ {
return false; return false;
} }
@ -8367,24 +8369,17 @@ bool Game::isEntityCollideWithShot(Entity *e, Shot *shot)
} }
if (e->getEntityType() == ET_ENEMY) if (e->getEntityType() == ET_ENEMY)
{ {
if (shot->firer != e) if (shot->getDamageType() == DT_AVATAR_BITE)
{ {
if (shot->getDamageType() == DT_AVATAR_BITE) Avatar::BittenEntities::iterator i;
for (i = avatar->bittenEntities.begin(); i != avatar->bittenEntities.end(); i++)
{ {
Avatar::BittenEntities::iterator i; if (e == (*i))
for (i = avatar->bittenEntities.begin(); i != avatar->bittenEntities.end(); i++)
{ {
if (e == (*i)) return false;
{
return false;
}
} }
return true;
} }
} return true;
else
{
return false;
} }
} }
else if (e->getEntityType() == ET_AVATAR) else if (e->getEntityType() == ET_AVATAR)