]> marstr Code Repo - marstr/orthographic.git/commitdiff
Another change to resource allocation
authorMarcus Str. <marcus@marstr.online>
Fri, 3 Jan 2025 10:47:28 +0000 (11:47 +0100)
committerMarcus Str. <marcus@marstr.online>
Fri, 3 Jan 2025 10:47:28 +0000 (11:47 +0100)
tileprep.py

index 7e2eed447364376d8971eacd01be55fbf7bf9a35..baa96479e7bb2edc7a84d60795082318f3666d1e 100644 (file)
@@ -315,7 +315,7 @@ class mstr_tileprep:
     def _placeTileSources(self, mlat, mlng):
         
         # Check if this tile was already processed
-        alr_processed = self._checkVisited(self._already_visited, (self._tile_v, self._tile_h))
+        alr_processed = self._checkAlrVisited((self._tile_v, self._tile_h))
 
         # If this is not the case, we can proceed
         if alr_processed == False:
@@ -329,18 +329,20 @@ class mstr_tileprep:
                 for l in range(len(vst)):
                     if self._checkVisited(visited, (vst[l][0], vst[l][1])) == False: visited.append((vst[l][0], vst[l][1]))
 
+            # Store this in the object array so orthographic can access the data
             self._all_visited = visited
-            
-            # We will take the resource of the original tile we have started
-            # our scan from. If there is nothing, we can choose.
-            # This is then used for all visited tiles.
+
+            # Set coordinates
             tv = self._tile_v
             th = self._tile_h
 
+            # Pick a resource combination
             resstring = self._selectResources()
 
+            # Store this for all encountered tiles
             for v in range(0, len(visited)):
-                self._storeResourceInfo(visited[v][0], visited[v][1], resstring)
+                rs = self._getResourceInfo(visited[v][0], visited[v][1])
+                if rs == "0": self._storeResourceInfo(visited[v][0], visited[v][1], resstring)
 
 
     # Check if a tile was visited
@@ -352,6 +354,16 @@ class mstr_tileprep:
                 break
         return v
 
+    
+    # Check if a tile was visited
+    def _checkAlrVisited(self, tile):
+        v = False
+        for t in range(1, len(self._already_visited)):
+            if self._already_visited[t][0] == tile[0] and self._already_visited[t][1] == tile[1]:
+                v = True
+                break
+        return v
+
 
     # Show result of path tracing - DEBUG ONLY
     def _debugRender(self, visited, mlat, mlng):