Ticket #3530: t3530_unobstructive_corpses_v1.patch

File t3530_unobstructive_corpses_v1.patch, 819 bytes (added by elexis, 9 years ago)

Duplicates the obstruction-removal code that corpses have when creating the resource-template after killing animals. Thus no unit shape will be added, we'll have the performance improvement, the bug will not occur and siege is not blocked anymore by dead sheep. We should still check the clearance = 0 thing and make sure it doesn't fail.

  • source/ps/TemplateLoader.cpp

    void CTemplateLoader::CopyResourceSubset  
    552552    permittedComponentTypes.insert("Sound");
    553553    permittedComponentTypes.insert("AIProxy");
    554554
    555555    CParamNode::LoadXMLString(out, "<Entity/>");
    556556    out.CopyFilteredChildrenOfChild(in, "Entity", permittedComponentTypes);
     557
     558    // Disable the Obstruction component (if there is one) so it doesn't affect pathfinding
     559    // (but can still be used for testing this entity for collisions against others)
     560    if (out.GetChild("Entity").GetChild("Obstruction").IsOk())
     561        CParamNode::LoadXMLString(out, "<Entity><Obstruction><Active>false</Active></Obstruction></Entity>");
    557562}