diff --git a/jsettlers.logic/src/main/java/jsettlers/logic/map/grid/MainGrid.java b/jsettlers.logic/src/main/java/jsettlers/logic/map/grid/MainGrid.java index 9929f18d8..e8a6b185a 100644 --- a/jsettlers.logic/src/main/java/jsettlers/logic/map/grid/MainGrid.java +++ b/jsettlers.logic/src/main/java/jsettlers/logic/map/grid/MainGrid.java @@ -16,6 +16,7 @@ import java.io.IOException; import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.BitSet; import java.util.Date; @@ -141,7 +142,7 @@ * @author Andreas Eberle */ public final class MainGrid implements Serializable { - private static final long serialVersionUID = 3824511313693431423L; + private static final long serialVersionUID = 3824511313693431424L; final String mapId; final String mapName; @@ -233,10 +234,20 @@ public void initForPlayer(byte playerId, FogOfWar fogOfWar) { private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); + + short width = ois.readShort(); + short height = ois.readShort(); + initAdditional(); this.bordersThread.checkArea(0, 0, width, height); } + private void writeObject(ObjectOutputStream oos) throws IOException { + oos.defaultWriteObject(); + oos.writeShort(width); + oos.writeShort(height); + } + public void startThreads() { bordersThread.start(); if (fogOfWar != null) { @@ -1220,7 +1231,7 @@ public boolean isInBounds(int x, int y) { } final class MovablePathfinderGrid extends AbstractMovableGrid { - private static final long serialVersionUID = 4006228724969442801L; + private static final long serialVersionUID = 4006228724969442802L; private transient PathfinderGrid pathfinderGrid; private transient AbstractAStar aStar; @@ -1229,9 +1240,19 @@ final class MovablePathfinderGrid extends AbstractMovableGrid { private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); + + short width = ois.readShort(); + short height = ois.readShort(); + initPathfinders(width, height); } + private void writeObject(ObjectOutputStream oos) throws IOException { + oos.defaultWriteObject(); + oos.writeShort(width); + oos.writeShort(height); + } + public MovablePathfinderGrid() { initPathfinders(width, height); }