From 405045b3fbe9553430ed068ebe74cdcdb648d5a3 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Mon, 22 Apr 2013 23:41:48 +0200 Subject: [PATCH] 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. --- Aquaria/Game.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index cab97ab..bc20925 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -1233,6 +1233,8 @@ Game::Game() : StateObject() loadEntityTypeList(); + lastCollideMaskIndex = -1; + } @@ -8356,7 +8358,7 @@ void Game::registerSporeDrop(const Vector &pos, int t) bool Game::isEntityCollideWithShot(Entity *e, Shot *shot) { - if (!shot->isHitEnts()) + if (!shot->isHitEnts() || shot->firer == e) { return false; } @@ -8367,24 +8369,17 @@ bool Game::isEntityCollideWithShot(Entity *e, Shot *shot) } 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; - for (i = avatar->bittenEntities.begin(); i != avatar->bittenEntities.end(); i++) + if (e == (*i)) { - if (e == (*i)) - { - return false; - } + return false; } - return true; } - } - else - { - return false; + return true; } } else if (e->getEntityType() == ET_AVATAR)