mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +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.
|
||||
ref->push();
|
||||
|
||||
// Push first userdata.
|
||||
// Push first fixture.
|
||||
{
|
||||
fixtureudata * d = (fixtureudata *)(contacts[i]->contact->GetFixtureA()->GetUserData());
|
||||
if(d->ref != 0)
|
||||
d->ref->push();
|
||||
Fixture * a = (Fixture *)Memoizer::find(contacts[i]->contact->GetFixtureA());
|
||||
if(a != 0)
|
||||
luax_newtype(L, "Fixture", PHYSICS_FIXTURE_T, (void*)a);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
throw love::Exception("A fixture has escaped Memoizer!");
|
||||
}
|
||||
|
||||
// Push second userdata.
|
||||
{
|
||||
fixtureudata * d = (fixtureudata *)(contacts[i]->contact->GetFixtureB()->GetUserData());
|
||||
if(d->ref != 0)
|
||||
d->ref->push();
|
||||
Fixture * b = (Fixture *)Memoizer::find(contacts[i]->contact->GetFixtureB());
|
||||
if(b != 0)
|
||||
luax_newtype(L, "Fixture", PHYSICS_FIXTURE_T, (void*)b);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
throw love::Exception("A fixture has escaped Memoizer!");
|
||||
}
|
||||
|
||||
luax_newtype(L, "Contact", (PHYSICS_CONTACT_T), (void*)contacts[i], false);
|
||||
|
||||
Reference in New Issue
Block a user