Archived
0

implement check station in one system on find paths

This commit is contained in:
iMoHax
2014-11-28 15:45:59 +03:00
parent dd00f7be39
commit 96b9da3ebe
21 changed files with 421 additions and 133 deletions

View File

@@ -101,12 +101,12 @@ public class MarketModel {
return BindingsHelper.observableList(analyzer.getTopPaths(balance), modeler::get);
}
PathRoute getPath(SystemModel from, SystemModel to) {
return analyzer.getPath(from.getSystem(), to.getSystem());
PathRoute getPath(StationModel from, StationModel to) {
return analyzer.getPath(from.getStation(), to.getStation());
}
public PathRouteModel getPath(OrderModel order) {
PathRoute p = analyzer.getPath(order.getStation().getStation().getPlace(), order.getBuyer().getStation().getPlace());
PathRoute p = analyzer.getPath(order.getStation().getStation(), order.getBuyer().getStation());
if (p == null) return null;
p.getRoot().getNext().setOrder(new Order(order.getOffer().getOffer(), order.getBuyOffer().getOffer(), order.getCount()));
return modeler.get(p);

View File

@@ -82,7 +82,7 @@ public class PathRouteModel {
}
public void add(OrderModel order){
PathRoute p = market.getPath(order.getStation().getSystem(), order.getBuyer().getSystem());
PathRoute p = market.getPath(order.getStation(), order.getBuyer());
if (p == null) return;
p.getRoot().getNext().setOrder(new Order(order.getOffer().getOffer(), order.getBuyOffer().getOffer(), order.getCount()));
PathRoute head = path.getEnd();

View File

@@ -103,10 +103,7 @@ public class StationModel {
}
public double getDistance(StationModel other){
Place place = station.getPlace();
Place otherPlace = other.station.getPlace();
if (!place.equals(otherPlace)) return station.getPlace().getDistance(other.station.getPlace());
return (station.getDistance() + other.station.getDistance() + Math.abs(station.getDistance() - other.station.getDistance())) * 0.00000003169 / 2;
return station.getDistance(other.station);
}
@Override