parent
986cf98aaf
commit
61b186343f
|
@ -552,7 +552,26 @@ bool CAutoFactory::Read(CLevelParserLine* line)
|
|||
|
||||
CObject* CAutoFactory::SearchFret()
|
||||
{
|
||||
return CObjectManager::GetInstancePointer()->FindNearest(nullptr, m_fretPos, OBJECT_METAL, 8.0f/g_unit);
|
||||
CObject* pObj;
|
||||
Math::Vector oPos;
|
||||
ObjectType type;
|
||||
float dist;
|
||||
|
||||
for(auto it : CObjectManager::GetInstancePointer()->GetAllObjects())
|
||||
{
|
||||
pObj = it.second;
|
||||
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_METAL ) continue;
|
||||
if ( pObj->GetTruck() != 0 ) continue;
|
||||
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::Distance(oPos, m_fretPos);
|
||||
|
||||
if ( dist < 8.0f ) return pObj;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Search if a vehicle is too close.
|
||||
|
@ -674,7 +693,28 @@ bool CAutoFactory::CreateVehicle()
|
|||
|
||||
CObject* CAutoFactory::SearchVehicle()
|
||||
{
|
||||
return CObjectManager::GetInstancePointer()->FindNearest(nullptr, m_fretPos, m_type, 8.0f/g_unit);
|
||||
CObject* pObj;
|
||||
Math::Vector oPos;
|
||||
ObjectType type;
|
||||
float dist;
|
||||
|
||||
for(auto it : CObjectManager::GetInstancePointer()->GetAllObjects())
|
||||
{
|
||||
pObj = it.second;
|
||||
|
||||
if ( !pObj->GetLock() ) continue;
|
||||
|
||||
type = pObj->GetType();
|
||||
if ( type != m_type ) continue;
|
||||
if ( pObj->GetTruck() != 0 ) continue;
|
||||
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::Distance(oPos, m_fretPos);
|
||||
|
||||
if ( dist < 8.0f ) return pObj;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Creates all the interface when the object is selected.
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "common/singleton.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
|
||||
/**
|
||||
* \class ObjectManager
|
||||
|
|
|
@ -1031,7 +1031,7 @@ Error CTaskGoto::IsEnded()
|
|||
|
||||
CObject* CTaskGoto::SearchTarget(Math::Vector pos, float margin)
|
||||
{
|
||||
return CObjectManager::GetInstancePointer()->FindNearest(nullptr, pos, OBJECT_NULL, margin);;
|
||||
return CObjectManager::GetInstancePointer()->FindNearest(nullptr, pos, OBJECT_NULL, margin/g_unit);
|
||||
}
|
||||
|
||||
// Adjusts the target as a function of the object.
|
||||
|
|
|
@ -384,6 +384,6 @@ bool CTaskRecover::Abort()
|
|||
|
||||
CObject* CTaskRecover::SearchRuin()
|
||||
{
|
||||
return CObjectManager::GetInstancePointer()->FindNearest(nullptr, m_recoverPos, {OBJECT_RUINmobilew1, OBJECT_RUINmobilew2, OBJECT_RUINmobilet1, OBJECT_RUINmobilet2, OBJECT_RUINmobiler1, OBJECT_RUINmobiler2}, 10.0f);
|
||||
return CObjectManager::GetInstancePointer()->FindNearest(nullptr, m_recoverPos, {OBJECT_RUINmobilew1, OBJECT_RUINmobilew2, OBJECT_RUINmobilet1, OBJECT_RUINmobilet2, OBJECT_RUINmobiler1, OBJECT_RUINmobiler2}, 40.0f/g_unit);
|
||||
}
|
||||
|
||||
|
|
|
@ -1186,12 +1186,12 @@ bool CScriptFunctions::rRadar(CBotVar* var, CBotVar* result, int& exception, voi
|
|||
var = var->GetNext();
|
||||
if ( var != 0 )
|
||||
{
|
||||
minDist = var->GetValFloat()*g_unit;
|
||||
minDist = var->GetValFloat();
|
||||
|
||||
var = var->GetNext();
|
||||
if ( var != 0 )
|
||||
{
|
||||
maxDist = var->GetValFloat()*g_unit;
|
||||
maxDist = var->GetValFloat();
|
||||
|
||||
var = var->GetNext();
|
||||
if ( var != 0 )
|
||||
|
|
Loading…
Reference in New Issue