lib/IFMapper/Map.rb in ifmapper-0.8.5 vs lib/IFMapper/Map.rb in ifmapper-0.9
- old
+ new
@@ -50,13 +50,24 @@
r.exits.each_with_index { |e, idx|
next if not e
if not sect.connections.include?(e)
$stderr.puts "Exit #{e} in room, but not in section #{sect.name}."
r.exits[idx] = nil
+ sect.connections.delete(e)
end
}
}
+
+ sect.connections.each { |c|
+ a = c.roomA
+ b = c.roomB
+ if not a.exits.index(c) or
+ (b and not b.exits.rindex(c))
+ $stderr.puts "Exit #{c} not present in room."
+ sect.connections.delete(c)
+ end
+ }
}
end
#
# Change map's width and height to make sure all rooms and connections
@@ -176,9 +187,10 @@
def delete_section_at(idx)
@sections.delete_at(idx)
_check_section
end
+
end