]> www.infradead.org Git - users/mchehab/andors-trail.git/commitdiff
Bugfix: more fixes to movement of blocked monsters when loading savegames.
authorOskar Wiksten <oskar.wiksten@gmail.com>
Fri, 3 Aug 2012 10:30:06 +0000 (12:30 +0200)
committerOskar Wiksten <oskar.wiksten@gmail.com>
Fri, 3 Aug 2012 10:30:06 +0000 (12:30 +0200)
AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MovementController.java

index 17fc74355e2be95f421e3ace0759b66d00cc853f..a93c5e8003d55c743ea16d353280667bfe3f346f 100644 (file)
@@ -255,10 +255,12 @@ public final class MovementController implements TimedMessageTask.Callback {
                // If any monsters somehow spawned on an unwalkable tile, we move the monster to a new position on the spawnarea
                // This could happen if we change some tile to non-walkable in a future version.
                for (PredefinedMap map : world.maps.predefinedMaps) {
+                       Coord playerPosition = null;
+                       if (map == model.currentMap) playerPosition = model.player.position;
                        for (MonsterSpawnArea a : map.spawnAreas) {
                                for (Monster m : a.monsters) {
                                        if (!map.isWalkable(m.rectPosition)) {
-                                               Coord p = map.getRandomFreePosition(a.area, m.actorTraits.tileSize, model.player.position);
+                                               Coord p = map.getRandomFreePosition(a.area, m.actorTraits.tileSize, playerPosition);
                                                if (p == null) continue;
                                                m.position.set(p);
                                        }