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

minor performance improvements

This commit is contained in:
Enrico Fasoli 2015-08-08 12:26:24 +02:00
parent 3ead974ee2
commit f6ae99b23a

View File

@ -164,14 +164,16 @@ public class World implements Runnable {
while (plants.size() < nPlants) {
spawnVegetable();
}
if (multithreading) { // Multi-thread: use workers
for (Vegetable v : plants) {
v.update();
}
if (multithreading) {
// Multi-thread: use workers
for (Creature c : creatures) {
c.startWorker();
}
Thread.yield();
}
for (Vegetable v : plants) {
v.update();
}
if (multithreading) {
int finishedCount = 0;
while (finishedCount < creatures.size()) {
finishedCount = 0;