@@ -133,33 +133,35 @@ private static Collection<Vector2i> getRegions(BmMap map, Vector2i center, int r
133133
134134 // also update regions that are present as map-tile-state files (they might have been rendered before but deleted now)
135135 // (a little hacky as we are operating on raw tile-state files -> maybe find a better way?)
136- Grid tileGrid = map .getHiresModelManager ().getTileGrid ();
137- Grid cellGrid = MapTileState .GRID .multiply (tileGrid );
138- try (Stream <GridStorage .Cell > stream = map .getStorage ().tileState ().stream ()) {
139- stream
140- .filter (c -> {
141- // filter out files that are fully UNKNOWN/NOT_GENERATED
142- // this avoids unnecessarily converting UNKNOWN tiles into NOT_GENERATED tiles on force-updates
143- try (CompressedInputStream in = c .read ()) {
144- if (in == null ) return false ;
145- TileState [] states = TileInfoRegion .loadPalette (in .decompress ());
146- for (TileState state : states ) {
147- if (
148- state != TileState .UNKNOWN &&
149- state != TileState .NOT_GENERATED
150- ) return true ;
136+ if (map .getMapSettings ().isCheckForRemovedRegions ()) {
137+ Grid tileGrid = map .getHiresModelManager ().getTileGrid ();
138+ Grid cellGrid = MapTileState .GRID .multiply (tileGrid );
139+ try (Stream <GridStorage .Cell > stream = map .getStorage ().tileState ().stream ()) {
140+ stream
141+ .filter (c -> {
142+ // filter out files that are fully UNKNOWN/NOT_GENERATED
143+ // this avoids unnecessarily converting UNKNOWN tiles into NOT_GENERATED tiles on force-updates
144+ try (CompressedInputStream in = c .read ()) {
145+ if (in == null ) return false ;
146+ TileState [] states = TileInfoRegion .loadPalette (in .decompress ());
147+ for (TileState state : states ) {
148+ if (
149+ state != TileState .UNKNOWN &&
150+ state != TileState .NOT_GENERATED
151+ ) return true ;
152+ }
153+ return false ;
154+ } catch (IOException ignore ) {
155+ return true ;
151156 }
152- return false ;
153- } catch (IOException ignore ) {
154- return true ;
155- }
156- })
157- .map (c -> new Vector2i (c .getX (), c .getZ ()))
158- .flatMap (v -> cellGrid .getIntersecting (v , regionGrid ).stream ())
159- .filter (regionRadiusFilter )
160- .forEach (regions ::add );
161- } catch (IOException ex ) {
162- Logger .global .logError ("Failed to load map tile state!" , ex );
157+ })
158+ .map (c -> new Vector2i (c .getX (), c .getZ ()))
159+ .flatMap (v -> cellGrid .getIntersecting (v , regionGrid ).stream ())
160+ .filter (regionRadiusFilter )
161+ .forEach (regions ::add );
162+ } catch (IOException ex ) {
163+ Logger .global .logError ("Failed to load map tile state!" , ex );
164+ }
163165 }
164166
165167 return regions ;
0 commit comments