lib/IFMapper/Room.rb in ifmapper-0.5 vs lib/IFMapper/Room.rb in ifmapper-0.6
- old
+ new
@@ -59,11 +59,11 @@
return 5
end
end
#
- # Given to 'adjacent' rooms, return the most direct exit from this
+ # Given an 'adjacent' room, return the most direct exit from this
# room to room b.
#
def exit_to(b)
dx = (b.x - @x)
dy = (b.y - @y)
@@ -82,9 +82,19 @@
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
+
+ #
+ # Copy a room to another
+ #
+ def copy(b)
+ @name = b.name
+ @objects = b.objects
+ @tasks = b.tasks
+ @darkness = b.darkness
end
def initialize(x, y, name = 'Room')
@exits = Array.new( DIRECTIONS.size )