Fixed wrong angle calculation.
Contributed by Sahar.
This commit is contained in:
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -846,12 +846,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,12 +813,7 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
|||||||
*/
|
*/
|
||||||
public double calculateDirectionTo(ILocational target)
|
public double calculateDirectionTo(ILocational target)
|
||||||
{
|
{
|
||||||
int heading = Util.calculateHeadingFrom(this, target) - _heading;
|
return Util.calculateAngleFrom(this, target);
|
||||||
if (heading < 0)
|
|
||||||
{
|
|
||||||
heading += 65535;
|
|
||||||
}
|
|
||||||
return Util.convertHeadingToDegree(heading);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user