Skip to content

Commit

Permalink
Updated parametization
Browse files Browse the repository at this point in the history
  • Loading branch information
RoiEXLab committed Jul 1, 2016
1 parent 7ea7310 commit d0c6c59
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/games/strategy/triplea/ui/MapRouteDrawer.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void drawRoute(final Graphics2D graphics, final RouteDescription routeDes
final boolean tooFewPoints = points.length <= 2;
final double scale = mapPanel.getScale();
if (tooFewTerritories || tooFewPoints) {
if (routeDescription.getEnd() != null) {
if (routeDescription.getEnd() != null) {//AI has no End Point
drawDirectPath(graphics, getPointOnMap(routeDescription.getStart(), xOffset, yOffset, imageWidth, imageHeight),
getPointOnMap(routeDescription.getEnd(), xOffset, yOffset, imageWidth, imageHeight), xOffset, yOffset,
scale);
Expand Down Expand Up @@ -226,20 +226,21 @@ protected Point[] getRoutePoints(RouteDescription routeDescription, MapData mapD
* @return The "real" Point
*/
private static Point getPointOnMap(Point point, int xOffset, int yOffset, int width, int height) {
int x = (int) point.getX();
int y = (int) point.getY();
Point newPoint = point;
int x = (int) newPoint.getX();
int y = (int) newPoint.getY();
if (x - width > xOffset) {
point = new Point(x - width, y);
newPoint = new Point(x - width, y);
} else if (x - width > 0) {
point = new Point(x + width, y);
newPoint = new Point(x + width, y);
}
x = (int) point.getX();// If the value changed
x = (int) newPoint.getX();// If the value changed
if (y - height > yOffset) {
point = new Point(x, y - height);
newPoint = new Point(x, y - height);
} else if (y - height > 0) {
point = new Point(x, y + height);
newPoint = new Point(x, y + height);
}
return point;
return newPoint;
}

/**
Expand Down

0 comments on commit d0c6c59

Please sign in to comment.