diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-09 10:25:10 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-09 10:25:10 +0200 |
commit | 2dc20ea5c1bf72e996e99d60b42d4e71d04d2462 (patch) | |
tree | 962f39d2a4a95902129e4f2cff32166b236ae4d3 /lib | |
parent | 8a600d5815fb2a44fd9d993c85b43edb7ea1dc8c (diff) | |
download | edoors-ruby-2dc20ea5c1bf72e996e99d60b42d4e71d04d2462.zip edoors-ruby-2dc20ea5c1bf72e996e99d60b42d4e71d04d2462.tar.gz |
Room: do not route orphan particles, doorless particles get the boomerang effect
Diffstat (limited to 'lib')
-rw-r--r-- | lib/evendoors.rb | 4 | ||||
-rw-r--r-- | lib/evendoors/room.rb | 13 |
2 files changed, 7 insertions, 10 deletions
diff --git a/lib/evendoors.rb b/lib/evendoors.rb index e8d7047..bf7a99b 100644 --- a/lib/evendoors.rb +++ b/lib/evendoors.rb @@ -20,12 +20,10 @@ module EvenDoors LNK_CONDV = 'edoors_lnk_condv'.freeze # ERROR_FIELD = 'edoors_error'.freeze - ERROR_ROUTE_NDN = 'routing error: no door name'.freeze - ERROR_ROUTE_NMD = 'routing error: no more destination'.freeze + 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_TRWR = 'routing error: top room, wrong room'.freeze - ERROR_ROUTE_NDNS = 'routing error: no destination, no source'.freeze ERROR_ROUTE_NDNL = 'routing error: no destination, no link'.freeze ERROR_ROUTE_SND = 'routing error: system no destination'.freeze ERROR_ROUTE_SNDNA = 'routing error: system no door, no action'.freeze diff --git a/lib/evendoors/room.rb b/lib/evendoors/room.rb index 99e9139..358d53c 100644 --- a/lib/evendoors/room.rb +++ b/lib/evendoors/room.rb @@ -93,18 +93,17 @@ module EvenDoors # def send_p p puts " * send_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if EvenDoors::Twirl.debug - if p.next_dst + if p.src.nil? + # do not route orphan particles !! + p.error! EvenDoors::ERROR_ROUTE_NS, space + elsif p.next_dst p.split_dst! if p.door - p.src = space if p.src.nil? # send error to space if needed route_p p - elsif p.src - p.dst_routed! p.src else - p.error! EvenDoors::ERROR_ROUTE_NDNS, space + # boomerang + p.dst_routed! p.src end - elsif p.src.nil? - p.error! EvenDoors::ERROR_ROUTE_NDNS, space elsif not try_links p p.error! EvenDoors::ERROR_ROUTE_NDNL end |