Skip to content

Commit

Permalink
fix: use SetUserData()
Browse files Browse the repository at this point in the history
  • Loading branch information
panda2134 committed May 11, 2021
1 parent dd414f6 commit d51d1b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
16 changes: 8 additions & 8 deletions statements/gitHeadLocal.gin
Original file line number Diff line number Diff line change
@@ -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}
6 changes: 2 additions & 4 deletions world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ World::World() {
bodyDef.position.Set(static_cast<float>(players[i]->position().x),
static_cast<float>(players[i]->position().y));
b2players[i] = b2world->CreateBody(&bodyDef);
b2players[i]->GetUserData() =
reinterpret_cast<void *>(new b2bodydata{players[i], b2players[i]});
b2players[i]->SetUserData(new b2bodydata{players[i], b2players[i]});
b2CircleShape dynamicBox;
dynamicBox.m_radius = static_cast<float>(PLAYER_RADIUS);
b2FixtureDef fixtureDef;
Expand Down Expand Up @@ -350,8 +349,7 @@ void thuai::World::addEgg(int index) {
bodyDef.position.Set(static_cast<float>(eggs[index]->position().x),
static_cast<float>(eggs[index]->position().y));
b2eggs[index] = b2world->CreateBody(&bodyDef);
b2eggs[index]->GetUserData() =
reinterpret_cast<void *>(new b2bodydata(eggs[index], b2eggs[index]));
b2eggs[index]->SetUserData(new b2bodydata(eggs[index], b2eggs[index]));
b2CircleShape dynamicBox;
dynamicBox.m_radius = static_cast<float>(EGG_RADIUS);
b2FixtureDef fixtureDef;
Expand Down

0 comments on commit d51d1b8

Please sign in to comment.