mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 01:52:31 +00:00
Fixes to the melee/ranged attack split.
This was SVN commit r3403.
This commit is contained in:
@@ -331,21 +331,7 @@ bool CEntity::processContactAction( CEntityOrder* current, size_t UNUSED(timeste
|
||||
return( false );
|
||||
current->m_data[0].location = current->m_data[0].entity->m_position;
|
||||
float Distance = (current->m_data[0].location - m_position).length();
|
||||
|
||||
//TODO: find a better way than assuming constant action indicators.
|
||||
|
||||
if ( current->m_data[1].data == 1 )
|
||||
{
|
||||
//Are we closer using ranged attack?
|
||||
if ( fabs(Distance - m_actions[4].m_MaxRange) < fabs(Distance - action->m_MaxRange) &&
|
||||
Distance > m_actions[4].m_MinRange && !m_shouldRun && m_actions.find( 4 ) != m_actions.end())
|
||||
{
|
||||
action = &m_actions[4];
|
||||
current->m_data[1].data = 4;
|
||||
}
|
||||
else
|
||||
action = &m_actions[1];
|
||||
}
|
||||
if( Distance < action->m_MaxRange )
|
||||
{
|
||||
(int&)current->m_type = transition;
|
||||
@@ -456,20 +442,6 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times
|
||||
CVector2D delta = current->m_data[0].entity->m_position - m_position;
|
||||
float deltaLength = delta.length();
|
||||
|
||||
//TODO: find a better way than assuming constant action indicators.
|
||||
if ( current->m_data[1].data == 1 )
|
||||
{
|
||||
//Are we closer using ranged attack?
|
||||
if ( fabs(deltaLength - m_actions[4].m_MaxRange) < fabs(deltaLength - action->m_MaxRange) &&
|
||||
deltaLength > m_actions[4].m_MinRange && !m_shouldRun && m_actions.find( 4 ) != m_actions.end())
|
||||
{
|
||||
action = &m_actions[4];
|
||||
current->m_data[1].data = 4;
|
||||
}
|
||||
else
|
||||
action = &m_actions[1];
|
||||
}
|
||||
|
||||
float adjRange = action->m_MaxRange + m_bounds->m_radius + current->m_data[0].entity->m_bounds->m_radius;
|
||||
|
||||
if( action->m_MinRange > 0.0f )
|
||||
|
||||
Reference in New Issue
Block a user