Real fix for d0fc8ff67d
,
Follows fromd0fc8ff67d
,95dbb8be25
. The original diff asserted that only "real" entities would make range queries. This proved inaccurate as building previews can too. However, simply removing the assertion doesn't fix the issue, given that they still aren't found and we still need to account for their size. This fixes that properly by special-casing local entities. Thanks s0600204 for giving this a look. Reported by: Mr.lie Differential Revision: https://code.wildfiregames.com/D3132 This was SVN commit r24231.
This commit is contained in:
parent
7c04ea0211
commit
b3c5347e26
@ -1378,11 +1378,23 @@ public:
|
||||
|
||||
if (q.source.GetId() != INVALID_ENTITY && q.maxRange != entity_pos_t::FromInt(-1))
|
||||
{
|
||||
EntityMap<EntityData>::const_iterator it = m_EntityData.find(q.source.GetId());
|
||||
u32 size = 0;
|
||||
if (ENTITY_IS_LOCAL(q.source.GetId()))
|
||||
{
|
||||
CmpPtr<ICmpObstruction> cmpObstruction(GetSimContext(), q.source.GetId());
|
||||
if (cmpObstruction)
|
||||
size = cmpObstruction->GetSize().ToInt_RoundToInfinity();
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityMap<EntityData>::const_iterator it = m_EntityData.find(q.source.GetId());
|
||||
if (it != m_EntityData.end())
|
||||
size = it->second.size;
|
||||
}
|
||||
// Adjust the range query based on the querier's obstruction radius.
|
||||
// The smallest side of the obstruction isn't known here, so we can't safely adjust the min-range, only the max.
|
||||
// 'size' is the diagonal size rounded up so this will cover all possible rotations of the querier.
|
||||
q.maxRange += fixed::FromInt(it->second.size);
|
||||
q.maxRange += fixed::FromInt(size);
|
||||
}
|
||||
|
||||
q.ownersMask = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user