Always add ents to quadtree, to allow AI to see components. Shuffle around later.

This commit is contained in:
Steve 2016-04-15 13:08:30 +01:00
parent 5e58f09fcf
commit b40936fd79
1 changed files with 8 additions and 9 deletions

View File

@ -148,23 +148,20 @@ void doEntities(void)
e->action(); e->action();
} }
} }
doRope(e); doRope(e);
restrictToBattleArea(e); restrictToBattleArea(e);
if (!e->speed) if (!e->speed)
{ {
e->dx = e->dy = 0; e->dx = e->dy = 0;
} }
e->x += e->dx; e->x += e->dx;
e->y += e->dy; e->y += e->dy;
if (!isComponent(e)) addToQuadtree(e, &battle.quadtree);
{
addToQuadtree(e, &battle.quadtree);
}
} }
else else
{ {
@ -332,6 +329,8 @@ static void alignComponents(void)
{ {
if (isComponent(e)) if (isComponent(e))
{ {
removeFromQuadtree(e, &battle.quadtree);
s = sin(TO_RAIDANS(e->owner->angle)); s = sin(TO_RAIDANS(e->owner->angle));
c = cos(TO_RAIDANS(e->owner->angle)); c = cos(TO_RAIDANS(e->owner->angle));