X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=plomrogue%2Fmapping.py;h=2b19f565378d278303a4b772bd599f4f94b9f4e8;hb=fbce872bf4a04ac7be7d965061dabe441258999c;hp=53e9d29fed1267d51e68dd2c19c2aa5626be6688;hpb=722f6c3effe9aedf6c71678260a6976d30fb21ed;p=plomrogue2
diff --git a/plomrogue/mapping.py b/plomrogue/mapping.py
index 53e9d29..2b19f56 100644
--- a/plomrogue/mapping.py
+++ b/plomrogue/mapping.py
@@ -228,7 +228,7 @@ class SourcedMap(Map):
if yxyx[0] not in obstacles:
obstacles[yxyx[0]] = []
obstacles[yxyx[0]] += [yxyx[1]]
- for yx in self:
+ for yx in self: # TODO: iter and source_yxyx expensive, cache earlier?
big_yx, little_yx = self.source_yxyx(yx)
if big_yx in obstacles and little_yx in obstacles[big_yx]:
self.source_map_segment += 'X'
@@ -257,6 +257,12 @@ class SourcedMap(Map):
class DijkstraMap(SourcedMap):
def __init__(self, *args, **kwargs):
+ # TODO: check potential optimizations:
+ # - do a first pass circling out from the center
+ # - somehow ignore tiles that have the lowest possible value (we can
+ # compare with a precalculated map for given starting position)
+ # - check if Python offers more efficient data structures to use here
+ # - shorten radius to nearest possible target
super().__init__(*args, **kwargs)
self.terrain = [255] * self.size_i
self[self.center] = 0