Removed all tmps, multithreading now functional

This commit is contained in:
Anuken
2018-02-06 18:48:10 -05:00
parent 2fafb327c2
commit 59285f76c4
21 changed files with 92 additions and 81 deletions
+2 -2
View File
@@ -79,8 +79,8 @@ public class Pathfind{
if(projectLen < 8 || !onLine(projection, prev.worldx(), prev.worldy(), target.worldx(), target.worldy())){
canProject = false;
}else{
projection.add(v1.set(Angles.angle(prev.worldx(), prev.worldy(),
target.worldx(), target.worldy()), projectLen));
projection.add(v1.set(projectLen, 0).rotate(Angles.angle(prev.worldx(), prev.worldy(),
target.worldx(), target.worldy())));
}
float dst = Vector2.dst(enemy.x, enemy.y, target.worldx(), target.worldy());
@@ -3,16 +3,15 @@ package io.anuke.mindustry.ai;
import com.badlogic.gdx.ai.pfa.DefaultGraphPath;
import com.badlogic.gdx.ai.pfa.SmoothableGraphPath;
import com.badlogic.gdx.math.Vector2;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.util.Tmp;
public class SmoothGraphPath extends DefaultGraphPath<Tile> implements SmoothableGraphPath<Tile, Vector2>{
private Vector2 vector = new Vector2();
@Override
public Vector2 getNodePosition(int index){
Tile tile = nodes.get(index);
return Tmp.v3.set(tile.worldx(), tile.worldy());
return vector.set(tile.worldx(), tile.worldy());
}
@Override