Bugfix: more fixes to movement of blocked monsters when loading savegames.

This commit is contained in:
Oskar Wiksten
2012-08-03 12:30:06 +02:00
parent c5d8ca7b07
commit 11ba3825ba

View 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);
}