lib/IFMapper/Room.rb in ifmapper-0.6 vs lib/IFMapper/Room.rb in ifmapper-0.7

- old
+ new

@@ -9,18 +9,18 @@ attr_reader :exits attr_accessor :darkness attr_accessor :x, :y DIRECTIONS = [ - 'N', - 'NE', - 'E', - 'SE', - 'S', - 'SW', - 'W', - 'NW', + 'n', + 'ne', + 'e', + 'se', + 's', + 'sw', + 'w', + 'nw', ] DIR_TO_VECTOR = { 0 => [ 0, -1 ], 1 => [ 1, -1 ], @@ -42,11 +42,11 @@ # # Return a direction from the vector of the exit that would take # us to the 'b' room more cleanly. # - def vector_to_dir(dx, dy) + def self.vector_to_dir(dx, dy) if dx == 0 return 4 if dy > 0 return 0 if dy < 0 raise "vector_to_dir: dx == 0 and dy == 0" elsif dx > 0 @@ -56,9 +56,13 @@ else return 7 if dy < 0 return 6 if dy == 0 return 5 end + end + + def vector_to_dir(dx, dy) + return Room::vector_to_dir( dx, dy ) end # # Given an 'adjacent' room, return the most direct exit from this # room to room b.