New mechanism for resource allocation

This commit is contained in:
Marcus Str. 2025-01-03 11:07:18 +01:00
parent f460964722
commit ce631dc9f9
2 changed files with 29 additions and 25 deletions

View File

@ -468,16 +468,11 @@ class mstr_orthographic:
tp._setLatLngFold(self._latlngfld)
tp._setAlreadyVisitedTiles(self._tiles_visited[vstidx])
tp._placeTileSources(mlat, mlng)
self.adjust_tiles_visited(lyr[0], lyr[1], tp._all_visited)
self.adjust_tiles_visited(vstidx, tp._all_visited)
# Adjust the tiles visited for one resource
def adjust_tiles_visited(self, tag, value, tiles):
lyridx = -1
for v in range(0, len(self._tiles_visited)):
if self._tiles_visited[v][0][0] == tag and self._tiles_visited[v][0][1] == value:
lyridx = v
break
def adjust_tiles_visited(self, lyridx, tiles):
for t in range(1, len(tiles)):
fnd = False
@ -486,8 +481,10 @@ class mstr_orthographic:
fnd = True
break
if fnd == False:
if tiles[t][0] > 0 and tiles[t][1] > 0:
self._tiles_visited[lyridx].append((tiles[t][0], tiles[t][1]))
# Generates X-Plane 11/12 scenery with
# - the finished orthos
# - a current LIDAR scan of the terrain

View File

@ -314,6 +314,12 @@ class mstr_tileprep:
# sources for every tile, thus evading previous edge detection errors
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))
# If this is not the case, we can proceed
if alr_processed == False:
# Initial scan "cross"
visited = self._scanConnections((self._tile_v, self._tile_h))
@ -330,12 +336,13 @@ class mstr_tileprep:
# This is then used for all visited tiles.
tv = self._tile_v
th = self._tile_h
resstring = self._selectResources()
for v in range(0, len(visited)):
self._storeResourceInfo(visited[v][0], visited[v][1], resstring)
# Check if a tile was visited
def _checkVisited(self, visited, tile):
v = False