From 6492d1f65489e9a285579e2fbd1547539b036da6 Mon Sep 17 00:00:00 2001 From: Richard Fairhurst Date: Fri, 26 Nov 2010 16:40:25 +0000 Subject: [PATCH] add the ability to lock entities against purging --- TODO.txt | 1 - net/systemeD/halcyon/Map.as | 10 +++++++--- net/systemeD/halcyon/connection/Connection.as | 4 ++-- net/systemeD/halcyon/connection/Entity.as | 2 +- net/systemeD/halcyon/connection/Way.as | 7 +++++++ 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/TODO.txt b/TODO.txt index d55d4c86..7fd5a9a3 100644 --- a/TODO.txt +++ b/TODO.txt @@ -42,7 +42,6 @@ Potlatch 2: main outstanding issues == Rendering (Halcyon) == -** Entities need some sort of .purgable attribute (like EntityUIs) - currently you can select an item, then pan off-screen, and the entity is deleted at next purge, causing an exception whenever P2 tries to access it (e.g. via the selection) * halcyon_viewer needs updating for new tileurl stuff * Shields * More line decoration (cliffs etc.), and implied values for 'dashes' if not supplied diff --git a/net/systemeD/halcyon/Map.as b/net/systemeD/halcyon/Map.as index 836c0e16..973878fb 100644 --- a/net/systemeD/halcyon/Map.as +++ b/net/systemeD/halcyon/Map.as @@ -274,15 +274,19 @@ package net.systemeD.halcyon { if (paint.wayuis[way.id]) paint.wayuis[way.id].setHighlightOnNodes(settings); } + /* Protect Entities and EntityUIs against purging. This prevents the currently selected items + from being purged even though they're off-screen. */ + public function setPurgable(entities:Array, purgable:Boolean):void { for each (var entity:Entity in entities) { + entity.locked=!purgable; if ( entity is Way ) { var way:Way=entity as Way; if (paint.wayuis[way.id]) { paint.wayuis[way.id].purgable=purgable; } for (var i:uint=0; i