From: Marcus Str. Date: Fri, 3 Jan 2025 10:47:28 +0000 (+0100) Subject: Another change to resource allocation X-Git-Url: https://marstr.online/code/gitweb.cgi?a=commitdiff_plain;h=cf25d45789e64639e52f4ab4c6c9fde41ce80ec2;p=marstr%2Forthographic.git Another change to resource allocation --- diff --git a/tileprep.py b/tileprep.py index 7e2eed4..baa9647 100644 --- a/tileprep.py +++ b/tileprep.py @@ -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):