Ticket #3271: Fix.patch

File Fix.patch, 1.6 KB (added by wraitii, 9 years ago)
  • source/simulation2/components/CCmpRangeManager.cpp

     
    16191619    {
    16201620        PROFILE("UpdateVisibilityData");
    16211621
     1622        // Calling UpdateVisibility can modify m_ModifiedEntities, so be careful:
     1623        // infinite loops could be triggered by feedback between entities and their mirages.
     1624        std::map<entity_id_t, u8> attempts;
     1625        while (!m_ModifiedEntities.empty())
     1626        {
     1627            entity_id_t ent = m_ModifiedEntities.back();
     1628            m_ModifiedEntities.pop_back();
     1629
     1630            ++attempts[ent];
     1631            ENSURE(attempts[ent] < 100 && "Infinite loop in UpdateVisibilityData");
     1632
     1633            UpdateVisibility(ent);
     1634        }
     1635       
    16221636        for (i32 n = 0; n < m_LosTilesPerSide * m_LosTilesPerSide; ++n)
    16231637        {
    16241638            for (player_id_t player = 1; player < MAX_LOS_PLAYER_ID + 1; ++player)
     
    16341648
    16351649        std::fill(m_GlobalPlayerVisibilityUpdate.begin(), m_GlobalPlayerVisibilityUpdate.end(), 0);
    16361650        m_GlobalVisibilityUpdate = false;
    1637 
    1638         // Calling UpdateVisibility can modify m_ModifiedEntities, so be careful:
    1639         // infinite loops could be triggered by feedback between entities and their mirages.
    1640         std::map<entity_id_t, u8> attempts;
    1641         while (!m_ModifiedEntities.empty())
    1642         {
    1643             entity_id_t ent = m_ModifiedEntities.back();
    1644             m_ModifiedEntities.pop_back();
    1645 
    1646             ++attempts[ent];
    1647             ENSURE(attempts[ent] < 100 && "Infinite loop in UpdateVisibilityData");
    1648 
    1649             UpdateVisibility(ent);
    16501651        }
    1651     }
    16521652
    16531653    virtual void RequestVisibilityUpdate(entity_id_t ent)
    16541654    {