mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
Use correct previousPosition when moving monsters.
This commit is contained in:
@@ -55,10 +55,10 @@ public final class Savegames {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static int loadWorld(WorldContext world, Context androidContext, int slot) {
|
||||
public static int loadWorld(WorldContext world, ViewContext view, Context androidContext, int slot) {
|
||||
try {
|
||||
FileInputStream fos = getInputFile(androidContext, slot);
|
||||
int result = loadWorld(world, fos);
|
||||
int result = loadWorld(world, view, fos);
|
||||
fos.close();
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
@@ -112,12 +112,11 @@ public final class Savegames {
|
||||
dest.close();
|
||||
}
|
||||
|
||||
public static int loadWorld(WorldContext world, InputStream inState) throws IOException {
|
||||
public static int loadWorld(WorldContext world, ViewContext view, InputStream inState) throws IOException {
|
||||
DataInputStream src = new DataInputStream(inState);
|
||||
final FileHeader header = new FileHeader(src);
|
||||
if (header.fileversion > AndorsTrailApplication.CURRENT_VERSION) return LOAD_RESULT_FUTURE_VERSION;
|
||||
|
||||
ViewContext view = new ViewContext(null, world);
|
||||
world.maps.readFromParcel(src, world, view, header.fileversion);
|
||||
world.model = new ModelContainer(src, world, view, header.fileversion);
|
||||
src.close();
|
||||
|
||||
@@ -139,7 +139,7 @@ public final class WorldSetup {
|
||||
|
||||
private int continueWorld() {
|
||||
Context ctx = androidContext.get();
|
||||
int result = Savegames.loadWorld(world, ctx, loadFromSlot);
|
||||
int result = Savegames.loadWorld(world, view, ctx, loadFromSlot);
|
||||
if (result == Savegames.LOAD_RESULT_SUCCESS) {
|
||||
MovementController.cacheCurrentMapData(ctx.getResources(), world, world.model.currentMap);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public final class MonsterMovementController {
|
||||
monsterMovementListeners.onMonsterSteppedOnPlayer(m);
|
||||
view.combatController.monsterSteppedOnPlayer(m);
|
||||
} else {
|
||||
CoordRect previousPosition = new CoordRect(m.position, m.rectPosition.size);
|
||||
CoordRect previousPosition = new CoordRect(new Coord(m.position), m.rectPosition.size);
|
||||
m.position.set(m.nextPosition.topLeft);
|
||||
monsterMovementListeners.onMonsterMoved(m, previousPosition);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user