File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ void Part::OnWorkspaceAdded(std::optional<std::shared_ptr<Workspace>> oldWorkspa
5454}
5555
5656void Part::OnWorkspaceRemoved (std::shared_ptr<Workspace> oldWorkspace) {
57- if (simulationTicket-> get () != nullptr )
57+ if (simulationTicket. has_value () )
5858 oldWorkspace->RemoveBody (shared<Part>());
5959}
6060
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ class DEF_INST_(explorer_icon="part") Part : public PVInstance {
109109 DEF_SIGNAL SignalSource TouchEnded;
110110
111111 rp::RigidBody* rigidBody = nullptr ;
112- SimulationTicket simulationTicket;
112+ std::optional< SimulationTicket> simulationTicket;
113113 bool rigidBodyDirty = true ;
114114
115115 inline SurfaceType GetSurfaceFromFace (NormalId face) { return surfaceFromFace (face); }
Original file line number Diff line number Diff line change @@ -165,9 +165,9 @@ void Workspace::PhysicsStep(float deltaTime) {
165165 if (item.action == QueueItem::QUEUEITEM_ADD) {
166166 simulatedBodies.push_back (item.part );
167167 item.part ->simulationTicket = --simulatedBodies.end ();
168- } else if (item.part ->simulationTicket -> get () != nullptr ) {
169- simulatedBodies.erase (item.part ->simulationTicket );
170- item.part ->simulationTicket = {} ;
168+ } else if (item.part ->simulationTicket . has_value () ) {
169+ simulatedBodies.erase (item.part ->simulationTicket . value () );
170+ item.part ->simulationTicket = std:: nullopt ;
171171 }
172172 }
173173 queueLock.unlock ();
You can’t perform that action at this time.
0 commit comments