lib/IFMapper/Room.rb in ifmapper-0.7 vs lib/IFMapper/Room.rb in ifmapper-0.8
- old
+ new
@@ -82,9 +82,12 @@
raise "next_to?(b): #{b} is not a room."
end
if self == b
raise "next_to? comparing same room #{self}"
end
+ if b.x == @x and b.y == @y
+ raise "#{self} and #{b} in same location."
+ end
dx = (b.x - @x)
dy = (b.y - @y)
return nil if dx.abs > 1 or dy.abs > 1
return vector_to_dir(dx, dy)
end