Skip to content
Snippets Groups Projects
Commit 3e14a5d6 authored by edani95's avatar edani95
Browse files

Map sequence bug fix

parent 65092334
Branches
No related tags found
1 merge request!60Graphcontroller
......@@ -157,6 +157,7 @@ public class Controller {
*/
private boolean initMap(String mapPath) throws IOException
{
Model.getInstance().restartMap();
BufferedReader br = new BufferedReader(new FileReader(mapPath));
String command;
......
......@@ -39,8 +39,6 @@ public class GameController implements PropertyChangeListener{
*/
public void startGameProcess( int[] rZPMCount) throws GameRunningException
{
Model.getInstance().restartMap();
int failure = 0;
int counter = 0;
......@@ -217,7 +215,7 @@ public class GameController implements PropertyChangeListener{
} // end of while
Model.getInstance().removePropertyChangeListener(this);
return; // Map finished
}
......@@ -316,6 +314,7 @@ public class GameController implements PropertyChangeListener{
// update only the changed fields
int coord = (int)evt.getNewValue();
System.out.println(coord);
int xCoord = coord / map[0].length;
int yCoord = coord % map[0].length;
Field changedField = (Field)evt.getOldValue();
......
......@@ -51,6 +51,14 @@ public class Model implements PropertyChangeListener
}
}
public void removePropertyChangeListener(PropertyChangeListener listener)
{
if(listener != null)
{
propSupp.removePropertyChangeListener(listener);
}
}
public void setColonel(Player colonel)
{
this.colonel = colonel;
......@@ -94,6 +102,7 @@ public class Model implements PropertyChangeListener
public void restartMap()
{
map = new ArrayList<>();
isMapFinished = false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment