Skip to content

Commit

Permalink
remove redundant comments and null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
S010MON committed Apr 7, 2022
1 parent 53b4138 commit 77bec47
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
2 changes: 2 additions & 0 deletions src/main/java/app/model/Coverage.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class Coverage

public Coverage(Map map)
{
System.out.println("Build coverage map ...");
width = map.getWidth();
height = map.getHeight();
vectors = new VectorSet();
Expand All @@ -30,6 +31,7 @@ public Coverage(Map map)
vectors.add(v);
}
}
System.out.print(" done");
}

public double percentSeen(VectorSet seen)
Expand Down
23 changes: 7 additions & 16 deletions src/main/java/app/model/Map.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Map

public Map(Settings settings)
{
System.out.print("Loading settings ... ");
System.out.println("Loading settings ... ");
this.settings = settings;
this.width = settings.getWidth();
this.height = settings.getHeight();
Expand Down Expand Up @@ -91,31 +91,23 @@ public Map(Settings settings)
agents.add(intruder);
}

if (HUMAN_ACTIVE && intruderSpawn != null)
if (HUMAN_ACTIVE)
{
Vector humanStart = randPosition(intruderSpawn);
if (humanStart != null)
{
human = new Human(humanStart, new Vector(1, 0), 10, Team.INTRUDER);
//Assumes the human is a guard
human.setMaxWalk(settings.getWalkSpeedGuard());
human.setMaxSprint(settings.getSprintSpeedGuard());
agents.add(human);
}
human = new Human(humanStart, new Vector(1, 0), 10, Team.INTRUDER);
human.setMaxWalk(settings.getWalkSpeedGuard());
human.setMaxSprint(settings.getSprintSpeedGuard());
agents.add(human);
}

this.coverage = new Coverage(this);
System.out.println("done.");
System.out.print(" done");
}

/**
* Only for testing, delete later
*/
public Map(Agent agent, ArrayList<Furniture> obstacles)
{
agents = new ArrayList<>();
agents.add(agent);

furniture = new ArrayList<>();
furniture.addAll(obstacles);
}
Expand Down Expand Up @@ -143,7 +135,6 @@ public void addSoundFurniture(SettingsObject obj)

public void addSoundSource(SettingsObject obj)
{
// TODO for now?
this.soundSources.add(SoundSourceFactory.make(SoundSourceType.SIREN, Vector.from(obj.getRect()), obj.getAmplitude()));
}

Expand Down

0 comments on commit 77bec47

Please sign in to comment.