Core/Traveller: Calculate the travel time correctly for zero distance
Closes issue #4857 --HG-- branch : trunk
This commit is contained in:
@@ -61,8 +61,8 @@ template<class T>
|
|||||||
inline uint32 Traveller<T>::GetTotalTrevelTimeTo(float x, float y, float z)
|
inline uint32 Traveller<T>::GetTotalTrevelTimeTo(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float dist = GetMoveDestinationTo(x,y,z);
|
float dist = GetMoveDestinationTo(x,y,z);
|
||||||
float speed = Speed();;
|
float speed = Speed();
|
||||||
if (speed <= 0.0f)
|
if (speed < 0.0f)
|
||||||
return 0xfffffffe; // almost infinity-unit should stop
|
return 0xfffffffe; // almost infinity-unit should stop
|
||||||
else
|
else
|
||||||
speed *= 0.001f; // speed is in seconds so convert from second to millisecond
|
speed *= 0.001f; // speed is in seconds so convert from second to millisecond
|
||||||
|
|||||||
Reference in New Issue
Block a user