Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tools.py
diff options
context:
space:
mode:
authornrp <olpc@spongezone.net>2008-09-14 18:06:33 (GMT)
committer nrp <olpc@spongezone.net>2008-09-14 18:06:33 (GMT)
commitec034421db0933df5065dd681320ea39e96fc616 (patch)
tree67ed5ad96d067bb42a9e93db9b358c520c14a716 /tools.py
parentbe541af7591bb1a4e1ed143ffbb9f6c1202cb33d (diff)
making joints delete correctly
Diffstat (limited to 'tools.py')
-rw-r--r--tools.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/tools.py b/tools.py
index d61f748..8a34f12 100644
--- a/tools.py
+++ b/tools.py
@@ -218,14 +218,15 @@ class DestroyTool(Tool):
self.vertices.pop(0)
tokill = self.game.world.get_bodies_at_pos(pygame.mouse.get_pos())
if tokill:
- joint = tokill[0].GetJointList()
- if joint:
- self.game.bridge.joint_deleted()
- while joint.next:
- joint = joint.next
- self.game.bridge.joint_deleted()
- self.game.world.world.DestroyBody(tokill[0])
- self.game.bridge.box_deleted()
+ jointnode = tokill[0].GetJointList()
+ if jointnode:
+ joint = jointnode.joint
+ self.game.bridge.joint_deleted(joint)
+ while joint.GetNext():
+ joint = joint.GetNext()
+ self.game.bridge.joint_deleted(joint)
+ self.game.world.world.DestroyBody(tokill[0])
+ self.game.bridge.box_deleted()
elif event.type == MOUSEBUTTONUP and event.button == 1:
self.cancel()
def draw(self):