Fixed rendering when animations are disabled. Backported automatic

sizing of TileCollection from stoutford_tests.
This commit is contained in:
Zukero
2018-02-28 12:09:03 +01:00
parent ec733e5b97
commit 97bffa86c7
2 changed files with 12 additions and 9 deletions

View File

@@ -70,7 +70,7 @@ public final class TileManager {
public final TileCache tileCache = new TileCache();
public final TileCollection preloadedTiles = new TileCollection(114);
public TileCollection preloadedTiles;// = new TileCollection(118);
public TileCollection currentMapTiles;
public TileCollection adjacentMapTiles;
private final HashSet<Integer> preloadedTileIDs = new HashSet<Integer>();
@@ -310,12 +310,13 @@ public final class TileManager {
public void loadPreloadedTiles(Resources r) {
int maxTileID = tileCache.getMaxTileID();
if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) {
if (maxTileID > preloadedTiles.maxTileID) {
L.log("ERROR: TileManager.preloadedTiles needs to be initialized with at least " + maxTileID + " slots. Application will crash now.");
throw new IndexOutOfBoundsException("ERROR: TileManager.preloadedTiles needs to be initialized with at least " + maxTileID + " slots. Application will crash now.");
}
}
// if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) {
// if (maxTileID > preloadedTiles.maxTileID) {
// L.log("ERROR: TileManager.preloadedTiles needs to be initialized with at least " + maxTileID + " slots. Application will crash now.");
// throw new IndexOutOfBoundsException("ERROR: TileManager.preloadedTiles needs to be initialized with at least " + maxTileID + " slots. Application will crash now.");
// }
// }
preloadedTiles = new TileCollection(maxTileID);
for(int i = TileManager.CHAR_HERO; i <= maxTileID; ++i) {
preloadedTileIDs.add(i);
}

View File

@@ -222,8 +222,10 @@ public final class MainView extends SurfaceView
}
private void redrawAll(RedrawAllDebugReason why) {
if (scrolling && why != RedrawAllDebugReason.MapScrolling) return;
if (!scrolling && movingSprites > 0 && why != RedrawAllDebugReason.SpriteMoved) return;
if (preferences.enableUiAnimations) {
if (scrolling && why != RedrawAllDebugReason.MapScrolling) return;
if (!scrolling && movingSprites > 0 && why != RedrawAllDebugReason.SpriteMoved) return;
}
redrawArea_(mapViewArea, null, 0, 0);
}
private void redrawTile(final Coord p, RedrawTileDebugReason why) {