summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-15 15:00:32 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-15 15:00:32 +0200
commite833e6d3fa4b46b57feae0b26002f3461e6a5191 (patch)
tree5e1ae9a910e41aec65d9ec3ad964cf09db674ac9
parent2f4949708217d9434acd4973af2cc9032e451fd7 (diff)
downloadedoors-ruby-e833e6d3fa4b46b57feae0b26002f3461e6a5191.zip
edoors-ruby-e833e6d3fa4b46b57feae0b26002f3461e6a5191.tar.gz
Room: implement drill down
-rw-r--r--lib/evendoors.rb2
-rw-r--r--lib/evendoors/room.rb10
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