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:
parent
3ead974ee2
commit
f6ae99b23a
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user