From e833e6d3fa4b46b57feae0b26002f3461e6a5191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 15 May 2012 15:00:32 +0200 Subject: Room: implement drill down --- lib/evendoors.rb | 2 +- lib/evendoors/room.rb | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/evendoors.rb b/lib/evendoors.rb index 19f9371..e57cf26 100644 --- a/lib/evendoors.rb +++ b/lib/evendoors.rb @@ -43,7 +43,7 @@ module EvenDoors # ERROR_ROUTE_NS = 'routing error: no source'.freeze ERROR_ROUTE_RRWD = 'routing error: right room, wrong door'.freeze - ERROR_ROUTE_RRNDD = 'routing error: right room, no drill down'.freeze + ERROR_ROUTE_DDWR = 'routing error: drill down, wrong room'.freeze ERROR_ROUTE_TRWR = 'routing error: top room, wrong room'.freeze ERROR_ROUTE_NDNL = 'routing error: no destination, no link'.freeze ERROR_ROUTE_SND = 'routing error: system no destination'.freeze diff --git a/lib/evendoors/room.rb b/lib/evendoors/room.rb index 8b62c24..f865136 100644 --- a/lib/evendoors/room.rb +++ b/lib/evendoors/room.rb @@ -119,9 +119,13 @@ module EvenDoors else p.error! EvenDoors::ERROR_ROUTE_RRWD end - elsif (p.room=~/^#{path}/)==0 - # TODO allow drill down ?!? - p.error! EvenDoors::ERROR_ROUTE_RRNDD + elsif (p.room=~/^#{path}\/(.*)/)==0 + room, *more = $1.split EvenDoors::PATH_SEP + if r=@spots[room] + r.route_p p + else + p.error! EvenDoors::ERROR_ROUTE_DDWR + end elsif @parent @parent.route_p p else -- cgit v1.1-2-g2b99