summaryrefslogtreecommitdiffstats
path: root/lib/evendoors/room.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-08 16:41:28 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-08 16:41:28 +0200
commit23c3790d2397f343071c7481a91533a7b846a39f (patch)
treee1a6f7592a77aea280ad21b576aaa6aa07c00803 /lib/evendoors/room.rb
parenteafe8dd42c8e71d0ece51d4e14600e481029a239 (diff)
downloadedoors-ruby-23c3790d2397f343071c7481a91533a7b846a39f.zip
edoors-ruby-23c3790d2397f343071c7481a91533a7b846a39f.tar.gz
Room, Twirl
p.door->p.dst, p.dst_done!->p.dst_routed!, use p.door instead of p.split_dst! return value
Diffstat (limited to 'lib/evendoors/room.rb')
-rw-r--r--lib/evendoors/room.rb37
1 files changed, 19 insertions, 18 deletions
diff --git a/lib/evendoors/room.rb b/lib/evendoors/room.rb
index f619f10..3c7ebc6 100644
--- a/lib/evendoors/room.rb
+++ b/lib/evendoors/room.rb
@@ -74,53 +74,54 @@ module EvenDoors
(not pending_link.nil?)
end
#
- def route_p p, door_name
- if door_name.empty?
+ def route_p p
+ if p.door.empty?
p.error! EvenDoors::ERROR_ROUTE_NDN
elsif p.room.nil? or p.room==path
- if door = @spots[door_name]
- p.dst_done! door
+ if door = @spots[p.door]
+ p.dst_routed! door
else
p.error! EvenDoors::ERROR_ROUTE_RRWD
end
elsif @parent
- @parent.route_p p, door_name
+ @parent.route_p p
else
p.error! EvenDoors::ERROR_ROUTE_TRWR
end
end
#
def send_p p
- if d = p.dst
- puts " * send #{d.to_str} ..." if EvenDoors::Twirl.debug
- route_p p, p.split_dst!
- puts " -> #{p.door.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug
+ if p.next_dst
+ puts " * send #{p.next_dst.to_str} ..." if EvenDoors::Twirl.debug
+ p.split_dst!
+ route_p p
+ puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug
EvenDoors::Twirl.send_p p
elsif not try_links p
p.error! EvenDoors::ERROR_ROUTE_NDNL
- puts " -> #{p.door.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug
+ puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug
EvenDoors::Twirl.send_p p
end
end
#
def send_sys_p p
- if d = p.dst
- puts " * send_sys #{d.to_str} ..." if EvenDoors::Twirl.debug
- door_name = p.split_dst!
- if door_name.empty?
+ if p.next_dst
+ puts " * send_sys #{p.next_dst.to_str} ..." if EvenDoors::Twirl.debug
+ p.split_dst!
+ if p.door.empty?
if p.action.nil?
p.error! EvenDoors::ERROR_ROUTE_SNDNA
else
- p.dst_done! space
+ p.dst_routed! space
end
else
- route_p p, door_name
+ route_p p
end
- puts " -> #{p.door.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug
+ puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug
EvenDoors::Twirl.send_sys_p p
else
p.error! EvenDoors::ERROR_ROUTE_SND
- puts " -> #{p.door.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug
+ puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug
EvenDoors::Twirl.send_sys_p p
end
end