Ticket #3376: use_passability_grid.patch

File use_passability_grid.patch, 1.9 KB (added by Itms, 9 years ago)
  • source/simulation2/components/CCmpPathfinder.cpp

     
    794794    entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, entity_pos_t r,
    795795    pass_class_t passClass)
    796796{
    797     // Test against obstructions first
     797    // Test against obstructions first. Pathfinding-blocking obstructions are not handled here.
    798798    CmpPtr<ICmpObstructionManager> cmpObstructionManager(GetSystemEntity());
    799     if (!cmpObstructionManager)
     799    if (!cmpObstructionManager || cmpObstructionManager->TestLine(filter, x0, z0, x1, z1, r))
    800800        return false;
    801801
    802     if (cmpObstructionManager->TestLine(filter, x0, z0, x1, z1, r))
    803         return false;
    804 
    805     // Then test against the terrain
    806     return Pathfinding::CheckLineMovement(x0, z0, x1, z1, passClass, *m_TerrainOnlyGrid);
     802    // Then test against the passability grid.
     803    return Pathfinding::CheckLineMovement(x0, z0, x1, z1, passClass, *m_Grid);
    807804}
    808805
    809806ICmpObstruction::EFoundationCheck CCmpPathfinder::CheckUnitPlacement(const IObstructionTestFilter& filter,
  • source/simulation2/components/ICmpObstructionManager.h

     
    346346        if (group == m_Group || (group2 != INVALID_ENTITY && group2 == m_Group))
    347347            return false;
    348348
     349        // If an obstruction already blocks tile-based pathfinding,
     350        // it will be handled as part of the terrain passability handling
     351        // and doesn't need to be matched by this filter
     352        if (flags & ICmpObstructionManager::FLAG_BLOCK_PATHFINDING)
     353            return false;
     354
    349355        if (!(flags & ICmpObstructionManager::FLAG_BLOCK_MOVEMENT))
    350356            return false;
    351357