diff options
-rw-r--r-- | lib/evendoors.rb | 2 | ||||
-rw-r--r-- | 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 |