1
0
mirror of https://github.com/fazo96/AIrium.git synced 2025-01-10 09:34:20 +01:00

added comments

This commit is contained in:
Enrico Fasoli 2015-08-08 12:21:24 +02:00
parent 70d46af962
commit 3ead974ee2

View File

@ -114,6 +114,7 @@ public class World implements Runnable {
public void update() { public void update() {
if (cmdRestart) { if (cmdRestart) {
// Clear everything and start over
elements.clear(); elements.clear();
graveyard.clear(); graveyard.clear();
creatures.clear(); creatures.clear();
@ -129,6 +130,7 @@ public class World implements Runnable {
Log.log(Log.INFO, "Reached maximum generation time (" + maximumTicksPerGen + ")"); Log.log(Log.INFO, "Reached maximum generation time (" + maximumTicksPerGen + ")");
newGen(false); newGen(false);
} }
// Add stuff to the world
for (Element e : toAdd) { for (Element e : toAdd) {
elements.add(e); elements.add(e);
if (e instanceof Creature) { if (e instanceof Creature) {
@ -138,10 +140,11 @@ public class World implements Runnable {
} }
} }
toAdd.clear(); toAdd.clear();
// Clear creature from graveyard
elements.removeAll(graveyard); elements.removeAll(graveyard);
if (selected != null && graveyard.contains(selected)) { if (selected != null && graveyard.contains(selected)) {
selected = null; selected = null;
Log.log(Log.INFO, "Cleared selection"); Log.log(Log.DEBUG, "Cleared selection");
} }
elements.removeAll(deadPlants); elements.removeAll(deadPlants);
plants.removeAll(deadPlants); plants.removeAll(deadPlants);
@ -150,6 +153,7 @@ public class World implements Runnable {
fire(Listener.CREATURE_LIST_CHANGED); fire(Listener.CREATURE_LIST_CHANGED);
} }
if (cmdLaunchNewGen) { if (cmdLaunchNewGen) {
// Skip to new generation
newGen(false); newGen(false);
cmdLaunchNewGen = false; cmdLaunchNewGen = false;
} }