From e5d1d12873748e500210a6feebf108ef501134e2 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 1 Jan 2012 23:33:25 +0100 Subject: fixed a plethora of bugs --- src/mapdata.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/mapdata.py') diff --git a/src/mapdata.py b/src/mapdata.py index 4ae87ae..b0d3f0f 100644 --- a/src/mapdata.py +++ b/src/mapdata.py @@ -149,11 +149,23 @@ class KPTileLayer(KPLayer): @mapfile.dumpable('associate_layer') class KPPathTileLayer(KPLayer): - __dump_attribs__ = KPLayer.__dump_attribs__ + ('tileset', 'objects', 'doodads', 'associate') + __dump_attribs__ = KPLayer.__dump_attribs__ + ('tileset', 'objects', 'doodads') + + def _dump(self, mapObj, dest): + if isinstance(self.associate, KPNode): + dest['associatedRef'] = ('node', mapObj.refNode(self.associate)) + else: + dest['associatedRef'] = ('path', mapObj.refPath(self.associate)) def _load(self, mapObj, src): + assocType, assocID = src['associatedRef'] + + if assocType == 'path': + self.associate = mapObj.derefPath(assocID) + else: + self.associate = mapObj.derefNode(assocID) + self.updateCache() - KP.mainWindow.pathNodeList.loadLayer(self) def __repr__(self): return "" % (self.tileset, self.associate) @@ -173,8 +185,6 @@ class KPPathTileLayer(KPLayer): self.updateCache() - self.icon = KP.icon('LayerTile') - def _visibilityChanged(self, value): for obj in self.objects: item = obj.qtItem -- cgit v1.2.3