mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Change Contact callbacks to pass the actual Fixtures instead of just the userdata
--HG-- branch : box2d-update
This commit is contained in:
@@ -76,22 +76,22 @@ namespace box2d
|
|||||||
// Push the function.
|
// Push the function.
|
||||||
ref->push();
|
ref->push();
|
||||||
|
|
||||||
// Push first userdata.
|
// Push first fixture.
|
||||||
{
|
{
|
||||||
fixtureudata * d = (fixtureudata *)(contacts[i]->contact->GetFixtureA()->GetUserData());
|
Fixture * a = (Fixture *)Memoizer::find(contacts[i]->contact->GetFixtureA());
|
||||||
if(d->ref != 0)
|
if(a != 0)
|
||||||
d->ref->push();
|
luax_newtype(L, "Fixture", PHYSICS_FIXTURE_T, (void*)a);
|
||||||
else
|
else
|
||||||
lua_pushnil(L);
|
throw love::Exception("A fixture has escaped Memoizer!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push second userdata.
|
// Push second userdata.
|
||||||
{
|
{
|
||||||
fixtureudata * d = (fixtureudata *)(contacts[i]->contact->GetFixtureB()->GetUserData());
|
Fixture * b = (Fixture *)Memoizer::find(contacts[i]->contact->GetFixtureB());
|
||||||
if(d->ref != 0)
|
if(b != 0)
|
||||||
d->ref->push();
|
luax_newtype(L, "Fixture", PHYSICS_FIXTURE_T, (void*)b);
|
||||||
else
|
else
|
||||||
lua_pushnil(L);
|
throw love::Exception("A fixture has escaped Memoizer!");
|
||||||
}
|
}
|
||||||
|
|
||||||
luax_newtype(L, "Contact", (PHYSICS_CONTACT_T), (void*)contacts[i], false);
|
luax_newtype(L, "Contact", (PHYSICS_CONTACT_T), (void*)contacts[i], false);
|
||||||
|
|||||||
Reference in New Issue
Block a user