mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
(Hopefully) fixed OutOfMemoryErrors for low heap-size devices.
Fixed bug in quest "A night visit"
Fixed typo in map blackwater_mountain5a ("quantity " instead of
"quantity")
This commit is contained in:
@@ -381,7 +381,14 @@
|
||||
"replies": [
|
||||
{
|
||||
"text": "Yes, they won't expect a thing.",
|
||||
"nextPhraseID": "fallhaven_warden_31"
|
||||
"nextPhraseID": "fallhaven_warden_31",
|
||||
"requires": [
|
||||
{
|
||||
"requireType": "questProgress",
|
||||
"requireID": "farrik",
|
||||
"value": "80"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "No, not yet. I'm working on it.",
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
<object name="gornaud_1" type="spawn" x="160" y="384" width="32" height="32"/>
|
||||
<object name="gornaud_2" type="spawn" x="160" y="128" width="128" height="256">
|
||||
<properties>
|
||||
<property name="quantity " value="2"/>
|
||||
<property name="quantity" value="2"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object name="gornaud_1" type="spawn" x="352" y="160" width="224" height="320">
|
||||
|
||||
@@ -17,7 +17,7 @@ public final class AndorsTrailApplication extends Application {
|
||||
public static final boolean DEVELOPMENT_DEBUGRESOURCES = false;
|
||||
public static final boolean DEVELOPMENT_FORCE_STARTNEWGAME = false;
|
||||
public static final boolean DEVELOPMENT_FORCE_CONTINUEGAME = false;
|
||||
public static final boolean DEVELOPMENT_DEBUGBUTTONS = false;
|
||||
public static final boolean DEVELOPMENT_DEBUGBUTTONS = true;
|
||||
public static final boolean DEVELOPMENT_FASTSPEED = false;
|
||||
public static final boolean DEVELOPMENT_VALIDATEDATA = true;
|
||||
public static final boolean DEVELOPMENT_DEBUGMESSAGES = true;
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.graphics.drawable.LayerDrawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailPreferences;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
@@ -230,7 +231,12 @@ public final class TileManager {
|
||||
addTileIDsFor(tileIDs, mapName, res, world);
|
||||
}
|
||||
|
||||
adjacentMapTiles = tileCache.loadTilesFor(tileIDs, res);
|
||||
long freeMemRequired = tileSize * tileSize * tileIDs.size() * 4 /*RGBA_8888*/ * 2 /*Require twice the needed size, to leave room for others*/;
|
||||
Runtime r = Runtime.getRuntime();
|
||||
|
||||
if (r.maxMemory() - r.totalMemory() > freeMemRequired) {
|
||||
adjacentMapTiles = tileCache.loadTilesFor(tileIDs, res);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}).execute();
|
||||
|
||||
@@ -644,44 +644,42 @@ public final class MainView extends SurfaceView
|
||||
// }
|
||||
|
||||
private void updateBitmaps() {
|
||||
Canvas bitmapDrawingCanvas;
|
||||
|
||||
//CPU and pixel fill-rate optimization, but makes low heap-size devices throw an OutOfMemoryError... disabled for now.
|
||||
// Canvas bitmapDrawingCanvas;
|
||||
//
|
||||
// printMem();
|
||||
//
|
||||
if (groundBitmap != null) {
|
||||
groundBitmap.recycle();
|
||||
groundBitmap = null;
|
||||
}
|
||||
// if (objectsBitmap != null) {
|
||||
// objectsBitmap.recycle();
|
||||
// objectsBitmap = null;
|
||||
// if (groundBitmap != null) {
|
||||
// groundBitmap.recycle();
|
||||
// groundBitmap = null;
|
||||
// }
|
||||
// if (aboveBitmap != null) {
|
||||
// aboveBitmap.recycle();
|
||||
// aboveBitmap = null;
|
||||
// }
|
||||
if (aboveBitmap != null) {
|
||||
aboveBitmap.recycle();
|
||||
aboveBitmap = null;
|
||||
}
|
||||
|
||||
System.gc();
|
||||
|
||||
long freeMemRequired = tileSize * tileSize * currentMap.size.width * currentMap.size.height * 4 /*RGBA_8888*/ * 2 /*Require twice the needed size, to leave room for others*/;
|
||||
Runtime r = Runtime.getRuntime();
|
||||
|
||||
if (currentTileMap.currentLayout.layerGround != null && r.maxMemory() - r.totalMemory() > freeMemRequired) {
|
||||
groundBitmap = Bitmap.createBitmap(currentMap.size.width * tileSize, currentMap.size.height * tileSize, Config.ARGB_8888);
|
||||
bitmapDrawingCanvas = new Canvas(groundBitmap);
|
||||
drawMapLayerOffscreen(bitmapDrawingCanvas, currentTileMap.currentLayout.layerGround);
|
||||
if (currentTileMap.currentLayout.layerObjects != null) {
|
||||
drawMapLayerOffscreen(bitmapDrawingCanvas, currentTileMap.currentLayout.layerObjects);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (currentTileMap.currentLayout.layerAbove != null && r.maxMemory() - r.totalMemory() > freeMemRequired) {
|
||||
aboveBitmap = Bitmap.createBitmap(currentMap.size.width * tileSize, currentMap.size.height * tileSize, Config.ARGB_8888);
|
||||
bitmapDrawingCanvas = new Canvas(aboveBitmap);
|
||||
drawMapLayerOffscreen(bitmapDrawingCanvas, currentTileMap.currentLayout.layerAbove);
|
||||
}
|
||||
//
|
||||
// System.gc();
|
||||
//
|
||||
// long freeMemRequired = tileSize * tileSize * currentMap.size.width * currentMap.size.height * 4 /*RGBA_8888*/ * 3 /*Require three times the needed size, to leave room for others*/;
|
||||
// Runtime r = Runtime.getRuntime();
|
||||
//
|
||||
// if (currentTileMap.currentLayout.layerGround != null && r.maxMemory() - r.totalMemory() > freeMemRequired) {
|
||||
// groundBitmap = Bitmap.createBitmap(currentMap.size.width * tileSize, currentMap.size.height * tileSize, Config.ARGB_8888);
|
||||
// bitmapDrawingCanvas = new Canvas(groundBitmap);
|
||||
// drawMapLayerOffscreen(bitmapDrawingCanvas, currentTileMap.currentLayout.layerGround);
|
||||
// if (currentTileMap.currentLayout.layerObjects != null) {
|
||||
// drawMapLayerOffscreen(bitmapDrawingCanvas, currentTileMap.currentLayout.layerObjects);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (currentTileMap.currentLayout.layerAbove != null && r.maxMemory() - r.totalMemory() > freeMemRequired) {
|
||||
// aboveBitmap = Bitmap.createBitmap(currentMap.size.width * tileSize, currentMap.size.height * tileSize, Config.ARGB_8888);
|
||||
// bitmapDrawingCanvas = new Canvas(aboveBitmap);
|
||||
// drawMapLayerOffscreen(bitmapDrawingCanvas, currentTileMap.currentLayout.layerAbove);
|
||||
// }
|
||||
|
||||
// printMem();
|
||||
//
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user