From d51d1b8a77c89e48cc7a5ebce5447dd618e39dea Mon Sep 17 00:00:00 2001 From: panda2134 Date: Tue, 11 May 2021 22:02:47 +0800 Subject: [PATCH] fix: use SetUserData() --- statements/gitHeadLocal.gin | 16 ++++++++-------- world.cpp | 6 ++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/statements/gitHeadLocal.gin b/statements/gitHeadLocal.gin index 3037fd5..3a7ed29 100644 --- a/statements/gitHeadLocal.gin +++ b/statements/gitHeadLocal.gin @@ -1,17 +1,17 @@ \usepackage[% - shash={07bcc6a}, - lhash={07bcc6a6dcf13386e361af1651358678db10fe0a}, + shash={dd414f6}, + lhash={dd414f6a8ce9a7c02969b71fa5b83b45a22d6ac4}, authname={panda2134}, authemail={ljypanda@live.com}, authsdate={2021-05-11}, - authidate={2021-05-11 21:52:42 +0800}, - authudate={1620741162}, + authidate={2021-05-11 21:57:21 +0800}, + authudate={1620741441}, commname={panda2134}, commemail={ljypanda@live.com}, commsdate={2021-05-11}, - commidate={2021-05-11 21:52:42 +0800}, - commudate={1620741162}, + commidate={2021-05-11 21:57:21 +0800}, + commudate={1620741441}, refnames={ (HEAD -> master)}, - firsttagdescribe={278ae407-3-g07bcc6a}, - reltag={07bcc6a} + firsttagdescribe={07bcc6a6-1-gdd414f6}, + reltag={dd414f6} ]{gitexinfo} \ No newline at end of file diff --git a/world.cpp b/world.cpp index 3c4eca7..300841a 100644 --- a/world.cpp +++ b/world.cpp @@ -184,8 +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() = - reinterpret_cast(new b2bodydata{players[i], b2players[i]}); + b2players[i]->SetUserData(new b2bodydata{players[i], b2players[i]}); b2CircleShape dynamicBox; dynamicBox.m_radius = static_cast(PLAYER_RADIUS); b2FixtureDef fixtureDef; @@ -350,8 +349,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() = - reinterpret_cast(new b2bodydata(eggs[index], b2eggs[index])); + b2eggs[index]->SetUserData(new b2bodydata(eggs[index], b2eggs[index])); b2CircleShape dynamicBox; dynamicBox.m_radius = static_cast(EGG_RADIUS); b2FixtureDef fixtureDef;