changeset 473:b78020d31186

Small update to ensure python doesn't try to delete objects that FIFE owns.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 20 Apr 2010 20:36:58 +0000
parents 3164715a0621
children 10aff123c62c
files demos/shooter/scripts/common/baseobject.py demos/shooter/scripts/weapons.py
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/demos/shooter/scripts/common/baseobject.py	Fri Apr 16 21:44:18 2010 +0000
+++ b/demos/shooter/scripts/common/baseobject.py	Tue Apr 20 20:36:58 2010 +0000
@@ -42,6 +42,7 @@
 			
 		if findInstance:
 			self._instance = self._layer.getInstance(self._name)
+			self._instance.thisown = 0
 		else:
 			self._instnace = None
 		
@@ -112,7 +113,9 @@
 		
 	def removeFromScene(self):
 		self._scene.removeObjectFromScene(self)
-		self._layer.deleteInstance(self._instance)
+		if self._instance:
+			self._layer.deleteInstance(self._instance)
+			self._instance = None
 
 	def _isRunning(self):
 		return self._running
--- a/demos/shooter/scripts/weapons.py	Fri Apr 16 21:44:18 2010 +0000
+++ b/demos/shooter/scripts/weapons.py	Tue Apr 20 20:36:58 2010 +0000
@@ -45,6 +45,7 @@
 	def create(self, location):
 		self._instance = self._layer.createInstance(self._obj, location.getExactLayerCoordinates(), "bullet")
 		fife.InstanceVisual.create(self._instance)
+		self._instance.thisown = 0
 
 	def run(self, velocity, location):
 		if not self._running: