From 07bcc6a6dcf13386e361af1651358678db10fe0a Mon Sep 17 00:00:00 2001 From: panda2134 Date: Tue, 11 May 2021 21:52:42 +0800 Subject: [PATCH] fix: new version of box2d --- statements/gitHeadLocal.gin | 16 ++++++++-------- world.cpp | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/statements/gitHeadLocal.gin b/statements/gitHeadLocal.gin index b2cab8a..76e728b 100644 --- a/statements/gitHeadLocal.gin +++ b/statements/gitHeadLocal.gin @@ -1,17 +1,17 @@ \usepackage[% - shash={b70ca22}, - lhash={b70ca228287648fd2bd4e41a6db0d6ea41508b9b}, + shash={d8fb24e}, + lhash={d8fb24e6ebd78944eaad8b253a7a4649dc9e09d1}, authname={panda2134}, authemail={ljypanda@live.com}, authsdate={2021-05-11}, - authidate={2021-05-11 20:48:14 +0800}, - authudate={1620737294}, + authidate={2021-05-11 21:40:05 +0800}, + authudate={1620740405}, commname={panda2134}, commemail={ljypanda@live.com}, commsdate={2021-05-11}, - commidate={2021-05-11 20:48:14 +0800}, - commudate={1620737294}, + commidate={2021-05-11 21:40:05 +0800}, + commudate={1620740405}, refnames={ (HEAD -> master)}, - firsttagdescribe={278ae407-1-gb70ca22-*}, - reltag={b70ca22-*} + firsttagdescribe={278ae407-2-gd8fb24e}, + reltag={d8fb24e} ]{gitexinfo} \ No newline at end of file diff --git a/world.cpp b/world.cpp index 3188e91..67ce2ee 100644 --- a/world.cpp +++ b/world.cpp @@ -30,7 +30,7 @@ void SetSlippedWhenContact(b2Contact* contact) { // private helper method collision_items.push_back(contact->GetFixtureB()->GetBody()); for (auto item : collision_items) { - auto body_data = reinterpret_cast(item->GetUserData().pointer); + auto body_data = reinterpret_cast(item->GetUserData()); if (body_data != nullptr && body_data->m_p_player != nullptr) { body_data->m_p_b2body->SetLinearVelocity({.0, .0}); body_data->m_p_player->set_status(PlayerStatus::SLIPPED); @@ -184,7 +184,7 @@ World::World() { bodyDef.position.Set(static_cast(players[i]->position().x), static_cast(players[i]->position().y)); b2players[i] = b2world->CreateBody(&bodyDef); - b2players[i]->GetUserData().pointer = + b2players[i]->GetUserData() = reinterpret_cast(new b2bodydata{players[i], b2players[i]}); b2CircleShape dynamicBox; dynamicBox.m_radius = static_cast(PLAYER_RADIUS); @@ -350,7 +350,7 @@ void thuai::World::addEgg(int index) { bodyDef.position.Set(static_cast(eggs[index]->position().x), static_cast(eggs[index]->position().y)); b2eggs[index] = b2world->CreateBody(&bodyDef); - b2eggs[index]->GetUserData().pointer = + b2eggs[index]->GetUserData() = reinterpret_cast(new b2bodydata(eggs[index], b2eggs[index])); b2CircleShape dynamicBox; dynamicBox.m_radius = static_cast(EGG_RADIUS);