Fixed goto() behaviour on 32-bit binaries

Closes issue #844
1008-fix
tomangelo2 2017-07-26 14:54:04 +02:00
parent 75d9f8573b
commit 0de347d430
1 changed files with 5 additions and 2 deletions

View File

@ -803,7 +803,8 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
Error CTaskGoto::IsEnded() Error CTaskGoto::IsEnded()
{ {
Math::Vector pos; Math::Vector pos;
float limit, angle = 0.0f, dist, h, level; float limit, angle = 0.0f, h, level;
volatile float dist; //fix for issue #844
if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_error != ERR_OK ) return m_error; if ( m_error != ERR_OK ) return m_error;
@ -916,7 +917,9 @@ Error CTaskGoto::IsEnded()
if ( m_goalMode == TGG_EXPRESS ) if ( m_goalMode == TGG_EXPRESS )
{ {
dist = Math::DistanceProjected(m_goal, pos); dist = Math::DistanceProjected(m_goal, pos);
if ( dist < 10.0f && dist > m_lastDistance ) float margin = 10.0f;
if ( m_object->Implements(ObjectInterfaceType::Flying) ) margin = 20.0f;
if ( dist < margin && dist > m_lastDistance )
{ {
return ERR_STOP; return ERR_STOP;
} }