buildgraph: fix building room matrix
This commit is contained in:
parent
a7f85ee2df
commit
18759192e4
1 changed files with 3 additions and 6 deletions
|
@ -179,10 +179,9 @@ class GraphRoom():
|
|||
|
||||
def build_connections(self):
|
||||
for area in self.areas:
|
||||
pass # area.build_connections()
|
||||
area.build_connections()
|
||||
|
||||
def connection_count(self):
|
||||
# print(np.count_nonzero(self.distances != np.inf))
|
||||
return np.count_nonzero(self.distances != np.inf)
|
||||
|
||||
def finish_build(self):
|
||||
|
@ -190,11 +189,9 @@ class GraphRoom():
|
|||
self.points = np.array(tuple(point.i for point in self._built_points))
|
||||
self.room_transfer_points = np.array(tuple(i for i in self.points if i in self.level.room_transfer_points))
|
||||
|
||||
mapping = {from_i: to_i for to_i, from_i in enumerate(self.points)}
|
||||
|
||||
self.distances = np.empty(shape=(len(self.points), len(self.points)), dtype=np.float16)
|
||||
mapping = {point.i: i for i, point in enumerate(self._built_points)}
|
||||
self.distances = np.empty(shape=(len(self._built_points), len(self._built_points)), dtype=np.float16)
|
||||
self.distances[:] = np.inf
|
||||
|
||||
for from_point in self._built_points:
|
||||
for to_point, connection in from_point.connections.items():
|
||||
if to_point.i in mapping:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue