Skip to content

Commit

Permalink
Merge pull request #645 from ulteq/scriptCallbackFix
Browse files Browse the repository at this point in the history
[Bugfix] Fixes event cache not being cleared on exit
  • Loading branch information
ulteq committed Jan 26, 2016
2 parents 5db8af9 + 1319fd7 commit 3dff22a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/main/physics/collision/Collisions.cpp
Expand Up @@ -911,6 +911,8 @@ bool Collisions::collisionCorrect(Vector3 *refpos)
float minctridist=100.0;
Vector3 minctripoint;

bool isScriptCallbackEnvoked = false;

for (k=0; k<cell->size(); k++)
{
if ((*cell)[k] != (int)UNUSED_CELLELEMENT && (*cell)[k]<MAX_COLLISION_BOXES)
Expand All @@ -935,6 +937,7 @@ bool Collisions::collisionCorrect(Vector3 *refpos)
if (cbox->eventsourcenum!=-1 && permitEvent(cbox->event_filter))
{
envokeScriptCallback(cbox);
isScriptCallbackEnvoked = true;
}
if (cbox->camforced && !forcecam)
{
Expand Down Expand Up @@ -966,6 +969,7 @@ bool Collisions::collisionCorrect(Vector3 *refpos)
if (cbox->eventsourcenum!=-1 && permitEvent(cbox->event_filter))
{
envokeScriptCallback(cbox);
isScriptCallbackEnvoked = true;
}
if (cbox->camforced && !forcecam)
{
Expand Down Expand Up @@ -1000,7 +1004,10 @@ bool Collisions::collisionCorrect(Vector3 *refpos)
}
}
}


if (!isScriptCallbackEnvoked)
clearEventCache();

// process minctri collision
if (minctri)
{
Expand Down

0 comments on commit 3dff22a

Please sign in to comment.